module documentation
(source)

Undocumented

Class ​Default​Plugin Type checker plugin that is enabled by default.
Function contextmanager​_callback Infer a better return type for 'contextlib.contextmanager'.
Function int​_neg​_callback Infer a more precise return type for int.__neg__.
Function int​_pow​_callback Infer a more precise return type for int.__pow__.
Function open​_callback Infer a better return type for 'open'.
Function path​_open​_callback Infer a better return type for 'pathlib.Path.open'.
Function tuple​_mul​_callback Infer a more precise return type for tuple.__mul__ and tuple.__rmul__.
Function typed​_dict​_delitem​_callback Type check TypedDict.__delitem__.
Function typed​_dict​_get​_callback Infer a precise return type for TypedDict.get with literal first argument.
Function typed​_dict​_get​_signature​_callback Try to infer a better signature type for TypedDict.get.
Function typed​_dict​_pop​_callback Type check and infer a precise return type for TypedDict.pop.
Function typed​_dict​_pop​_signature​_callback Try to infer a better signature type for TypedDict.pop.
Function typed​_dict​_setdefault​_callback Type check TypedDict.setdefault and infer a precise return type.
Function typed​_dict​_setdefault​_signature​_callback Try to infer a better signature type for TypedDict.setdefault.
Function typed​_dict​_update​_signature​_callback Try to infer a better signature type for TypedDict.update.
Function _analyze​_open​_signature A helper for analyzing any function that has approximately the same signature as the builtin 'open(...)' function.
def contextmanager_callback(ctx): (source)
Infer a better return type for 'contextlib.contextmanager'.
Parameters
ctx:FunctionContextUndocumented
Returns
TypeUndocumented
def int_neg_callback(ctx): (source)

Infer a more precise return type for int.__neg__.

This is mainly used to infer the return type as LiteralType if the original underlying object is a LiteralType object

Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def int_pow_callback(ctx): (source)
Infer a more precise return type for int.__pow__.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def open_callback(ctx): (source)
Infer a better return type for 'open'.
Parameters
ctx:FunctionContextUndocumented
Returns
TypeUndocumented
def path_open_callback(ctx): (source)
Infer a better return type for 'pathlib.Path.open'.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def tuple_mul_callback(ctx): (source)

Infer a more precise return type for tuple.__mul__ and tuple.__rmul__.

This is used to return a specific sized tuple if multiplied by Literal int

Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def typed_dict_delitem_callback(ctx): (source)
Type check TypedDict.__delitem__.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def typed_dict_get_callback(ctx): (source)
Infer a precise return type for TypedDict.get with literal first argument.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def typed_dict_get_signature_callback(ctx): (source)

Try to infer a better signature type for TypedDict.get.

This is used to get better type context for the second argument that depends on a TypedDict value type.

Parameters
ctx:MethodSigContextUndocumented
Returns
CallableTypeUndocumented
def typed_dict_pop_callback(ctx): (source)
Type check and infer a precise return type for TypedDict.pop.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def typed_dict_pop_signature_callback(ctx): (source)

Try to infer a better signature type for TypedDict.pop.

This is used to get better type context for the second argument that depends on a TypedDict value type.

Parameters
ctx:MethodSigContextUndocumented
Returns
CallableTypeUndocumented
def typed_dict_setdefault_callback(ctx): (source)
Type check TypedDict.setdefault and infer a precise return type.
Parameters
ctx:MethodContextUndocumented
Returns
TypeUndocumented
def typed_dict_setdefault_signature_callback(ctx): (source)

Try to infer a better signature type for TypedDict.setdefault.

This is used to get better type context for the second argument that depends on a TypedDict value type.

Parameters
ctx:MethodSigContextUndocumented
Returns
CallableTypeUndocumented
def typed_dict_update_signature_callback(ctx): (source)
Try to infer a better signature type for TypedDict.update.
Parameters
ctx:MethodSigContextUndocumented
Returns
CallableTypeUndocumented
def _analyze_open_signature(arg_types, args, mode_arg_index, default_return_type, api): (source)

A helper for analyzing any function that has approximately the same signature as the builtin 'open(...)' function.

Currently, the only thing the caller can customize is the index of the 'mode' argument. If the mode argument is omitted or is a string literal, we refine the return type to either 'TextIO' or 'BinaryIO' as appropriate.

Parameters
arg​_types:List[List[Type]]Undocumented
args:List[List[Expression]]Undocumented
mode​_arg​_index:intUndocumented
default​_return​_type:TypeUndocumented
api:CheckerPluginInterfaceUndocumented
Returns
TypeUndocumented