typing.ByteString

class typing.ByteString(Sequence[int]) A generic version of collections.abc.ByteString. This type represents the types bytes, bytearray, and memoryview. As a shorthand for this type, bytes can be used to annotate arguments of any of the types mentioned above.

typing.AnyStr

class typing.AnyStr AnyStr is a type variable defined as AnyStr = TypeVar('AnyStr', str, bytes). It is meant to be used for functions that may accept any kind of string without allowing different kinds of strings to mix. For example: def concat(a: AnyStr, b: AnyStr) -> AnyStr: return a + b concat(u"foo", u"bar") # Ok, output has type 'unicode' concat(b"foo", b"bar") # Ok, output has type 'bytes' concat(u"foo", b"bar") # Error, cannot mix unicode and bytes

typing.Any

class typing.Any Special type indicating an unconstrained type. Any object is an instance of Any. Any class is a subclass of Any. As a special case, Any and object are subclasses of each other.

typing.AbstractSet

class typing.AbstractSet(Sized, Iterable[T_co], Container[T_co]) A generic version of collections.abc.Set.

types.TracebackType

types.TracebackType The type of traceback objects such as found in sys.exc_info()[2].

types.SimpleNamespace

class types.SimpleNamespace A simple object subclass that provides attribute access to its namespace, as well as a meaningful repr. Unlike object, with SimpleNamespace you can add and remove attributes. If a SimpleNamespace object is initialized with keyword arguments, those are directly added to the underlying namespace. The type is roughly equivalent to the following code: class SimpleNamespace: def __init__(self, **kwargs): self.__dict__.update(kwargs) def __repr__(self):

types.prepare_class()

types.prepare_class(name, bases=(), kwds=None) Calculates the appropriate metaclass and creates the class namespace. The arguments are the components that make up a class definition header: the class name, the base classes (in order) and the keyword arguments (such as metaclass). The return value is a 3-tuple: metaclass, namespace, kwds metaclass is the appropriate metaclass, namespace is the prepared class namespace and kwds is an updated copy of the passed in kwds argument with any 'metacl

types.new_class()

types.new_class(name, bases=(), kwds=None, exec_body=None) Creates a class object dynamically using the appropriate metaclass. The first three arguments are the components that make up a class definition header: the class name, the base classes (in order), the keyword arguments (such as metaclass). The exec_body argument is a callback that is used to populate the freshly created class namespace. It should accept the class namespace as its sole argument and update the namespace directly with

types.ModuleType.__package__

__package__ Which package a module belongs to. If the module is top-level (i.e. not a part of any specific package) then the attribute should be set to '', else it should be set to the name of the package (which can be __name__ if the module is a package itself). Defaults to None. Changed in version 3.4: Defaults to None. Previously the attribute was optional.

types.ModuleType.__name__

__name__ The name of the module.