neulab/docprompting-conala huggingface dataset:
class types.ModuleType(name, doc=None)  
The type of modules. The constructor takes the name of the module to be created and optionally its docstring.  Note Use importlib.util.module_from_spec() to create a new module if you wish to set the various import-controlled attributes.   
__doc__  
The docstring of the module. Defaults to None. 
  
__loader__  
The loader which loaded the module. Defaults to None. This attribute is to match importlib.machinery.ModuleSpec.loader as stored in the attr:__spec__ object.  Note A future version of Python may stop setting this attribute by default. To guard against this potential change, preferrably read from the __spec__ attribute instead or use getattr(module, "__loader__", None) if you explicitly need to use this attribute.   Changed in version 3.4: Defaults to None. Previously the attribute was optional.  
  
__name__  
The name of the module. Expected to match importlib.machinery.ModuleSpec.name. 
  
__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. This attribute is to match importlib.machinery.ModuleSpec.parent as stored in the attr:__spec__ object.  Note A future version of Python may stop setting this attribute by default. To guard against this potential change, preferrably read from the __spec__ attribute instead or use getattr(module, "__package__", None) if you explicitly need to use this attribute.   Changed in version 3.4: Defaults to None. Previously the attribute was optional.  
  
__spec__  
A record of the the module’s import-system-related state. Expected to be an instance of importlib.machinery.ModuleSpec.  New in version 3.4.
__loader__  
The loader which loaded the module. Defaults to None. This attribute is to match importlib.machinery.ModuleSpec.loader as stored in the attr:__spec__ object.  Note A future version of Python may stop setting this attribute by default. To guard against this potential change, preferrably read from the __spec__ attribute instead or use getattr(module, "__loader__", None) if you explicitly need to use this attribute.   Changed in version 3.4: Defaults to None. Previously the attribute was optional.
__name__  
The name of the module. Expected to match importlib.machinery.ModuleSpec.name.
__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. This attribute is to match importlib.machinery.ModuleSpec.parent as stored in the attr:__spec__ object.  Note A future version of Python may stop setting this attribute by default. To guard against this potential change, preferrably read from the __spec__ attribute instead or use getattr(module, "__package__", None) if you explicitly need to use this attribute.   Changed in version 3.4: Defaults to None. Previously the attribute was optional.
__spec__  
A record of the the module’s import-system-related state. Expected to be an instance of importlib.machinery.ModuleSpec.  New in version 3.4.
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 the class contents. If no callback is provided, it has the same effect as passing in lambda ns: ns.  New in version 3.3.
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 'metaclass' entry removed. If no kwds argument is passed in, this will be an empty dict.  New in version 3.3.   Changed in version 3.6: The default value for the namespace element of the returned tuple has changed. Now an insertion-order-preserving mapping is used when the metaclass does not have a __prepare__ method.
types.resolve_bases(bases)  
Resolve MRO entries dynamically as specified by PEP 560. This function looks for items in bases that are not instances of type, and returns a tuple where each such object that has an __mro_entries__ method is replaced with an unpacked result of calling this method. If a bases item is an instance of type, or it doesn’t have an __mro_entries__ method, then it is included in the return tuple unchanged.  New in version 3.7.
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):
        items = (f"{k}={v!r}" for k, v in self.__dict__.items())
        return "{}({})".format(type(self).__name__, ", ".join(items))

    def __eq__(self, other):
        if isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace):
           return self.__dict__ == other.__dict__
        return NotImplemented
 SimpleNamespace may be useful as a replacement for class NS: pass. However, for a structured record type use namedtuple() instead.  New in version 3.3.   Changed in version 3.9: Attribute order in the repr changed from alphabetical to insertion (like dict).
