Classes for representing mypy types.
Class |
|
The type 'Any'. |
Class |
|
Represents a Arg(type, 'name') inside a Callable's type list. |
Class |
|
Type of a non-overloaded callable object (such as function). |
Class |
|
Type of deleted variables. |
Class |
|
The type ... (ellipsis). |
Class |
|
Placeholder for an erased type. |
Class |
|
Summary of module attributes and types. |
Class |
|
Undocumented |
Class |
|
Abstract base class for function types. |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
An instance type of form C[T1, ..., Tn]. |
Class |
|
Undocumented |
Class |
|
The type of a Literal instance. Literal[Value] |
Class |
|
Undocumented |
Class |
|
The type of 'None'. |
Class |
|
Overloaded function type T1, ... Tn, where each Ti is CallableType. |
Class |
|
Type that represents the parameters to a function. |
Class |
|
Undocumented |
Class |
|
Type that refers to a ParamSpec. |
Class |
|
Type such as List[?] where type arguments are unknown, or partial None type. |
Class |
|
Temporary, yet-unknown type during semantic analysis. |
Class |
|
Not a type alias. |
Class |
|
A synthetic type representing some arbitrary expression that does not cleanly translate into a type. |
Class |
|
Required[T] or NotRequired[T]. Only usable at top-level of a TypedDict definition. |
Class |
|
A base class for type translators that need to be run during semantic analysis. |
Class |
|
The tuple type Tuple[T1, ..., Tn] (at least one type argument). |
Class |
|
Abstract base class for all types. |
Class |
|
A type alias to another type. |
Class |
|
Type of TypedDict object {'k1': v1, ..., 'kn': vn}. |
Class |
|
Only used by find_isinstance_check() etc. |
Class |
|
Information about argument types and names [...]. |
Class |
|
This class describes different types of Any. Each 'Any' can be of only one type at a time. |
Class |
|
Visitor for pretty-printing types into strings. |
Class |
|
For types like Type[User]. |
Class |
|
Undocumented |
Class |
|
Undocumented |
Class |
|
Type that refers to a TypeVarTuple. |
Class |
|
Type that refers to a type variable. |
Class |
|
Instance type that has not been bound during semantic analysis. |
Class |
|
This type has no members. |
Class |
|
The union type Union[T1, ..., Tn] (at least one type argument). |
Class |
|
Type operator Unpack from PEP646. Can be either with Unpack[] or unpacking * syntax. |
Class |
|
Undocumented |
Function | bad |
Prohibit types like Type[Type[...]]. |
Function | callable |
Construct type Callable[..., ret_type]. |
Function | deserialize |
Undocumented |
Function | expand |
This is shared part of the logic w.r.t. ParamSpec instantiation. |
Function | flatten |
Flatten nested unions in a type list. |
Function | get |
Get the expansion of a type alias type. |
Function | get |
Undocumented |
Function | has |
Check if a type contains any recursive aliases (recursively). |
Function | has |
Check if a type contains any type variables (recursively). |
Function | invalid |
Flag aliases like A = Union[int, A] (and similar mutual aliases). |
Function | is |
Undocumented |
Function | is |
Check if this type is a LiteralType with the given fallback type and value. |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Does this look like a self-type annotation? |
Function | is |
Is this a union with Any or a plain Any type? |
Function | remove |
Undocumented |
Function | remove |
Make trivial simplifications on a list of types without calling is_subtype(). |
Function | replace |
Replace type variables in a generic type alias tp with substitutions subs resetting context. Length of subs should be already checked. |
Function | store |
Undocumented |
Function | strip |
Make a copy of type without 'debugging info' (function name). |
Constant | ANNOTATED |
Undocumented |
Constant | ASSERT |
Undocumented |
Constant | DATACLASS |
Undocumented |
Constant | deserialize |
Undocumented |
Constant | ENUM |
Undocumented |
Constant | FINAL |
Undocumented |
Constant | FINAL |
Undocumented |
Constant | LITERAL |
Undocumented |
Constant | MYPYC |
Undocumented |
Constant | names |
Undocumented |
Constant | NEVER |
Undocumented |
Constant | NOT |
Undocumented |
Constant | OVERLOAD |
Undocumented |
Constant | PROTOCOL |
Undocumented |
Constant | REVEAL |
Undocumented |
Constant | TPDICT |
Undocumented |
Constant | TPDICT |
Undocumented |
Constant | TUPLE |
Undocumented |
Constant | TYPE |
Undocumented |
Constant | TYPED |
Undocumented |
Type Variable | CT |
Undocumented |
Type Variable | T |
Undocumented |
Type Alias |
|
Undocumented |
Type Alias |
|
Undocumented |
Variable |
|
Undocumented |
Function | _flattened |
Undocumented |
Constant | _dummy |
Undocumented |
Constant | _dummy |
Undocumented |
Constant | _has |
Undocumented |
Prohibit types like Type[Type[...]]. Such types are explicitly prohibited by PEP 484. Also they cause problems with recursive types like T = Type[T], because internal representation of TypeType item is normalized (i.e. always a proper type).
AnyType
, ret_type: Type
, fallback: Instance
) -> CallableType
:
(source)
¶
Construct type Callable[..., ret_type].
ParamSpecType
, repl: (ParamSpecType|Parameters)|CallableType
) -> ProperType
:
(source)
¶
This is shared part of the logic w.r.t. ParamSpec instantiation. It is shared between type aliases and proper types, that currently use somewhat different logic for instantiation.
Sequence[ Type]
, handle_type_alias_type: bool
= True) -> list[ Type]
:
(source)
¶
Flatten nested unions in a type list.
Get the expansion of a type alias type. If the type is already a proper type, this is a no-op. Use this function wherever a decision is made on a call like e.g. 'if isinstance(typ, UnionType): ...', because 'typ' in this case may be an alias to union. Note: if after making the decision on the isinstance() call you pass on the original type (and not one of its components) it is recommended to *always* pass on the unexpanded alias.
set[ mypy.nodes.TypeAlias]
, target: Type
) -> bool
:
(source)
¶
Flag aliases like A = Union[int, A] (and similar mutual aliases). Such aliases don't make much sense, and cause problems in later phases.
ProperType
, fallback_fullname: str
, value: LiteralValue
) -> bool
:
(source)
¶
Check if this type is a LiteralType with the given fallback type and value.
Make trivial simplifications on a list of types without calling is_subtype(). This makes following simplifications: * Remove bottom types (taking into account strict optional setting) * Remove everything else if there is an `object` * Remove strict duplicate types
Type
, vars: list[ TypeVarLikeType]
, subs: list[ Type]
, newline: int
, newcolumn: int
) -> Type
:
(source)
¶
Replace type variables in a generic type alias tp with substitutions subs resetting context. Length of subs should be already checked.
FuncItem
, i: int
, typ: CallableType
, named_type: Callable[ [ str, list[ Type]], Instance]
):
(source)
¶
Undocumented
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|