Astroid hooks for typing.py support.
Function | infer_old_typed |
Undocumented |
Function | infer |
Infer call to tuple alias as new subscriptable class typing.Tuple. |
Function | infer_typed |
Replace TypedDict FunctionDef with ClassDef. |
Function | infer |
Infers the call to _alias function Insert ClassDef, with same name as aliased class, in mro to simulate _GenericAlias. |
Function | infer |
Infer a typing.X[...] subscript |
Function | infer |
Infer call to cast() returning same type as casted-from var |
Function | infer |
Infer a typing.TypeVar(...) or typing.NewType(...) call |
Function | looks |
Undocumented |
Constant | CLASS |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Function | _forbid |
Disable the access to __class_getitem__ method for the node in parameters |
Function | _looks |
Return True if call is for Tuple or Callable alias. |
Function | _looks_like_typed |
Check if node is TypedDict FunctionDef. |
Function | _looks |
Returns True if the node corresponds to a call to _alias function. For example : |
Function | _looks |
Undocumented |
Function | _looks |
Try to figure out if a Subscript node might be a typing-related subscript |
ClassDef
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ ClassDef]
:
(source)
¶
Undocumented
Call
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ ClassDef]
:
(source)
¶
Infer call to tuple alias as new subscriptable class typing.Tuple.
FunctionDef
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ ClassDef]
:
(source)
¶
Replace TypedDict FunctionDef with ClassDef.
Call
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ ClassDef]
:
(source)
¶
Infers the call to _alias function Insert ClassDef, with same name as aliased class, in mro to simulate _GenericAlias.
Parameters | |
node:Call | call node |
ctx:context.InferenceContext | None | Undocumented |
context | inference context |
Returns | |
typing.Iterator[ | Undocumented |
Subscript
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ ClassDef]
:
(source)
¶
Infer a typing.X[...] subscript
Call
, ctx: context.InferenceContext | None
= None) -> typing.Iterator[ NodeNG]
:
(source)
¶
Infer call to cast() returning same type as casted-from var
Undocumented
Value |
|
Undocumented
Value |
|
Return True if call is for Tuple or Callable alias.
In PY37 and PY38 the call is to '_VariadicGenericAlias' with 'tuple' as first argument. In PY39+ it is replaced by a call to '_TupleType'.
PY37: Tuple = _VariadicGenericAlias(tuple, (), inst=False, special=True) PY39: Tuple = _TupleType(tuple, -1, inst=False, name='Tuple')
PY37: Callable = _VariadicGenericAlias(collections.abc.Callable, (), special=True) PY39: Callable = _CallableType(collections.abc.Callable, 2)