class documentation

class CallableType(FunctionLike): (source)

View In Hierarchy

Type of a non-overloaded callable object (such as function).
Class Method deserialize Undocumented
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method accept Undocumented
Method argument​_by​_name Undocumented
Method argument​_by​_position Undocumented
Method copy​_modified Undocumented
Method expand​_param​_spec Undocumented
Method formal​_arguments Yields the formal arguments corresponding to this callable, ignoring *arg and **kwargs.
Method get​_name Undocumented
Method is​_generic Undocumented
Method is​_type​_obj Undocumented
Method kw​_arg The formal argument for **kwargs.
Method max​_possible​_positional​_args Returns maximum number of positional arguments this method could possibly accept.
Method param​_spec Return ParamSpec if callable can be called with one.
Method serialize Undocumented
Method try​_synthesizing​_arg​_from​_kwarg Undocumented
Method try​_synthesizing​_arg​_from​_vararg Undocumented
Method type​_object Undocumented
Method type​_var​_ids Undocumented
Method var​_arg The formal argument for *args.
Method with​_name Return a copy of this type with the specified name.
Class Variable __slots__ Undocumented
Instance Variable arg​_kinds Undocumented
Instance Variable arg​_names Undocumented
Instance Variable arg​_types Undocumented
Instance Variable bound​_args Undocumented
Instance Variable def​_extras Undocumented
Instance Variable definition Undocumented
Instance Variable fallback Undocumented
Instance Variable from​_type​_type Undocumented
Instance Variable implicit Undocumented
Instance Variable is​_ellipsis​_args Undocumented
Instance Variable min​_args Undocumented
Instance Variable name Undocumented
Instance Variable ret​_type Undocumented
Instance Variable special​_sig Undocumented
Instance Variable type​_guard Undocumented
Instance Variable variables Undocumented
Property is​_kw​_arg Does this callable have a **kwargs argument?
Property is​_var​_arg Does this callable have a *args argument?
Property items Undocumented

Inherited from FunctionLike:

Instance Variable can​_be​_false Undocumented

Inherited from Type (via FunctionLike, ProperType):

Method __repr__ Undocumented
Method can​_be​_false​_default Undocumented
Method can​_be​_true​_default Undocumented
Instance Variable can​_be​_true Undocumented

