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

Apply ruff rules to Python scripts #198

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

DimitriPapadopoulos
Copy link
Contributor

I'm assuming all scripts are Python 3 scripts, except this one:
specification/src/main/resources/transforms/util/write-transforms.py

The latter has been marked as a Python 2 script.

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

From an initial code review, I don't see concerning changes. Given the modifications to the code generation utilities, we'll need to confirm that the generated classes are unmodified by this change for all supported Python versions.

Several contributions are made against files of a package which has just been deprecated and are scheduled for removal in an upcoming release (setup.py, ome_model/experimental.py, test/unit/*) - see #194 for more details. Given the scope of this work, we might pioritize the clean up of these classes first and update you when this is completed and conflicts should be resolved so that only changes against xsd-fu utility are evaluated

setup.py Show resolved Hide resolved
xsd-fu/python/util.py Show resolved Hide resolved
F401 imported but unused
E402 Module level import not at top of file
E703 Statement ends with an unnecessary semicolon
W291 Trailing whitespace
W293 Blank line contains whitespace
W391 Too many newlines at end of file
C414 Unnecessary `list()` call within `sorted()`
C419 Unnecessary list comprehension
EXE001 Shebang is present but file is not executable
ISC002 Implicitly concatenated string literals over multiple lines
PIE790 Unnecessary `pass` statement
PIE810 Call `startswith` once with a `tuple`
SIM103 Return the condition directly
bool() is not required as the type of expressions is already bool
SIM110 Use `return any()` instead of `for` loop
SIM118 Use `key in dict` instead of `key in dict.keys()`
SIM401 Use `.get(...)` instead of an `if` block
FURB142 Use of `set.add()` in a for loop
FURB148 `enumerate` index is unused, use `for x in y` instead
UP003 Use `str` instead of `type("")`
UP004 Class inherits from `object`
UP008 Use `super()` instead of `super(__class__, self)`
UP009 UTF-8 encoding declaration is unnecessary
The default encoding of Python 3 is UTF-8, use it! Then there's no need
to explicitely declare the encoding.

The modified file is a plain ASCII file, by the way.
UP024 Replace aliased errors with `OSError`
UP034 Avoid extraneous parentheses
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