-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: linting_II
Are you sure you want to change the base?
Linting iii #235
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
This reverts commit 35dec99.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before
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