class types.TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)  
The type of traceback objects such as found in sys.exc_info()[2]. See the language reference for details of the available attributes and operations, and guidance on creating tracebacks dynamically.
types.WrapperDescriptorType  
The type of methods of some built-in data types and base classes such as object.__init__() or object.__lt__().  New in version 3.7.
class typing.AbstractSet(Sized, Collection[T_co])  
A generic version of collections.abc.Set.  Deprecated since version 3.9: collections.abc.Set now supports []. See PEP 585 and Generic Alias Type.
typing.Annotated  
A type, introduced in PEP 593 (Flexible function and variable
annotations), to decorate existing types with context-specific metadata (possibly multiple pieces of it, as Annotated is variadic). Specifically, a type T can be annotated with metadata x via the typehint Annotated[T, x]. This metadata can be used for either static analysis or at runtime. If a library (or tool) encounters a typehint Annotated[T, x] and has no special logic for metadata x, it should ignore it and simply treat the type as T. Unlike the no_type_check functionality that currently exists in the typing module which completely disables typechecking annotations on a function or a class, the Annotated type allows for both static typechecking of T (e.g., via mypy or Pyre, which can safely ignore x) together with runtime access to x within a specific application. Ultimately, the responsibility of how to interpret the annotations (if at all) is the responsibility of the tool or library encountering the Annotated type. A tool or library encountering an Annotated type can scan through the annotations to determine if they are of interest (e.g., using isinstance()). When a tool or a library does not support annotations or encounters an unknown annotation it should just ignore it and treat annotated type as the underlying type. It’s up to the tool consuming the annotations to decide whether the client is allowed to have several annotations on one type and how to merge those annotations. Since the Annotated type allows you to put several annotations of the same (or different) type(s) on any node, the tools or libraries consuming those annotations are in charge of dealing with potential duplicates. For example, if you are doing value range analysis you might allow this: T1 = Annotated[int, ValueRange(-10, 5)]
T2 = Annotated[T1, ValueRange(-20, 3)]
 Passing include_extras=True to get_type_hints() lets one access the extra annotations at runtime. The details of the syntax:  The first argument to Annotated must be a valid type 
Multiple type annotations are supported (Annotated supports variadic arguments): Annotated[int, ValueRange(3, 10), ctype("char")]
  
Annotated must be called with at least two arguments ( Annotated[int] is not valid) 
The order of the annotations is preserved and matters for equality checks: Annotated[int, ValueRange(3, 10), ctype("char")] != Annotated[
    int, ctype("char"), ValueRange(3, 10)
]
  
Nested Annotated types are flattened, with metadata ordered starting with the innermost annotation: Annotated[Annotated[int, ValueRange(3, 10)], ctype("char")] == Annotated[
    int, ValueRange(3, 10), ctype("char")
]
  
Duplicated annotations are not removed: Annotated[int, ValueRange(3, 10)] != Annotated[
    int, ValueRange(3, 10), ValueRange(3, 10)
]
  
Annotated can be used with nested and generic aliases: T = TypeVar('T')
Vec = Annotated[list[tuple[T, T]], MaxLen(10)]
V = Vec[int]

V == Annotated[list[tuple[int, int]], MaxLen(10)]
    New in version 3.9.
typing.Any  
Special type indicating an unconstrained type.  Every type is compatible with Any. 
Any is compatible with every type.
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
class typing.AsyncContextManager(Generic[T_co])  
A generic version of contextlib.AbstractAsyncContextManager.  New in version 3.5.4.   New in version 3.6.2.   Deprecated since version 3.9: contextlib.AbstractAsyncContextManager now supports []. See PEP 585 and Generic Alias Type.
class typing.AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra])  
An async generator can be annotated by the generic type AsyncGenerator[YieldType, SendType]. For example: async def echo_round() -> AsyncGenerator[int, float]:
    sent = yield 0
    while sent >= 0.0:
        rounded = await round(sent)
        sent = yield rounded
 Unlike normal generators, async generators cannot return a value, so there is no ReturnType type parameter. As with Generator, the SendType behaves contravariantly. If your generator will only yield values, set the SendType to None: async def infinite_stream(start: int) -> AsyncGenerator[int, None]:
    while True:
        yield start
        start = await increment(start)
 Alternatively, annotate your generator as having a return type of either AsyncIterable[YieldType] or AsyncIterator[YieldType]: async def infinite_stream(start: int) -> AsyncIterator[int]:
    while True:
        yield start
        start = await increment(start)
  New in version 3.6.1.   Deprecated since version 3.9: collections.abc.AsyncGenerator now supports []. See PEP 585 and Generic Alias Type.
