-
Notifications
You must be signed in to change notification settings - Fork 2
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
Slightly less ruff #526
Slightly less ruff #526
Conversation
Signed-off-by: liamhuber <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
Signed-off-by: liamhuber <[email protected]>
I personally like to use it as an indicator to devs that there's no intention of actually instantiating this class itself, but ruff insists that they are _only_ for specifying interfaces, and without and abstractmethod this doesn't make the cut. I acquiesce. Signed-off-by: liamhuber <[email protected]>
The operation is simple enough that the savings must have been minimal, and this is not used repeatedly (only when parsing class definitions to start with, e.g. at initial import), so any minor cost is going to be tolerable anyhow. Signed-off-by: liamhuber <[email protected]>
Signed-off-by: liamhuber <[email protected]>
Signed-off-by: liamhuber <[email protected]>
Per ruff deprecation warning Signed-off-by: liamhuber <[email protected]>
It was placed intentionally separate from the other imports to distinguish the pyironic single-import user interface from the more standard user/dev public API imports. The line is annotated to prevent ruff from moving it back later. Signed-off-by: liamhuber <[email protected]>
Signed-off-by: liamhuber <[email protected]>
…o accept the drop in readability from ruff's formatting here. On a quick search, I didn't find any way to modify just this element of the formatting.
Until I either cave on the multiline string formatting, or ruff let's us change it. In the meantime we use black anyhow for formatting. Signed-off-by: liamhuber <[email protected]>
@XzzX, with these amendments I'm happy with #520. Basically I accepted most of the formatting, but ultimately I turned it off and we'll lean on black for now. Otherwise the only anti-ruff thing I did was keep the top-level |
[tool.ruff.lint.per-file-ignores] | ||
"__init__.py" = ["F401"] # Ignore unused imports in init files -- we specify APIs this way |
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 am unsure if the generalization here is necessary, but I am ok with it.
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.
We need to find a way how to deal with multiline strings also in black.
I got stuck in authentification hell, so I only had time to just get started; more to come.
Timing test:
With lru cache:
45.3 ns ± 0.584 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
Without:
46.6 ns ± 0.398 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
A completely inconsequential difference, so I got rid of the creator/wrapper caches. I'll check the remaining cache next.