@@ -157,10 +157,6 @@ def _expr_as_dict(expression: Expr, **kwargs: Any) -> dict[str, Any]:
157157 "typing.Set" : "set" ,
158158}
159159
160- # YORE: EOL 3.9: Remove block.
161- _dataclass_opts : dict [str , bool ] = {}
162- if sys .version_info >= (3 , 10 ):
163- _dataclass_opts ["slots" ] = True
164160
165161
166162@dataclass
@@ -257,8 +253,7 @@ def is_generator(self) -> bool:
257253 return isinstance (self , ExprSubscript ) and self .canonical_name == "Generator"
258254
259255
260- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
261- @dataclass (eq = True , ** _dataclass_opts )
256+ @dataclass (eq = True , slots = True )
262257class ExprAttribute (Expr ):
263258 """Attributes like `a.b`."""
264259
@@ -310,8 +305,7 @@ def canonical_path(self) -> str:
310305 return self .last .canonical_path
311306
312307
313- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
314- @dataclass (eq = True , ** _dataclass_opts )
308+ @dataclass (eq = True , slots = True )
315309class ExprBinOp (Expr ):
316310 """Binary operations like `a + b`."""
317311
@@ -333,8 +327,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
333327 yield from _yield (self .right , flat = flat , outer_precedence = right_precedence , is_left = False )
334328
335329
336- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
337- @dataclass (eq = True , ** _dataclass_opts )
330+ @dataclass (eq = True , slots = True )
338331class ExprBoolOp (Expr ):
339332 """Boolean operations like `a or b`."""
340333
@@ -352,8 +345,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
352345 yield from _yield (value , flat = flat , outer_precedence = precedence , is_left = False )
353346
354347
355- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
356- @dataclass (eq = True , ** _dataclass_opts )
348+ @dataclass (eq = True , slots = True )
357349class ExprCall (Expr ):
358350 """Calls like `f()`."""
359351
@@ -374,8 +366,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
374366 yield ")"
375367
376368
377- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
378- @dataclass (eq = True , ** _dataclass_opts )
369+ @dataclass (eq = True , slots = True )
379370class ExprCompare (Expr ):
380371 """Comparisons like `a > b`."""
381372
@@ -394,8 +385,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
394385 yield from _yield (comp , flat = flat , outer_precedence = precedence )
395386
396387
397- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
398- @dataclass (eq = True , ** _dataclass_opts )
388+ @dataclass (eq = True , slots = True )
399389class ExprComprehension (Expr ):
400390 """Comprehensions like `a for b in c if d`."""
401391
@@ -424,8 +414,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
424414# see `_build_constant` below (it always returns the value directly).
425415# Maybe we could simply get rid of it, as it wouldn't bring much value
426416# if used anyway.
427- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
428- @dataclass (eq = True , ** _dataclass_opts )
417+ @dataclass (eq = True , slots = True )
429418class ExprConstant (Expr ):
430419 """Constants like `"a"` or `1`."""
431420
@@ -436,8 +425,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]: # noqa: ARG002
436425 yield self .value
437426
438427
439- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
440- @dataclass (eq = True , ** _dataclass_opts )
428+ @dataclass (eq = True , slots = True )
441429class ExprDict (Expr ):
442430 """Dictionaries like `{"a": 0}`."""
443431
@@ -456,8 +444,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
456444 yield "}"
457445
458446
459- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
460- @dataclass (eq = True , ** _dataclass_opts )
447+ @dataclass (eq = True , slots = True )
461448class ExprDictComp (Expr ):
462449 """Dict comprehensions like `{k: v for k, v in a}`."""
463450
@@ -478,8 +465,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
478465 yield "}"
479466
480467
481- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
482- @dataclass (eq = True , ** _dataclass_opts )
468+ @dataclass (eq = True , slots = True )
483469class ExprExtSlice (Expr ):
484470 """Extended slice like `a[x:y, z]`."""
485471
@@ -490,8 +476,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
490476 yield from _join (self .dims , ", " , flat = flat )
491477
492478
493- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
494- @dataclass (eq = True , ** _dataclass_opts )
479+ @dataclass (eq = True , slots = True )
495480class ExprFormatted (Expr ):
496481 """Formatted string like `{1 + 1}`."""
497482
@@ -505,8 +490,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
505490 yield "}"
506491
507492
508- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
509- @dataclass (eq = True , ** _dataclass_opts )
493+ @dataclass (eq = True , slots = True )
510494class ExprGeneratorExp (Expr ):
511495 """Generator expressions like `a for b in c for d in e`."""
512496
@@ -521,8 +505,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
521505 yield from _join (self .generators , " " , flat = flat )
522506
523507
524- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
525- @dataclass (eq = True , ** _dataclass_opts )
508+ @dataclass (eq = True , slots = True )
526509class ExprIfExp (Expr ):
527510 """Conditions like `a if b else c`."""
528511
@@ -551,8 +534,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
551534 yield from _yield (self .orelse , flat = flat , outer_precedence = precedence , is_left = False )
552535
553536
554- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
555- @dataclass (eq = True , ** _dataclass_opts )
537+ @dataclass (eq = True , slots = True )
556538class ExprJoinedStr (Expr ):
557539 """Joined strings like `f"a {b} c"`."""
558540
@@ -565,8 +547,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
565547 yield "'"
566548
567549
568- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
569- @dataclass (eq = True , ** _dataclass_opts )
550+ @dataclass (eq = True , slots = True )
570551class ExprKeyword (Expr ):
571552 """Keyword arguments like `a=b`."""
572553
@@ -606,8 +587,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
606587 yield from _yield (self .value , flat = flat )
607588
608589
609- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
610- @dataclass (eq = True , ** _dataclass_opts )
590+ @dataclass (eq = True , slots = True )
611591class ExprVarPositional (Expr ):
612592 """Variadic positional parameters like `*args`."""
613593
@@ -619,8 +599,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
619599 yield from _yield (self .value , flat = flat )
620600
621601
622- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
623- @dataclass (eq = True , ** _dataclass_opts )
602+ @dataclass (eq = True , slots = True )
624603class ExprVarKeyword (Expr ):
625604 """Variadic keyword parameters like `**kwargs`."""
626605
@@ -632,8 +611,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
632611 yield from _yield (self .value , flat = flat )
633612
634613
635- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
636- @dataclass (eq = True , ** _dataclass_opts )
614+ @dataclass (eq = True , slots = True )
637615class ExprLambda (Expr ):
638616 """Lambda expressions like `lambda a: a.b`."""
639617
@@ -676,8 +654,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
676654 yield from _yield (self .body , flat = flat , outer_precedence = _OperatorPrecedence .NONE )
677655
678656
679- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
680- @dataclass (eq = True , ** _dataclass_opts )
657+ @dataclass (eq = True , slots = True )
681658class ExprList (Expr ):
682659 """Lists like `[0, 1, 2]`."""
683660
@@ -690,8 +667,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
690667 yield "]"
691668
692669
693- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
694- @dataclass (eq = True , ** _dataclass_opts )
670+ @dataclass (eq = True , slots = True )
695671class ExprListComp (Expr ):
696672 """List comprehensions like `[a for b in c]`."""
697673
@@ -708,8 +684,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
708684 yield "]"
709685
710686
711- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
712- @dataclass (eq = False , ** _dataclass_opts )
687+ @dataclass (eq = False , slots = True )
713688class ExprName (Expr ): # noqa: PLW1641
714689 """This class represents a Python object identified by a name in a given scope."""
715690
@@ -803,8 +778,7 @@ def is_type_parameter(self) -> bool:
803778 return "[" in self .canonical_path
804779
805780
806- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
807- @dataclass (eq = True , ** _dataclass_opts )
781+ @dataclass (eq = True , slots = True )
808782class ExprNamedExpr (Expr ):
809783 """Named/assignment expressions like `a := b`."""
810784
@@ -819,8 +793,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
819793 yield from _yield (self .value , flat = flat )
820794
821795
822- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
823- @dataclass (eq = True , ** _dataclass_opts )
796+ @dataclass (eq = True , slots = True )
824797class ExprParameter (Expr ):
825798 """Parameters in function signatures like `a: int = 0`."""
826799
@@ -834,8 +807,7 @@ class ExprParameter(Expr):
834807 """Parameter default."""
835808
836809
837- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
838- @dataclass (eq = True , ** _dataclass_opts )
810+ @dataclass (eq = True , slots = True )
839811class ExprSet (Expr ):
840812 """Sets like `{0, 1, 2}`."""
841813
@@ -848,8 +820,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
848820 yield "}"
849821
850822
851- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
852- @dataclass (eq = True , ** _dataclass_opts )
823+ @dataclass (eq = True , slots = True )
853824class ExprSetComp (Expr ):
854825 """Set comprehensions like `{a for b in c}`."""
855826
@@ -866,8 +837,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
866837 yield "}"
867838
868839
869- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
870- @dataclass (eq = True , ** _dataclass_opts )
840+ @dataclass (eq = True , slots = True )
871841class ExprSlice (Expr ):
872842 """Slices like `[a:b:c]`."""
873843
@@ -889,8 +859,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
889859 yield from _yield (self .step , flat = flat )
890860
891861
892- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
893- @dataclass (eq = True , ** _dataclass_opts )
862+ @dataclass (eq = True , slots = True )
894863class ExprSubscript (Expr ):
895864 """Subscripts like `a[b]`."""
896865
@@ -948,8 +917,7 @@ def canonical_path(self) -> str:
948917 return self .left .canonical_path
949918
950919
951- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
952- @dataclass (eq = True , ** _dataclass_opts )
920+ @dataclass (eq = True , slots = True )
953921class ExprTuple (Expr ):
954922 """Tuples like `(0, 1, 2)`."""
955923
@@ -974,8 +942,7 @@ def modernize(self) -> ExprTuple:
974942 )
975943
976944
977- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
978- @dataclass (eq = True , ** _dataclass_opts )
945+ @dataclass (eq = True , slots = True )
979946class ExprUnaryOp (Expr ):
980947 """Unary operations like `-1`."""
981948
@@ -991,8 +958,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
991958 yield from _yield (self .value , flat = flat , outer_precedence = _get_precedence (self ))
992959
993960
994- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
995- @dataclass (eq = True , ** _dataclass_opts )
961+ @dataclass (eq = True , slots = True )
996962class ExprYield (Expr ):
997963 """Yield statements like `yield a`."""
998964
@@ -1006,8 +972,7 @@ def iterate(self, *, flat: bool = True) -> Iterator[str | Expr]:
1006972 yield from _yield (self .value , flat = flat )
1007973
1008974
1009- # YORE: EOL 3.9: Replace `**_dataclass_opts` with `slots=True` within line.
1010- @dataclass (eq = True , ** _dataclass_opts )
975+ @dataclass (eq = True , slots = True )
1011976class ExprYieldFrom (Expr ):
1012977 """Yield statements like `yield from a`."""
1013978
0 commit comments