class typing.AsyncIterable(Generic[T_co])  
A generic version of collections.abc.AsyncIterable.  New in version 3.5.2.   Deprecated since version 3.9: collections.abc.AsyncIterable now supports []. See PEP 585 and Generic Alias Type.
class typing.AsyncIterator(AsyncIterable[T_co])  
A generic version of collections.abc.AsyncIterator.  New in version 3.5.2.   Deprecated since version 3.9: collections.abc.AsyncIterator now supports []. See PEP 585 and Generic Alias Type.
class typing.Awaitable(Generic[T_co])  
A generic version of collections.abc.Awaitable.  New in version 3.5.2.   Deprecated since version 3.9: collections.abc.Awaitable now supports []. See PEP 585 and Generic Alias Type.
class typing.IO  
class typing.TextIO  
class typing.BinaryIO  
Generic type IO[AnyStr] and its subclasses TextIO(IO[str]) and BinaryIO(IO[bytes]) represent the types of I/O streams such as returned by open(). These types are also in the typing.io namespace.
class typing.ByteString(Sequence[int])  
A generic version of collections.abc.ByteString. This type represents the types bytes, bytearray, and memoryview of byte sequences. As a shorthand for this type, bytes can be used to annotate arguments of any of the types mentioned above.  Deprecated since version 3.9: collections.abc.ByteString now supports []. See PEP 585 and Generic Alias Type.
typing.Callable  
Callable type; Callable[[int], str] is a function of (int) -> str. The subscription syntax must always be used with exactly two values: the argument list and the return type. The argument list must be a list of types or an ellipsis; the return type must be a single type. There is no syntax to indicate optional or keyword arguments; such function types are rarely used as callback types. Callable[..., ReturnType] (literal ellipsis) can be used to type hint a callable taking any number of arguments and returning ReturnType. A plain Callable is equivalent to Callable[..., Any], and in turn to collections.abc.Callable.  Deprecated since version 3.9: collections.abc.Callable now supports []. See PEP 585 and Generic Alias Type.
typing.cast(typ, val)  
Cast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don’t check anything (we want this to be as fast as possible).
class typing.ChainMap(collections.ChainMap, MutableMapping[KT, VT])  
A generic version of collections.ChainMap.  New in version 3.5.4.   New in version 3.6.1.   Deprecated since version 3.9: collections.ChainMap now supports []. See PEP 585 and Generic Alias Type.
typing.ClassVar  
Special type construct to mark class variables. As introduced in PEP 526, a variable annotation wrapped in ClassVar indicates that a given attribute is intended to be used as a class variable and should not be set on instances of that class. Usage: class Starship:
    stats: ClassVar[dict[str, int]] = {} # class variable
    damage: int = 10                     # instance variable
 ClassVar accepts only types and cannot be further subscribed. ClassVar is not a class itself, and should not be used with isinstance() or issubclass(). ClassVar does not change Python runtime behavior, but it can be used by third-party type checkers. For example, a type checker might flag the following code as an error: enterprise_d = Starship(3000)
enterprise_d.stats = {} # Error, setting class variable on instance
Starship.stats = {}     # This is OK
  New in version 3.5.3.
