@@ -121,41 +121,41 @@ class AdvancedProperty(property, typing.Generic[_OwnerClassT, _ReturnT, _ClassRe
121
121
122
122
def __init__ (
123
123
self ,
124
- fget : typing .Optional [ typing . Callable [[_OwnerClassT ], _ReturnT ]] = None ,
125
- fset : typing .Optional [ typing . Callable [[_OwnerClassT , _ReturnT ], None ]] = None ,
126
- fdel : typing .Optional [ typing . Callable [[_OwnerClassT ], None ]] = None ,
127
- fcget : typing .Optional [ typing . Callable [[typing . Type [_OwnerClassT ]], _ClassReturnT ]] = None ,
124
+ fget : typing .Callable [[_OwnerClassT ], _ReturnT ] | None = None ,
125
+ fset : typing .Callable [[_OwnerClassT , _ReturnT ], None ] | None = None ,
126
+ fdel : typing .Callable [[_OwnerClassT ], None ] | None = None ,
127
+ fcget : typing .Callable [[type [_OwnerClassT ]], _ClassReturnT ] | None = None ,
128
128
) -> None :
129
129
"""Advanced property main entry point.
130
130
131
131
:param fget: normal getter.
132
- :type fget: typing.Optional[typing. Callable[[typing.Any, ], typing.Any]]
132
+ :type fget: typing.Callable[[typing.Any, ], typing.Any] | None
133
133
:param fset: normal setter.
134
- :type fset: typing.Optional[typing. Callable[[typing.Any, typing.Any], None]]
134
+ :type fset: typing.Callable[[typing.Any, typing.Any], None] | None
135
135
:param fdel: normal deleter.
136
- :type fdel: typing.Optional[typing. Callable[[typing.Any, ], None]]
136
+ :type fdel: typing.Callable[[typing.Any, ], None] | None
137
137
:param fcget: class getter. Used as normal, if normal is None.
138
- :type fcget: typing.Optional[typing. Callable[[typing.Any, ], typing.Any]]
138
+ :type fcget: typing.Callable[[typing.Any, ], typing.Any] | None
139
139
140
140
.. note:: doc argument is not supported due to class wide getter usage.
141
141
"""
142
142
super ().__init__ (fget = fget , fset = fset , fdel = fdel )
143
143
144
- self .__fcget : typing .Optional [ typing . Callable [[typing . Type [_OwnerClassT ]], _ClassReturnT ]] = fcget
144
+ self .__fcget : typing .Callable [[type [_OwnerClassT ]], _ClassReturnT ] | None = fcget
145
145
146
146
@typing .overload
147
- def __get__ (self , instance : None , owner : typing . Type [_OwnerClassT ]) -> _ClassReturnT :
147
+ def __get__ (self , instance : None , owner : type [_OwnerClassT ]) -> _ClassReturnT :
148
148
"""Class method."""
149
149
150
150
@typing .overload
151
- def __get__ (self , instance : _OwnerClassT , owner : typing . Optional [ typing . Type [ _OwnerClassT ]] = None ) -> _ReturnT :
151
+ def __get__ (self , instance : _OwnerClassT , owner : type [ _OwnerClassT ] | None = None ) -> _ReturnT :
152
152
"""Normal method."""
153
153
154
154
def __get__ (
155
155
self ,
156
- instance : typing . Optional [ _OwnerClassT ] ,
157
- owner : typing . Optional [ typing . Type [ _OwnerClassT ]] = None ,
158
- ) -> typing . Union [ _ClassReturnT , _ReturnT ] :
156
+ instance : _OwnerClassT | None ,
157
+ owner : type [ _OwnerClassT ] | None = None ,
158
+ ) -> _ClassReturnT | _ReturnT :
159
159
"""Get descriptor.
160
160
161
161
:param instance: Owner class instance. Filled only if instance created, else None.
@@ -169,25 +169,25 @@ def __get__(
169
169
if self .__fcget is None :
170
170
raise AttributeError ()
171
171
return self .__fcget (owner )
172
- return super ().__get__ (instance , owner ) # type: ignore
172
+ return super ().__get__ (instance , owner ) # type: ignore[no-any-return]
173
173
174
174
@property
175
- def fcget (self ) -> typing .Optional [ typing . Callable [[typing . Type [_OwnerClassT ]], _ClassReturnT ]] :
175
+ def fcget (self ) -> typing .Callable [[type [_OwnerClassT ]], _ClassReturnT ] | None :
176
176
"""Class wide getter instance.
177
177
178
178
:return: Class wide getter instance
179
- :rtype: typing.Optional[typing. Callable[[typing.Any, ], typing.Any]]
179
+ :rtype: typing.Callable[[typing.Any, ], typing.Any] | None
180
180
"""
181
181
return self .__fcget
182
182
183
183
def cgetter (
184
184
self ,
185
- fcget : typing .Optional [ typing . Callable [[typing . Type [_OwnerClassT ]], _ClassReturnT ]] ,
185
+ fcget : typing .Callable [[type [_OwnerClassT ]], _ClassReturnT ] | None ,
186
186
) -> AdvancedProperty [_OwnerClassT , _ReturnT , _ClassReturnT ]:
187
187
"""Descriptor to change the class wide getter on a property.
188
188
189
189
:param fcget: new class-wide getter.
190
- :type fcget: typing.Optional[typing. Callable[[typing.Any, ], typing.Any]]
190
+ :type fcget: typing.Callable[[typing.Any, ], typing.Any] | None
191
191
:return: AdvancedProperty
192
192
:rtype: AdvancedProperty
193
193
"""
0 commit comments