2828 Attribute ,
2929 ClassProps ,
3030 Factory ,
31+ Hashability ,
32+ KeywordOnly ,
3133 _AndValidator ,
3234 _Attributes ,
3335 _ClassBuilder ,
3436 _CountingAttr ,
3537 _determine_attrib_eq_order ,
3638 _determine_attrs_eq_order ,
3739 _determine_whether_to_implement ,
38- _Hashability ,
3940 _transform_attrs ,
4041 and_ ,
4142 fields ,
@@ -183,7 +184,7 @@ def test_no_modifications(self):
183184 Does not attach __attrs_attrs__ to the class.
184185 """
185186 C = make_tc ()
186- _transform_attrs (C , None , False , False , False , True , None )
187+ _transform_attrs (C , None , False , KeywordOnly . NO , True , None )
187188
188189 assert None is getattr (C , "__attrs_attrs__" , None )
189190
@@ -193,7 +194,7 @@ def test_normal(self):
193194 """
194195 C = make_tc ()
195196 attrs , _ , _ = _transform_attrs (
196- C , None , False , False , False , True , None
197+ C , None , False , KeywordOnly . NO , True , None
197198 )
198199
199200 assert ["z" , "y" , "x" ] == [a .name for a in attrs ]
@@ -208,7 +209,7 @@ class C:
208209 pass
209210
210211 assert _Attributes ((), [], {}) == _transform_attrs (
211- C , None , False , False , False , True , None
212+ C , None , False , KeywordOnly . NO , True , None
212213 )
213214
214215 def test_transforms_to_attribute (self ):
@@ -217,7 +218,7 @@ def test_transforms_to_attribute(self):
217218 """
218219 C = make_tc ()
219220 attrs , base_attrs , _ = _transform_attrs (
220- C , None , False , False , False , True , None
221+ C , None , False , KeywordOnly . NO , True , None
221222 )
222223
223224 assert [] == base_attrs
@@ -235,7 +236,7 @@ class C:
235236 y = attr .ib ()
236237
237238 with pytest .raises (ValueError ) as e :
238- _transform_attrs (C , None , False , False , False , True , None )
239+ _transform_attrs (C , None , False , KeywordOnly . NO , True , None )
239240 assert (
240241 "No mandatory attributes allowed after an attribute with a "
241242 "default value or factory. Attribute in question: Attribute"
@@ -264,7 +265,7 @@ class C(B):
264265 y = attr .ib ()
265266
266267 attrs , base_attrs , _ = _transform_attrs (
267- C , None , False , True , False , True , None
268+ C , None , False , KeywordOnly . YES , True , None
268269 )
269270
270271 assert len (attrs ) == 3
@@ -280,8 +281,7 @@ class C(B):
280281 C ,
281282 None ,
282283 False ,
283- True ,
284- True , # force kw-only
284+ KeywordOnly .FORCE ,
285285 True ,
286286 None ,
287287 )
@@ -307,7 +307,7 @@ class C(Base):
307307 y = attr .ib ()
308308
309309 attrs , base_attrs , _ = _transform_attrs (
310- C , {"x" : attr .ib ()}, False , False , False , True , None
310+ C , {"x" : attr .ib ()}, False , KeywordOnly . NO , True , None
311311 )
312312
313313 assert [] == base_attrs
@@ -540,10 +540,9 @@ class C:
540540 repr = True ,
541541 eq = True ,
542542 order = True ,
543- hash = _Hashability .HASHABLE ,
543+ hash = Hashability .HASHABLE ,
544544 match_args = False ,
545- is_kw_only = True ,
546- force_kw_only = True ,
545+ kw_only = KeywordOnly .FORCE ,
547546 has_weakref_slot = True ,
548547 collect_by_mro = False ,
549548 cache_hash = True ,
@@ -574,10 +573,9 @@ class CDef:
574573 repr = True ,
575574 eq = True ,
576575 order = True ,
577- hash = _Hashability .UNHASHABLE ,
576+ hash = Hashability .UNHASHABLE ,
578577 match_args = True ,
579- is_kw_only = False ,
580- force_kw_only = True ,
578+ kw_only = KeywordOnly .NO ,
581579 has_weakref_slot = True ,
582580 collect_by_mro = False ,
583581 cache_hash = False ,
@@ -2022,8 +2020,7 @@ class C:
20222020 order = False ,
20232021 hash = False ,
20242022 match_args = True ,
2025- is_kw_only = False ,
2026- force_kw_only = False ,
2023+ kw_only = KeywordOnly .NO ,
20272024 has_weakref_slot = False ,
20282025 collect_by_mro = True ,
20292026 cache_hash = False ,
@@ -2059,8 +2056,7 @@ class C:
20592056 order = False ,
20602057 hash = False ,
20612058 match_args = True ,
2062- is_kw_only = False ,
2063- force_kw_only = False ,
2059+ kw_only = KeywordOnly .NO ,
20642060 has_weakref_slot = False ,
20652061 collect_by_mro = True ,
20662062 cache_hash = False ,
@@ -2162,8 +2158,7 @@ def our_hasattr(obj, name, /) -> bool:
21622158 order = False ,
21632159 hash = False ,
21642160 match_args = True ,
2165- is_kw_only = False ,
2166- force_kw_only = False ,
2161+ kw_only = KeywordOnly .NO ,
21672162 has_weakref_slot = True ,
21682163 collect_by_mro = True ,
21692164 cache_hash = False ,
0 commit comments