-
Notifications
You must be signed in to change notification settings - Fork 30
Adds Pyupgrade (UP) ruleset to ruff linter #661
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
Conversation
jamescrake-merani
left a comment
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'm approving but take a quick look at the comments, and then merge if you're happy.
| @@ -37,8 +34,6 @@ | |||
| QC_ONLY = True # show only what is needed for dqc in the symmetric case | |||
|
|
|||
| # include unicode symbols in output, even if piping to a pager | |||
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 comment still needed now?
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, I think so, because the init_printing routine is there to allow printing unicode characters.
| from docutils.writers.html4css1 import HTMLTranslator | ||
| from docutils.nodes import SkipNode | ||
|
|
||
| # pylint: disable=unused-import |
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 hesitated a bit when I saw that we previously disabled this unused import warning, but now I think about it, I think we already solved this problem by bumping the minimum Python version. So I don't think this is needed.
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.
The import of Tuple is only used for a single type hint, and we're switching to using tuple instead of typing.Tuple throughout the code, so I'm happy that we're ok here.
| def load_sasfit(path): | ||
| data = np.loadtxt(path, dtype=str, delimiter=';').T | ||
| data = np.vstack((map(float, v) for v in data[0:2])) | ||
| data = np.vstack(map(float, v) for v in data[0:2]) |
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 should be failing. For version 2.2.6 that I happen to have installed, np.vstack(generator) gives
TypeError: arrays to stack must be passed as a "sequence" type such as list or tuple.
This is a bug in the original, which should have used [...] rather than (...) when forming the sequence to send to vstack, so not an error introduced by this PR.
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.
Thanks for letting me know, I'll put in a one-liner PR to correct this.
No description provided.