Skip to content

Enable ruff linting and formatting, formatted and tuned code to satis…#129

Merged
ivankorobkov merged 1 commit intomasterfrom
fmt-py
Aug 25, 2025
Merged

Enable ruff linting and formatting, formatted and tuned code to satis…#129
ivankorobkov merged 1 commit intomasterfrom
fmt-py

Conversation

@pyctrl
Copy link
Collaborator

@pyctrl pyctrl commented Aug 20, 2025

Tried to avoid code changes at all, but a few moments came up.

Dropped Python 2 support:

-        if sys.version_info.major == 2:
-            arg_names = inspect.getargspec(func).args
-        else:
-            arg_names = inspect.getfullargspec(func).args
+        arg_names = inspect.getfullargspec(func).args

and

-            def __nonzero__(self):
-                """Python 2"""
-                raise NotImplementedError("Casting to boolean is not allowed")

Also simplified class in tests to be dataclass:

+        @dataclasses.dataclass
         class SomeClass:
-            def __init__(self, another_object: AnotherClass):
-                self.another_object = another_object
+            another_object: AnotherClass

Simplified this expression (linter asked for ternary operator or this one):

-if _HAS_PEP604_SUPPORT:
-    _HAS_PEP560_SUPPORT = True
-else:
-    _HAS_PEP560_SUPPORT = sys.version_info[:3] >= (3, 7, 0)  # PEP 560
+_HAS_PEP560_SUPPORT = _HAS_PEP604_SUPPORT or sys.version_info[:3] >= (3, 7, 0)

@ivankorobkov ivankorobkov merged commit acc4ace into master Aug 25, 2025
14 checks passed
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