Inherited from Context (via FunctionLike, 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
@classmethod
def deserialize(cls, data): (source)

Undocumented

Parameters
data:JsonDictUndocumented
Returns
CallableTypeUndocumented
def __eq__(self, other): (source)

Undocumented

Parameters
other:objectUndocumented
Returns
boolUndocumented
def __hash__(self): (source)

Undocumented

Returns
intUndocumented
def __init__(self, arg_types, arg_kinds, arg_names, ret_type, fallback, name=None, definition=None, variables=None, line=-1, column=-1, is_ellipsis_args=False, implicit=False, special_sig=None, from_type_type=False, bound_args=(), def_extras=None, type_guard=None): (source)

Undocumented

Parameters
arg​_types:Sequence[Type]Undocumented
arg​_kinds:List[ArgKind]Undocumented
arg​_names:Sequence[Optional[str]]Undocumented
ret​_type:TypeUndocumented
fallback:InstanceUndocumented
name:Optional[str]Undocumented
definition:Optional[SymbolNode]Undocumented
variables:Optional[Sequence[TypeVarLikeType]]Undocumented
line:intUndocumented
column:intUndocumented
is​_ellipsis​_args:boolUndocumented
implicit:boolUndocumented
special​_sig:Optional[str]Undocumented
from​_type​_type:boolUndocumented
bound​_args:Sequence[Optional[Type]]Undocumented
def​_extras:Optional[Dict[str, Any]]Undocumented
type​_guard:Optional[Type]Undocumented
def accept(self, visitor): (source)

Undocumented

Parameters
visitor:TypeVisitor[T]Undocumented
Returns
TUndocumented
def argument_by_name(self, name): (source)

Undocumented

Parameters
name:Optional[str]Undocumented
Returns
Optional[FormalArgument]Undocumented
def argument_by_position(self, position): (source)

Undocumented

Parameters
position:Optional[int]Undocumented
Returns
Optional[FormalArgument]Undocumented
def copy_modified(self, arg_types=_dummy, arg_kinds=_dummy, arg_names=_dummy, ret_type=_dummy, fallback=_dummy, name=_dummy, definition=_dummy, variables=_dummy, line=_dummy, column=_dummy, is_ellipsis_args=_dummy, implicit=_dummy, special_sig=_dummy, from_type_type=_dummy, bound_args=_dummy, def_extras=_dummy, type_guard=_dummy): (source)

Undocumented

Parameters
arg​_types:Bogus[Sequence[Type]]Undocumented
arg​_kinds:Bogus[List[ArgKind]]Undocumented
arg​_names:Bogus[List[Optional[str]]]Undocumented
ret​_type:Bogus[Type]Undocumented
fallback:Bogus[Instance]Undocumented
name:Bogus[Optional[str]]Undocumented
definition:Bogus[SymbolNode]Undocumented
variables:Bogus[Sequence[TypeVarLikeType]]Undocumented
line:Bogus[int]Undocumented
column:Bogus[int]Undocumented
is​_ellipsis​_args:Bogus[bool]Undocumented
implicit:Bogus[bool]Undocumented
special​_sig:Bogus[Optional[str]]Undocumented
from​_type​_type:Bogus[bool]Undocumented
bound​_args:Bogus[List[Optional[Type]]]Undocumented
def​_extras:Bogus[Dict[str, Any]]Undocumented
type​_guard:Bogus[Optional[Type]]Undocumented
Returns
CallableTypeUndocumented
def expand_param_spec(self, c): (source)

Undocumented

Parameters
c:CallableTypeUndocumented
Returns
CallableTypeUndocumented
def formal_arguments(self, include_star_args=False): (source)

Yields the formal arguments corresponding to this callable, ignoring *arg and **kwargs.

To handle *args and **kwargs, use the 'callable.var_args' and 'callable.kw_args' fields, if they are not None.

If you really want to include star args in the yielded output, set the 'include_star_args' parameter to 'True'.

Parameters
include​_star​_args:boolUndocumented
Returns
List[FormalArgument]Undocumented
def get_name(self): (source)

Undocumented

Returns
Optional[str]Undocumented
def is_generic(self): (source)

Undocumented

Returns
boolUndocumented
def is_type_obj(self): (source)

Undocumented

Returns
boolUndocumented
def kw_arg(self): (source)
The formal argument for **kwargs.
Returns
Optional[FormalArgument]Undocumented
def max_possible_positional_args(self): (source)

Returns maximum number of positional arguments this method could possibly accept.

This takes into account *arg and **kwargs but excludes keyword-only args.

Returns
intUndocumented
def param_spec(self): (source)

Return ParamSpec if callable can be called with one.

A Callable accepting ParamSpec P args (*args, **kwargs) must have the two final parameters like this: *args: P.args, **kwargs: P.kwargs.

Returns
Optional[ParamSpecType]Undocumented
def serialize(self): (source)

Undocumented

Returns
JsonDictUndocumented
def try_synthesizing_arg_from_kwarg(self, name): (source)

Undocumented

Parameters
name:Optional[str]Undocumented
Returns
Optional[FormalArgument]Undocumented
def try_synthesizing_arg_from_vararg(self, position): (source)

Undocumented

Parameters
position:Optional[int]Undocumented
Returns
Optional[FormalArgument]Undocumented
def type_object(self): (source)

Undocumented

Returns
mypy.nodes.TypeInfoUndocumented
def type_var_ids(self): (source)

Undocumented

Returns
List[TypeVarId]Undocumented
def var_arg(self): (source)
The formal argument for *args.
Returns
Optional[FormalArgument]Undocumented
def with_name(self, name): (source)
Return a copy of this type with the specified name.
Parameters
name:strUndocumented
Returns
CallableTypeUndocumented
__slots__: tuple[str, ...] = (source)

Undocumented

arg_kinds = (source)

Undocumented

arg_names = (source)

Undocumented

arg_types = (source)

Undocumented

bound_args = (source)

Undocumented

def_extras = (source)

Undocumented

definition = (source)

Undocumented

fallback = (source)

Undocumented

from_type_type = (source)

Undocumented

implicit = (source)

Undocumented

is_ellipsis_args = (source)

Undocumented

min_args = (source)

Undocumented

name = (source)

Undocumented

ret_type = (source)

Undocumented

special_sig = (source)

Undocumented

type_guard = (source)

Undocumented

variables = (source)

Undocumented

@property
is_kw_arg: bool = (source)
Does this callable have a **kwargs argument?
@property
is_var_arg: bool = (source)
Does this callable have a *args argument?
@property
items: List[CallableType] = (source)

Undocumented