@@ -27,6 +27,7 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution):
27
27
def __new__ (cls , original_value ): ...
28
28
def encode (self , encoding : str ) -> str : ... # type: ignore[override] # incompatible with str
29
29
30
+ _T = TypeVar ("_T" )
30
31
_PageElementT = TypeVar ("_PageElementT" , bound = PageElement )
31
32
_SimpleStrainable : TypeAlias = str | bool | None | bytes | Pattern [str ] | Callable [[str ], bool ] | Callable [[Tag ], bool ]
32
33
_Strainable : TypeAlias = _SimpleStrainable | Iterable [_SimpleStrainable ]
@@ -276,8 +277,16 @@ class Tag(PageElement):
276
277
def clear (self , decompose : bool = False ) -> None : ...
277
278
def smooth (self ) -> None : ...
278
279
def index (self , element : PageElement ) -> int : ...
279
- def get (self , key : str , default : str | list [str ] | None = None ) -> str | list [str ] | None : ...
280
- def get_attribute_list (self , key : str , default : str | list [str ] | None = None ) -> list [str ]: ...
280
+ @overload
281
+ def get (self , key : str , default : None = None ) -> str | list [str ] | None : ...
282
+ @overload
283
+ def get (self , key : str , default : _T ) -> str | list [str ] | _T : ...
284
+ @overload
285
+ def get_attribute_list (self , key : str , default : None = None ) -> list [str | None ]: ...
286
+ @overload
287
+ def get_attribute_list (self , key : str , default : list [_T ]) -> list [str | _T ]: ...
288
+ @overload
289
+ def get_attribute_list (self , key : str , default : _T ) -> list [str | _T ]: ...
281
290
def has_attr (self , key : str ) -> bool : ...
282
291
def __hash__ (self ) -> int : ...
283
292
def __getitem__ (self , key : str ) -> str | list [str ]: ...
0 commit comments