class documentation

class PartialType(ProperType): (source)

View In Hierarchy

Type such as List[?] where type arguments are unknown, or partial None type.

These are used for inferring types in multiphase initialization such as this:

x = [] # x gets a partial type List[?], as item type is unknown x.append(1) # partial type gets replaced with normal type List[int]

Or with None:

x = None # x gets a partial type None if c:

x = 1 # Infer actual type int for x
Method __init__ Undocumented
Method accept Undocumented
Class Variable __slots__ Undocumented
Instance Variable type Undocumented
Instance Variable value​_type Undocumented
Instance Variable var Undocumented

Inherited from Type (via ProperType):

Class Method deserialize Undocumented
Method __repr__ Undocumented
Method can​_be​_false​_default Undocumented
Method can​_be​_true​_default Undocumented
Method serialize Undocumented
Instance Variable can​_be​_false Undocumented
Instance Variable can​_be​_true Undocumented

Inherited from Context (via ProperType, Type):

Method get​_column Don't use. Use x.column.
Method get​_line Don't use. Use x.line.
Method set​_line If target is a node, pull line (and column) information into this node. If column is specified, this will override any column information coming from a node.
Instance Variable column Undocumented
Instance Variable end​_line Undocumented
Instance Variable line Undocumented
def __init__(self, type, var, value_type=None): (source)

Undocumented

Parameters
type:Optional[mypy.nodes.TypeInfo]Undocumented
var:mypy.nodes.VarUndocumented
value​_type:Optional[Instance]Undocumented
def accept(self, visitor): (source)

Undocumented

Parameters
visitor:TypeVisitor[T]Undocumented
Returns
TUndocumented
__slots__: tuple[str, ...] = (source)

Undocumented

type = (source)

Undocumented

value_type = (source)

Undocumented

Undocumented