class typing.Collection(Sized, Iterable[T_co], Container[T_co])  
A generic version of collections.abc.Collection  New in version 3.6.0.   Deprecated since version 3.9: collections.abc.Collection now supports []. See PEP 585 and Generic Alias Type.
class typing.Container(Generic[T_co])  
A generic version of collections.abc.Container.  Deprecated since version 3.9: collections.abc.Container now supports []. See PEP 585 and Generic Alias Type.
class typing.ContextManager(Generic[T_co])  
A generic version of contextlib.AbstractContextManager.  New in version 3.5.4.   New in version 3.6.0.   Deprecated since version 3.9: contextlib.AbstractContextManager now supports []. See PEP 585 and Generic Alias Type.
class typing.Coroutine(Awaitable[V_co], Generic[T_co, T_contra, V_co])  
A generic version of collections.abc.Coroutine. The variance and order of type variables correspond to those of Generator, for example: from collections.abc import Coroutine
c = None # type: Coroutine[list[str], str, int]
...
x = c.send('hi') # type: list[str]
async def bar() -> None:
    x = await c # type: int
  New in version 3.5.3.   Deprecated since version 3.9: collections.abc.Coroutine now supports []. See PEP 585 and Generic Alias Type.
class typing.Counter(collections.Counter, Dict[T, int])  
A generic version of collections.Counter.  New in version 3.5.4.   New in version 3.6.1.   Deprecated since version 3.9: collections.Counter now supports []. See PEP 585 and Generic Alias Type.
class typing.DefaultDict(collections.defaultdict, MutableMapping[KT, VT])  
A generic version of collections.defaultdict.  New in version 3.5.2.   Deprecated since version 3.9: collections.defaultdict now supports []. See PEP 585 and Generic Alias Type.
class typing.Deque(deque, MutableSequence[T])  
A generic version of collections.deque.  New in version 3.5.4.   New in version 3.6.1.   Deprecated since version 3.9: collections.deque now supports []. See PEP 585 and Generic Alias Type.
class typing.Dict(dict, MutableMapping[KT, VT])  
A generic version of dict. Useful for annotating return types. To annotate arguments it is preferred to use an abstract collection type such as Mapping. This type can be used as follows: def count_words(text: str) -> Dict[str, int]:
    ...
  Deprecated since version 3.9: builtins.dict now supports []. See PEP 585 and Generic Alias Type.
typing.Final  
A special typing construct to indicate to type checkers that a name cannot be re-assigned or overridden in a subclass. For example: MAX_SIZE: Final = 9000
MAX_SIZE += 1  # Error reported by type checker

class Connection:
    TIMEOUT: Final[int] = 10

class FastConnector(Connection):
    TIMEOUT = 1  # Error reported by type checker
 There is no runtime checking of these properties. See PEP 591 for more details.  New in version 3.8.
@typing.final  
A decorator to indicate to type checkers that the decorated method cannot be overridden, and the decorated class cannot be subclassed. For example: class Base:
    @final
    def done(self) -> None:
        ...
class Sub(Base):
    def done(self) -> None:  # Error reported by type checker
          ...

@final
class Leaf:
    ...
class Other(Leaf):  # Error reported by type checker
    ...
 There is no runtime checking of these properties. See PEP 591 for more details.  New in version 3.8.
class typing.ForwardRef  
A class used for internal typing representation of string forward references. For example, List["SomeClass"] is implicitly transformed into List[ForwardRef("SomeClass")]. This class should not be instantiated by a user, but may be used by introspection tools.  Note PEP 585 generic types such as list["SomeClass"] will not be implicitly transformed into list[ForwardRef("SomeClass")] and thus will not automatically resolve to list[SomeClass].   New in version 3.7.4.
class typing.FrozenSet(frozenset, AbstractSet[T_co])  
A generic version of builtins.frozenset.  Deprecated since version 3.9: builtins.frozenset now supports []. See PEP 585 and Generic Alias Type.
class typing.Generator(Iterator[T_co], Generic[T_co, T_contra, V_co])  
A generator can be annotated by the generic type Generator[YieldType, SendType, ReturnType]. For example: def echo_round() -> Generator[int, float, str]:
    sent = yield 0
    while sent >= 0:
        sent = yield round(sent)
    return 'Done'
 Note that unlike many other generics in the typing module, the SendType of Generator behaves contravariantly, not covariantly or invariantly. If your generator will only yield values, set the SendType and ReturnType to None: def infinite_stream(start: int) -> Generator[int, None, None]:
    while True:
        yield start
        start += 1
 Alternatively, annotate your generator as having a return type of either Iterable[YieldType] or Iterator[YieldType]: def infinite_stream(start: int) -> Iterator[int]:
    while True:
        yield start
        start += 1
  Deprecated since version 3.9: collections.abc.Generator now supports []. See PEP 585 and Generic Alias Type.
