Skip to content

Commit 45b6b6b

Browse files
committed
Update Ruff
1 parent 6c89173 commit 45b6b6b

7 files changed

+30
-28
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.7.4
7+
rev: v0.8.1
88
hooks:
99
- id: ruff
1010
args: [--fix, --exit-non-zero-on-fix]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ ignore = [
213213
"PLW0603", # sometimes we need globals
214214
"S307", # eval FTW
215215
"SLF001", # private members are accessed by friendly functions
216-
"TCH", # TYPE_CHECKING blocks break autodocs
216+
"TC", # TYPE_CHECKING blocks break autodocs
217217
"TD", # we don't follow other people's todo style
218218
"TRY301", # I'm sorry, but this makes not sense for us.
219219
"UP031", # format() is slow as molasses; % and f'' FTW.

src/attr/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class AttrsInstance(Protocol):
3737

3838

3939
__all__ = [
40+
"NOTHING",
4041
"Attribute",
4142
"AttrsInstance",
4243
"Converter",
4344
"Factory",
44-
"NOTHING",
4545
"asdict",
4646
"assoc",
4747
"astuple",

src/attr/_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: MIT
22

3-
__all__ = ["set_run_validators", "get_run_validators"]
3+
__all__ = ["get_run_validators", "set_run_validators"]
44

55
_run_validators = True
66

src/attr/_make.py

+19-17
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,15 @@ class _ClassBuilder:
578578
"_cls_dict",
579579
"_delete_attribs",
580580
"_frozen",
581-
"_has_pre_init",
582-
"_pre_init_has_args",
581+
"_has_custom_setattr",
583582
"_has_post_init",
583+
"_has_pre_init",
584584
"_is_exc",
585585
"_on_setattr",
586+
"_pre_init_has_args",
586587
"_slots",
587588
"_weakref_slot",
588589
"_wrote_own_setattr",
589-
"_has_custom_setattr",
590590
)
591591

592592
def __init__(
@@ -2276,7 +2276,9 @@ class Attribute:
22762276
For the full version history of the fields, see `attr.ib`.
22772277
"""
22782278

2279-
__slots__ = (
2279+
# These slots must NOT be reordered because we use them later for
2280+
# instantiation.
2281+
__slots__ = ( # noqa: RUF023
22802282
"name",
22812283
"default",
22822284
"validator",
@@ -2470,22 +2472,22 @@ class _CountingAttr:
24702472
"""
24712473

24722474
__slots__ = (
2473-
"counter",
24742475
"_default",
2475-
"repr",
2476+
"_validator",
2477+
"alias",
2478+
"converter",
2479+
"counter",
24762480
"eq",
24772481
"eq_key",
2478-
"order",
2479-
"order_key",
24802482
"hash",
24812483
"init",
2482-
"metadata",
2483-
"_validator",
2484-
"converter",
2485-
"type",
24862484
"kw_only",
2485+
"metadata",
24872486
"on_setattr",
2488-
"alias",
2487+
"order",
2488+
"order_key",
2489+
"repr",
2490+
"type",
24892491
)
24902492
__attrs_attrs__ = (
24912493
*tuple(
@@ -2691,12 +2693,12 @@ class Converter:
26912693
"""
26922694

26932695
__slots__ = (
2694-
"converter",
2695-
"takes_self",
2696-
"takes_field",
2696+
"__call__",
26972697
"_first_param_type",
26982698
"_global_name",
2699-
"__call__",
2699+
"converter",
2700+
"takes_field",
2701+
"takes_self",
27002702
)
27012703

27022704
def __init__(self, converter, *, takes_self=False, takes_field=False):

src/attr/validators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def matches_re(regex, flags=0, func=None):
172172
if func not in valid_funcs:
173173
msg = "'func' must be one of {}.".format(
174174
", ".join(
175-
sorted(e and e.__name__ or "None" for e in set(valid_funcs))
175+
sorted((e and e.__name__) or "None" for e in set(valid_funcs))
176176
)
177177
)
178178
raise ValueError(msg)

src/attrs/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727

2828

2929
__all__ = [
30+
"NOTHING",
31+
"Attribute",
32+
"AttrsInstance",
33+
"Converter",
34+
"Factory",
3035
"__author__",
3136
"__copyright__",
3237
"__description__",
@@ -40,24 +45,19 @@
4045
"asdict",
4146
"assoc",
4247
"astuple",
43-
"Attribute",
44-
"AttrsInstance",
4548
"cmp_using",
46-
"Converter",
4749
"converters",
4850
"define",
4951
"evolve",
5052
"exceptions",
51-
"Factory",
5253
"field",
53-
"fields_dict",
5454
"fields",
55+
"fields_dict",
5556
"filters",
5657
"frozen",
5758
"has",
5859
"make_class",
5960
"mutable",
60-
"NOTHING",
6161
"resolve_types",
6262
"setters",
6363
"validate",

0 commit comments

Comments
 (0)