Skip to content

Commit 666108e

Browse files
Merge pull request #217 from nucleic/ruff-fixes
Sort slots and __all__ attrs (fix linting issues)
2 parents ae1370b + 646de37 commit 666108e

File tree

13 files changed

+325
-326
lines changed

13 files changed

+325
-326
lines changed

atom/api.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -67,58 +67,58 @@
6767
__all__ = [
6868
"Atom",
6969
"AtomMeta",
70-
"MissingMemberWarning",
71-
"add_member",
72-
"observe",
73-
"set_default",
74-
"clone_if_needed",
70+
"Bool",
71+
"Bytes",
7572
"CAtom",
73+
"Callable",
74+
"ChangeDict",
7675
"ChangeType",
77-
"DefaultValue",
78-
"GetAttr",
79-
"GetState",
80-
"Member",
81-
"PostGetAttr",
82-
"PostSetAttr",
83-
"PostValidate",
84-
"SetAttr",
85-
"Validate",
86-
"atomclist",
87-
"atomdict",
88-
"defaultatomdict",
89-
"atomlist",
90-
"atomref",
91-
"atomset",
9276
"Coerced",
77+
"Constant",
9378
"ContainerList",
79+
"DefaultDict",
80+
"DefaultValue",
9481
"Delegator",
9582
"Dict",
96-
"DefaultDict",
9783
"Enum",
9884
"Event",
85+
"FixedTuple",
86+
"Float",
87+
"FloatRange",
9988
"ForwardInstance",
89+
"ForwardSubclass",
90+
"ForwardTyped",
91+
"GetAttr",
92+
"GetState",
10093
"Instance",
94+
"Int",
10195
"List",
96+
"Member",
97+
"MissingMemberWarning",
98+
"PostGetAttr",
99+
"PostSetAttr",
100+
"PostValidate",
102101
"Property",
103-
"cached_property",
104-
"Bool",
105-
"Bytes",
106-
"Callable",
107-
"Constant",
108-
"Float",
109-
"FloatRange",
110-
"Int",
111102
"Range",
112103
"ReadOnly",
113-
"Str",
114-
"Value",
115104
"Set",
105+
"SetAttr",
116106
"Signal",
117-
"ForwardSubclass",
107+
"Str",
118108
"Subclass",
119109
"Tuple",
120-
"ForwardTyped",
121110
"Typed",
122-
"FixedTuple",
123-
"ChangeDict",
111+
"Validate",
112+
"Value",
113+
"add_member",
114+
"atomclist",
115+
"atomdict",
116+
"atomlist",
117+
"atomref",
118+
"atomset",
119+
"cached_property",
120+
"clone_if_needed",
121+
"defaultatomdict",
122+
"observe",
123+
"set_default",
124124
]

atom/instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ForwardInstance(Instance):
9999
100100
"""
101101

102-
__slots__ = ("resolve", "args", "kwargs", "optional")
102+
__slots__ = ("args", "kwargs", "optional", "resolve")
103103

104104
def __init__(self, resolve, args=None, kwargs=None, *, factory=None, optional=None):
105105
"""Initialize a ForwardInstance.

atom/meta/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
__all__ = [
1515
"AtomMeta",
16-
"observe",
1716
"MissingMemberWarning",
1817
"add_member",
19-
"set_default",
2018
"clone_if_needed",
19+
"observe",
20+
"set_default",
2121
]

atom/meta/atom_meta.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,22 @@ class _AtomMetaHelper:
202202
getstates: List[str]
203203

204204
__slots__ = (
205-
"name",
206205
"bases",
207206
"dct",
207+
"decorated",
208+
"defaults",
209+
"getstates",
208210
"members",
209-
"owned_members",
210-
"specific_members",
211+
"name",
211212
"observes",
212-
"defaults",
213-
"validates",
214-
"decorated",
215-
"set_defaults",
213+
"owned_members",
216214
"post_getattrs",
217215
"post_setattrs",
218216
"post_validates",
219-
"getstates",
220217
"seen_decorated",
218+
"set_defaults",
219+
"specific_members",
220+
"validates",
221221
)
222222

223223
def __init__(self, name: str, bases: Tuple[type, ...], dct: Dict[str, Any]) -> None:

atom/meta/member_modifiers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class set_default(object):
1414
"""An object used to set the default value of a base class member."""
1515

16-
__slots__ = ("value", "name")
16+
__slots__ = ("name", "value")
1717

1818
#: Name of the member for which a new default value should be set. Used by
1919
#: the metaclass.

atom/meta/observation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def observe(*names: str, change_types: ChangeType = ChangeType.ANY) -> "ObserveH
6565
class ObserveHandler(object):
6666
"""An object used to temporarily store observe decorator state."""
6767

68-
__slots__ = ("pairs", "func", "funcname", "change_types")
68+
__slots__ = ("change_types", "func", "funcname", "pairs")
6969

7070
#: List of 2-tuples which stores the pair information for the observers.
7171
pairs: List[Tuple[str, Optional[str]]]
@@ -132,7 +132,7 @@ def clone(self) -> "ObserveHandler":
132132
class ExtendedObserver(object):
133133
"""A callable object used to implement extended observers."""
134134

135-
__slots__ = ("funcname", "attr")
135+
__slots__ = ("attr", "funcname")
136136

137137
#: Name of the function on the owner object which should be used as the observer.
138138
funcname: str

atom/typed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ForwardTyped(Typed):
9999
100100
"""
101101

102-
__slots__ = ("resolve", "args", "kwargs", "optional")
102+
__slots__ = ("args", "kwargs", "optional", "resolve")
103103

104104
def __init__(self, resolve, args=None, kwargs=None, *, factory=None, optional=None):
105105
"""Initialize a ForwardTyped.

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#
66
# The full license is in the file LICENSE, distributed with this software.
77
# --------------------------------------------------------------------------------------
8-
import os
98

109
from setuptools import Extension, setup
1110

tests/test_get_set_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def task():
227227
@pytest.mark.parametrize("fn", ("c", "py"))
228228
def test_bench_getstate_slots(benchmark, fn):
229229
class Test(AtomBase):
230-
__slots__ = ("foo", "bar")
230+
__slots__ = ("bar", "foo")
231231
name = Str("Name")
232232
enabled = Bool(True)
233233
rating = Float()

tests/type_checking/test_annotations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
member_type: atom.list.List[builtins.int]
1414
member_value_type: builtins.list[builtins.int]
1515
main: |
16-
import io
16+
import _io
1717
from typing import Type
1818
from atom.api import Atom, {{ member }}
1919

0 commit comments

Comments
 (0)