Chore: Conform src/autobahn to ruff's UP rules#1843
Chore: Conform src/autobahn to ruff's UP rules#1843oberstet merged 1 commit intocrossbario:masterfrom
Conversation
| from typing import Any | ||
| from collections.abc import Callable | ||
|
|
||
| # FIXME: see ISecurityModule.__iter__ |
There was a problem hiding this comment.
There already was a FIXME in ISecurityModule.__iter__, so it seemed unnecessary to have it here as well
7588cf9 to
cee77a0
Compare
|
as a "note to self", cleaning up my mind, Claude to the rescue (bonus: I learned a new english word, "vestigial";)
● Great question! This is Python 2 vs Python 3 history. Python 2: Two Types of Classes In Python 2, there were two fundamentally different class types: # Old-style class (classic class) - Python 2
class Foo:
pass
# New-style class - Python 2.2+
class Bar(object):
passWhy New-Style Classes Mattered
The Diamond Problem class A: pass # old-style
class B(A): pass
class C(A): pass
class D(B, C): pass # MRO: D → B → A → C → A (A visited twice, wrong!)
class A(object): pass # new-style
class B(A): pass
class C(A): pass
class D(B, C): pass # MRO: D → B → C → A (correct C3 linearization)Twisted Connection Yes, Twisted specifically required new-style classes because:
So for any Twisted-based codebase (like Autobahn), class Foo(object): was mandatory for Python 2 compatibility. Python 3: All Classes Are New-Style In Python 3, the distinction was removed. All classes are new-style by default: # Python 3 - these are 100% identical:
class Foo:
pass
class Foo(object):
passThe (object) is now purely vestigial noise. The ruff rule UP004 removes it. TL;DR
|
Description
Refactors the
src/autobahnfolder to conform to ruff's UP rules.Most changes were done automatically using
ruff check --fix --unsafe-fixes --select UP src/autobahn/, with some manual intervention to adjust the remaining ones.Related Issue(s)
Closes or relates to #1841
Checklist
the style guidelines of this project
is effective or that my feature works
updated the changelog
in this PR