class typing.Generic  
Abstract base class for generic types. A generic type is typically declared by inheriting from an instantiation of this class with one or more type variables. For example, a generic mapping type might be defined as: class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
        # Etc.
 This class can then be used as follows: X = TypeVar('X')
Y = TypeVar('Y')

def lookup_name(mapping: Mapping[X, Y], key: X, default: Y) -> Y:
    try:
        return mapping[key]
    except KeyError:
        return default
typing.get_origin(tp)  
Provide basic introspection for generic types and special typing forms. For a typing object of the form X[Y, Z, ...] these functions return X and (Y, Z, ...). If X is a generic alias for a builtin or collections class, it gets normalized to the original class. If X is a Union or Literal contained in another generic type, the order of (Y, Z, ...) may be different from the order of the original arguments [Y, Z, ...] due to type caching. For unsupported objects return None and () correspondingly. Examples: assert get_origin(Dict[str, int]) is dict
assert get_args(Dict[int, str]) == (int, str)

assert get_origin(Union[int, str]) is Union
assert get_args(Union[int, str]) == (int, str)
  New in version 3.8.
typing.get_type_hints(obj, globalns=None, localns=None, include_extras=False)  
Return a dictionary containing type hints for a function, method, module or class object. This is often the same as obj.__annotations__. In addition, forward references encoded as string literals are handled by evaluating them in globals and locals namespaces. If necessary, Optional[t] is added for function and method annotations if a default value equal to None is set. For a class C, return a dictionary constructed by merging all the __annotations__ along C.__mro__ in reverse order. The function recursively replaces all Annotated[T, ...] with T, unless include_extras is set to True (see Annotated for more information). For example: class Student(NamedTuple):
    name: Annotated[str, 'some marker']

get_type_hints(Student) == {'name': str}
get_type_hints(Student, include_extras=False) == {'name': str}
get_type_hints(Student, include_extras=True) == {
    'name': Annotated[str, 'some marker']
}
  Changed in version 3.9: Added include_extras parameter as part of PEP 593.
class typing.ItemsView(MappingView, Generic[KT_co, VT_co])  
A generic version of collections.abc.ItemsView.  Deprecated since version 3.9: collections.abc.ItemsView now supports []. See PEP 585 and Generic Alias Type.
class typing.Iterable(Generic[T_co])  
A generic version of collections.abc.Iterable.  Deprecated since version 3.9: collections.abc.Iterable now supports []. See PEP 585 and Generic Alias Type.
class typing.Iterator(Iterable[T_co])  
A generic version of collections.abc.Iterator.  Deprecated since version 3.9: collections.abc.Iterator now supports []. See PEP 585 and Generic Alias Type.
class typing.KeysView(MappingView[KT_co], AbstractSet[KT_co])  
A generic version of collections.abc.KeysView.  Deprecated since version 3.9: collections.abc.KeysView now supports []. See PEP 585 and Generic Alias Type.
class typing.List(list, MutableSequence[T])  
Generic version of list. Useful for annotating return types. To annotate arguments it is preferred to use an abstract collection type such as Sequence or Iterable. This type may be used as follows: T = TypeVar('T', int, float)

def vec2(x: T, y: T) -> List[T]:
    return [x, y]

def keep_positives(vector: Sequence[T]) -> List[T]:
    return [item for item in vector if item > 0]
  Deprecated since version 3.9: builtins.list now supports []. See PEP 585 and Generic Alias Type.