module documentation
(source)

Plugin to provide accurate types for some parts of the ctypes module.
Function array​_constructor​_callback Callback to provide an accurate signature for the ctypes.Array constructor.
Function array​_getitem​_callback Callback to provide an accurate return type for ctypes.Array.__getitem__.
Function array​_iter​_callback Callback to provide an accurate return type for ctypes.Array.__iter__.
Function array​_raw​_callback Callback to provide an accurate type for ctypes.Array.raw.
Function array​_setitem​_callback Callback to provide an accurate signature for ctypes.Array.__setitem__.
Function array​_value​_callback Callback to provide an accurate type for ctypes.Array.value.
Function _autoconvertible​_to​_cdata Get a type that is compatible with all types that can be implicitly converted to the given CData type.
Function _autounboxed​_cdata Get the auto-unboxed version of a CData type, if applicable.
Function _find​_simplecdata​_base​_arg Try to find a parametrized _SimpleCData in tp's bases and return its single type argument.
Function _get​_array​_element​_type Get the element type of the Array type tp, or None if not specified.
Function _get​_bytes​_type Return the type corresponding to bytes on the current Python version.
Function _get​_text​_type Return the type corresponding to Text on the current Python version.
def array_constructor_callback(ctx): (source)
Callback to provide an accurate signature for the ctypes.Array constructor.
Parameters
ctx:mypy.plugin.FunctionContextUndocumented
Returns
TypeUndocumented
def array_getitem_callback(ctx): (source)
Callback to provide an accurate return type for ctypes.Array.__getitem__.
Parameters
ctx:mypy.plugin.MethodContextUndocumented
Returns
TypeUndocumented
def array_iter_callback(ctx): (source)
Callback to provide an accurate return type for ctypes.Array.__iter__.
Parameters
ctx:mypy.plugin.MethodContextUndocumented
Returns
TypeUndocumented
def array_raw_callback(ctx): (source)
Callback to provide an accurate type for ctypes.Array.raw.
Parameters
ctx:mypy.plugin.AttributeContextUndocumented
Returns
TypeUndocumented
def array_setitem_callback(ctx): (source)
Callback to provide an accurate signature for ctypes.Array.__setitem__.
Parameters
ctx:mypy.plugin.MethodSigContextUndocumented
Returns
CallableTypeUndocumented
def array_value_callback(ctx): (source)
Callback to provide an accurate type for ctypes.Array.value.
Parameters
ctx:mypy.plugin.AttributeContextUndocumented
Returns
TypeUndocumented
def _autoconvertible_to_cdata(tp, api): (source)

Get a type that is compatible with all types that can be implicitly converted to the given CData type.

Examples: * c_int -> Union[c_int, int] * c_char_p -> Union[c_char_p, bytes, int, NoneType] * MyStructure -> MyStructure

Parameters
tp:TypeUndocumented
api:mypy.plugin.CheckerPluginInterfaceUndocumented
Returns
TypeUndocumented
def _autounboxed_cdata(tp): (source)

Get the auto-unboxed version of a CData type, if applicable.

For direct _SimpleCData subclasses, the only type argument of _SimpleCData in the bases list is returned. For all other CData types, including indirect _SimpleCData subclasses, tp is returned as-is.

Parameters
tp:TypeUndocumented
Returns
ProperTypeUndocumented
def _find_simplecdata_base_arg(tp, api): (source)

Try to find a parametrized _SimpleCData in tp's bases and return its single type argument.

None is returned if _SimpleCData appears nowhere in tp's (direct or indirect) bases.

Parameters
tp:InstanceUndocumented
api:mypy.plugin.CheckerPluginInterfaceUndocumented
Returns
Optional[ProperType]Undocumented
def _get_array_element_type(tp): (source)
Get the element type of the Array type tp, or None if not specified.
Parameters
tp:TypeUndocumented
Returns
Optional[ProperType]Undocumented
def _get_bytes_type(api): (source)

Return the type corresponding to bytes on the current Python version.

This is bytes in Python 3, and str in Python 2.

Parameters
api:mypy.plugin.CheckerPluginInterfaceUndocumented
Returns
InstanceUndocumented
def _get_text_type(api): (source)

Return the type corresponding to Text on the current Python version.

This is str in Python 3, and unicode in Python 2.

Parameters
api:mypy.plugin.CheckerPluginInterfaceUndocumented
Returns
InstanceUndocumented