-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Apply assorted ruff/flake8-simplify rules (SIM) #10364
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIM102 Use a single `if` statement instead of nested `if` statements
SIM102 Use a single `if` statement instead of nested `if` statements While the `if` statement may become more complex, the following lines get unindented. I feel this improves readability in most cases. Of course, the alternative would be to let the programer decide about readability.
SIM105 Use `contextlib.suppress(OutOfBoundsDatetime, ValueError)` instead of `try`-`except`-`pass` Sometimes this adds an import (contextlib). Is it worth it?
SIM114 Combine `if` branches using logical `or` operator
SIM201 Use `... != ...` instead of `not ... == ...`
SIM210 Remove unnecessary `True if ... else False`
SIM211 Use `not ...` instead of `False if ... else True`
SIM910 Use `.get(...)` instead of `.get(..., None)`
overall these indeed seem better |
dcherian
added a commit
to dcherian/xarray
that referenced
this pull request
May 30, 2025
* main: Fix performance regression in interp from pydata#9881 (pydata#10370) html repr: improve style for dropdown sections (pydata#10354) Grouper tweaks. (pydata#10362) Docs: Add links to getting help mermaid diagram (pydata#10324) Enforce ruff/flynt rules (FLY) (pydata#10375) Add missing AbstractWritableDataStore base methods and arguments (pydata#10343) Improve html repr in dark mode (Jupyterlab + Xarray docs) (pydata#10353) Pin Mypy to 1.15 (pydata#10378) use numpy dtype exposed by zarr array instead of metadata.data_type (pydata#10348) Fix doc typo for caption "Interoperability" (pydata#10374) Implement cftime vectorization as discussed in PR pydata#8322 (pydata#8324) Enforce ruff/flake8-pyi rules (PYI) (pydata#10359) Apply assorted ruff/Pylint rules (PL) / Enforce PLE rules (pydata#10366) (fix): pandas extension array repr for int64[pyarrow] (pydata#10317) Enforce ruff/flake8-implicit-str-concat rules (ISC) (pydata#10368) Enforce ruff/refurb rules (FURB) (pydata#10367) Ignore ruff/Pyflakes rule F401 more precisely (pydata#10369) Apply assorted ruff/flake8-simplify rules (SIM) (pydata#10364) Apply assorted ruff/flake8-pytest-style rules (PT) (pydata#10363) Fix "a array" misspelling (pydata#10365)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
io
topic-backends
topic-CF conventions
topic-cftime
topic-dask
topic-documentation
topic-groupby
topic-plotting
topic-zarr
Related to zarr storage library
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are debatable rules, sometimes the result is less readable. I have selected those rules that do seem to make sense in this repository.
whats-new.rst
api.rst