Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting iii #235

Open
wants to merge 17 commits into
base: linting_II
Choose a base branch
from
Open

Linting iii #235

wants to merge 17 commits into from

Conversation

mschwoer
Copy link
Contributor

@mschwoer mschwoer commented Nov 15, 2024

manual fixes for a first bunch of linting rules ..
see individual commits

edit: made all start imports in notebooks explicit as tests started to fail due to removal of os from some readers

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@GeorgWa GeorgWa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I think the Path() / Path() syntax is quite ugly and missuses python magic methods :D but if the community thinks this is the way to go I'm happy to do so.
I'm also not a big fan of ther new read only .to_numpy() buit I guess I have to live with this.

@@ -1,4 +1,4 @@
import os
from pathlib import Path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a thing? that Path is prefered over os?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.. imho it makes path operations much more readable,
I especially like the overloading of the / operator when it comes to using it (e.g. Path("/home/") / "user").
I especially dislike the overloading of the / operator when it comes to mocking it :-)

@@ -18,8 +18,8 @@
warnings.filterwarnings("always")

mod_to_unimod_dict = {}
for mod_name, unimod_id in MOD_DF[["mod_name", "unimod_id"]].values:
unimod_id = int(unimod_id)
for mod_name, unimod_id_ in MOD_DF[["mod_name", "unimod_id"]].to_numpy():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this suffix thing a known pattern? I only now it as private prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it to avoid name clashes, e.g. with built-ins or other variables

@@ -292,7 +292,7 @@ def _lookup_modification(
The name of the matched modification in alphabase format.
"""
mass_distance = mod_annotated_df["mass"].values - mass_observed
mass_distance = mod_annotated_df["mass"].to_numpy() - mass_observed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a tricky change. It might have some performance implications as it performas a copy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wish, we can disable the rule and revert? however, pandas docs recommend using to_numpy()
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.values.html

frag_num -= 1
elif frag_type in "xyz":
frag_num = nAA - frag_num - 1
].to_numpy():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants