1919
2020
2121''' Standard classes and class factories. '''
22+ # TODO: Mitigate issue with decoration obscuring signature of '__new__'
23+ # to typecheckers:
24+ # https://github.com/microsoft/pyright/discussions/10537.
25+ # Get rid of '__init_subclass__' hack which only addresses problem
26+ # for subclasses but not base classes.
2227
2328
2429from . import __
2530from . import decorators as _decorators
31+ # from . import nomina as _nomina
2632
2733
2834_dynadoc_introspection_limit_ = (
2935 # Standard classes are immutable. Exclude from docstring updates.
3036 __ .dynadoc .IntrospectionLimit (
3137 targets_exclusions = __ .dynadoc .IntrospectionTargets .Class ) )
32- # TODO: Mix 'with_docstring' decorator into standard sequence.
38+
39+
40+ # class _CfcExtraArguments( __.typx.TypedDict, total = False ):
41+ #
42+ # class_mutables: _nomina.BehaviorExclusionVerifiersOmni
43+ # class_visibles: _nomina.BehaviorExclusionVerifiersOmni
44+ # decorators: _nomina.Decorators
45+ # dynadoc_configuration: _nomina.DynadocConfiguration
46+ # instances_mutables: _nomina.BehaviorExclusionVerifiersOmni
47+ # instances_visibles: _nomina.BehaviorExclusionVerifiersOmni
3348
3449
3550@_decorators .decoration_by ( * _decorators .class_factory_decorators )
3651class Class ( type ): pass
3752
53+ # def __new__(
54+ # clscls: type[ __.T ],
55+ # name: str,
56+ # bases: tuple[ type, ... ],
57+ # namespace: dict[ str, __.typx.Any ],
58+ # *,
59+ # instances_mutables: _nomina.BehaviorExclusionVerifiersOmni = ( ),
60+ # ) -> __.T:
61+ # return super( ).__new__( clscls, name, bases, namespace )
62+
3863
3964@_decorators .decoration_by ( * _decorators .class_factory_decorators )
4065@__ .typx .dataclass_transform ( frozen_default = True , kw_only_default = True )
@@ -60,36 +85,68 @@ class ProtocolDataclass( type( __.typx.Protocol ) ): pass
6085class ProtocolDataclassMutable ( type ( __ .typx .Protocol ) ): pass
6186
6287
63- class Object ( metaclass = Class ): pass
88+ class Object ( metaclass = Class ):
89+
90+ def __init_subclass__ ( # Typechecker appeasement.
91+ cls : type , / , ** arguments : __ .typx .Any
92+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
6493
6594
6695class ObjectMutable ( # pyright: ignore[reportGeneralTypeIssues]
6796 metaclass = Class ,
6897 instances_mutables = '*' , # pyright: ignore[reportCallIssue]
69- ): pass
98+ ):
99+
100+ def __init_subclass__ ( # Typechecker appeasement.
101+ cls : type , / , ** arguments : __ .typx .Any
102+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
103+
70104
105+ class DataclassObject ( metaclass = Dataclass ):
71106
72- class DataclassObject ( metaclass = Dataclass ): pass
107+ def __init_subclass__ ( # Typechecker appeasement.
108+ cls : type , / , ** arguments : __ .typx .Any
109+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
73110
74111
75- class DataclassObjectMutable ( metaclass = DataclassMutable ): pass
112+ class DataclassObjectMutable ( metaclass = DataclassMutable ):
76113
114+ def __init_subclass__ ( # Typechecker appeasement.
115+ cls : type , / , ** arguments : __ .typx .Any
116+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
77117
78- class Protocol ( __ .typx .Protocol , metaclass = ProtocolClass ): pass
118+
119+ class Protocol ( __ .typx .Protocol , metaclass = ProtocolClass ):
120+
121+ def __init_subclass__ ( # Typechecker appeasement.
122+ cls : type , / , ** arguments : __ .typx .Any
123+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
79124
80125
81126class ProtocolMutable ( # pyright: ignore[reportGeneralTypeIssues]
82127 __ .typx .Protocol ,
83128 metaclass = ProtocolClass ,
84129 instances_mutables = '*' , # pyright: ignore[reportCallIssue]
85- ): pass
130+ ):
131+
132+ def __init_subclass__ ( # Typechecker appeasement.
133+ cls : type , / , ** arguments : __ .typx .Any
134+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
86135
87136
88137class DataclassProtocol (
89138 __ .typx .Protocol , metaclass = ProtocolDataclass ,
90- ): pass
139+ ):
140+
141+ def __init_subclass__ ( # Typechecker appeasement.
142+ cls : type , / , ** arguments : __ .typx .Any
143+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
91144
92145
93146class DataclassProtocolMutable (
94147 __ .typx .Protocol , metaclass = ProtocolDataclassMutable ,
95- ): pass
148+ ):
149+
150+ def __init_subclass__ ( # Typechecker appeasement.
151+ cls : type , / , ** arguments : __ .typx .Any
152+ ) -> None : super ( ).__init_subclass__ ( ** arguments )
0 commit comments