neulab/docprompting-conala huggingface dataset:
inspect.getfullargspec(func)  
Get the names and default values of a Python function’s parameters. A named tuple is returned: FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults,
annotations) args is a list of the positional parameter names. varargs is the name of the * parameter or None if arbitrary positional arguments are not accepted. varkw is the name of the ** parameter or None if arbitrary keyword arguments are not accepted. defaults is an n-tuple of default argument values corresponding to the last n positional parameters, or None if there are no such defaults defined. kwonlyargs is a list of keyword-only parameter names in declaration order. kwonlydefaults is a dictionary mapping parameter names from kwonlyargs to the default values used if no argument is supplied. annotations is a dictionary mapping parameter names to annotations. The special key "return" is used to report the function return value annotation (if any). Note that signature() and Signature Object provide the recommended API for callable introspection, and support additional behaviours (like positional-only arguments) that are sometimes encountered in extension module APIs. This function is retained primarily for use in code that needs to maintain compatibility with the Python 2 inspect module API.  Changed in version 3.4: This function is now based on signature(), but still ignores __wrapped__ attributes and includes the already bound first parameter in the signature output for bound methods.   Changed in version 3.6: This method was previously documented as deprecated in favour of signature() in Python 3.5, but that decision has been reversed in order to restore a clearly supported standard interface for single-source Python 2/3 code migrating away from the legacy getargspec() API.   Changed in version 3.7: Python only explicitly guaranteed that it preserved the declaration order of keyword-only parameters as of version 3.7, although in practice this order had always been preserved in Python 3.
inspect.getgeneratorlocals(generator)  
Get the mapping of live local variables in generator to their current values. A dictionary is returned that maps from variable names to values. This is the equivalent of calling locals() in the body of the generator, and all the same caveats apply. If generator is a generator with no currently associated frame, then an empty dictionary is returned. TypeError is raised if generator is not a Python generator object.  CPython implementation detail: This function relies on the generator exposing a Python stack frame for introspection, which isn’t guaranteed to be the case in all implementations of Python. In such cases, this function will always return an empty dictionary.   New in version 3.3.
inspect.getgeneratorstate(generator)  
Get current state of a generator-iterator.  Possible states are:

 GEN_CREATED: Waiting to start execution. GEN_RUNNING: Currently being executed by the interpreter. GEN_SUSPENDED: Currently suspended at a yield expression. GEN_CLOSED: Execution has completed.     New in version 3.2.
inspect.getinnerframes(traceback, context=1)  
Get a list of frame records for a traceback’s frame and all inner frames. These frames represent calls made as a consequence of frame. The first entry in the list represents traceback; the last entry represents where the exception was raised.  Changed in version 3.5: A list of named tuples FrameInfo(frame, filename, lineno, function, code_context, index) is returned.
inspect.getmembers(object[, predicate])  
Return all the members of an object in a list of (name, value) pairs sorted by name. If the optional predicate argument—which will be called with the value object of each member—is supplied, only members for which the predicate returns a true value are included.  Note getmembers() will only return class attributes defined in the metaclass when the argument is a class and those attributes have been listed in the metaclass’ custom __dir__().
inspect.getmodule(object)  
Try to guess which module an object was defined in.
inspect.getmodulename(path)  
Return the name of the module named by the file path, without including the names of enclosing packages. The file extension is checked against all of the entries in importlib.machinery.all_suffixes(). If it matches, the final path component is returned with the extension removed. Otherwise, None is returned. Note that this function only returns a meaningful name for actual Python modules - paths that potentially refer to Python packages will still return None.  Changed in version 3.3: The function is based directly on importlib.
inspect.getmro(cls)  
Return a tuple of class cls’s base classes, including cls, in method resolution order. No class appears more than once in this tuple. Note that the method resolution order depends on cls’s type. Unless a very peculiar user-defined metatype is in use, cls will be the first element of the tuple.
inspect.getouterframes(frame, context=1)  
Get a list of frame records for a frame and all outer frames. These frames represent the calls that lead to the creation of frame. The first entry in the returned list represents frame; the last entry represents the outermost call on frame’s stack.  Changed in version 3.5: A list of named tuples FrameInfo(frame, filename, lineno, function, code_context, index) is returned.
inspect.getsource(object)  
Return the text of the source code for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a single string. An OSError is raised if the source code cannot be retrieved.  Changed in version 3.3: OSError is raised instead of IOError, now an alias of the former.
inspect.getsourcefile(object)  
Return the name of the Python source file in which an object was defined. This will fail with a TypeError if the object is a built-in module, class, or function.
inspect.getsourcelines(object)  
Return a list of source lines and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of the lines corresponding to the object and the line number indicates where in the original source file the first line of code was found. An OSError is raised if the source code cannot be retrieved.  Changed in version 3.3: OSError is raised instead of IOError, now an alias of the former.
inspect.isabstract(object)  
Return True if the object is an abstract base class.
inspect.isasyncgen(object)  
Return True if the object is an asynchronous generator iterator created by an asynchronous generator function.  New in version 3.6.
inspect.isasyncgenfunction(object)  
Return True if the object is an asynchronous generator function, for example: >>> async def agen():
...     yield 1
...
>>> inspect.isasyncgenfunction(agen)
True
  New in version 3.6.   Changed in version 3.8: Functions wrapped in functools.partial() now return True if the wrapped function is a asynchronous generator function.
inspect.isawaitable(object)  
Return True if the object can be used in await expression. Can also be used to distinguish generator-based coroutines from regular generators: def gen():
    yield
@types.coroutine
def gen_coro():
    yield

assert not isawaitable(gen())
assert isawaitable(gen_coro())
  New in version 3.5.
inspect.isbuiltin(object)  
Return True if the object is a built-in function or a bound built-in method.
inspect.isclass(object)  
Return True if the object is a class, whether built-in or created in Python code.
inspect.iscoroutine(object)  
Return True if the object is a coroutine created by an async def function.  New in version 3.5.
inspect.iscoroutinefunction(object)  
Return True if the object is a coroutine function (a function defined with an async def syntax).  New in version 3.5.   Changed in version 3.8: Functions wrapped in functools.partial() now return True if the wrapped function is a coroutine function.
inspect.isdatadescriptor(object)  
Return True if the object is a data descriptor. Data descriptors have a __set__ or a __delete__ method. Examples are properties (defined in Python), getsets, and members. The latter two are defined in C and there are more specific tests available for those types, which is robust across Python implementations. Typically, data descriptors will also have __name__ and __doc__ attributes (properties, getsets, and members have both of these attributes), but this is not guaranteed.
inspect.isfunction(object)  
Return True if the object is a Python function, which includes functions created by a lambda expression.
inspect.isgeneratorfunction(object)  
Return True if the object is a Python generator function.  Changed in version 3.8: Functions wrapped in functools.partial() now return True if the wrapped function is a Python generator function.
inspect.isgetsetdescriptor(object)  
Return True if the object is a getset descriptor.  CPython implementation detail: getsets are attributes defined in extension modules via PyGetSetDef structures. For Python implementations without such types, this method will always return False.
inspect.ismemberdescriptor(object)  
Return True if the object is a member descriptor.  CPython implementation detail: Member descriptors are attributes defined in extension modules via PyMemberDef structures. For Python implementations without such types, this method will always return False.
inspect.ismethod(object)  
Return True if the object is a bound method written in Python.
inspect.ismethoddescriptor(object)  
Return True if the object is a method descriptor, but not if ismethod(), isclass(), isfunction() or isbuiltin() are true. This, for example, is true of int.__add__. An object passing this test has a __get__() method but not a __set__() method, but beyond that the set of attributes varies. A __name__ attribute is usually sensible, and __doc__ often is. Methods implemented via descriptors that also pass one of the other tests return False from the ismethoddescriptor() test, simply because the other tests promise more – you can, e.g., count on having the __func__ attribute (etc) when an object passes ismethod().
inspect.isroutine(object)  
Return True if the object is a user-defined or built-in function or method.
annotation  
The annotation for the parameter. If the parameter has no annotation, this attribute is set to Parameter.empty.
default  
The default value for the parameter. If the parameter has no default value, this attribute is set to Parameter.empty.
kind  
Describes how argument values are bound to the parameter. Possible values (accessible via Parameter, like Parameter.KEYWORD_ONLY):   
Name Meaning   
POSITIONAL_ONLY Value must be supplied as a positional argument. Positional only parameters are those which appear before a / entry (if present) in a Python function definition.  
POSITIONAL_OR_KEYWORD Value may be supplied as either a keyword or positional argument (this is the standard binding behaviour for functions implemented in Python.)  
VAR_POSITIONAL A tuple of positional arguments that aren’t bound to any other parameter. This corresponds to a *args parameter in a Python function definition.  
KEYWORD_ONLY Value must be supplied as a keyword argument. Keyword only parameters are those which appear after a * or *args entry in a Python function definition.  
VAR_KEYWORD A dict of keyword arguments that aren’t bound to any other parameter. This corresponds to a **kwargs parameter in a Python function definition.   Example: print all keyword-only arguments without default values: >>> def foo(a, b, *, c, d=10):
...     pass

>>> sig = signature(foo)
>>> for param in sig.parameters.values():
...     if (param.kind == param.KEYWORD_ONLY and
...                        param.default is param.empty):
...         print('Parameter:', param)
Parameter: c
kind.description  
Describes a enum value of Parameter.kind.  New in version 3.8.  Example: print all descriptions of arguments: >>> def foo(a, b, *, c, d=10):
...     pass

>>> sig = signature(foo)
>>> for param in sig.parameters.values():
...     print(param.kind.description)
positional or keyword
positional or keyword
keyword-only
keyword-only
name  
The name of the parameter as a string. The name must be a valid Python identifier.  CPython implementation detail: CPython generates implicit parameter names of the form .0 on the code objects used to implement comprehensions and generator expressions.  Changed in version 3.6: These parameter names are exposed by this module as names like implicit0.
replace(*[, name][, kind][, default][, annotation])   Create a new Parameter instance based on the instance replaced was invoked on. To override a Parameter attribute, pass the corresponding argument. To remove a default value or/and an annotation from a Parameter, pass Parameter.empty. >>> from inspect import Parameter
>>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
>>> str(param)
'foo=42'

>>> str(param.replace()) # Will create a shallow copy of 'param'
'foo=42'

>>> str(param.replace(default=Parameter.empty, annotation='spam'))
"foo:'spam'"
  Changed in version 3.4: In Python 3.3 Parameter objects were allowed to have name set to None if their kind was set to POSITIONAL_ONLY. This is no longer permitted.
class inspect.Signature(parameters=None, *, return_annotation=Signature.empty)  
A Signature object represents the call signature of a function and its return annotation. For each parameter accepted by the function it stores a Parameter object in its parameters collection. The optional parameters argument is a sequence of Parameter objects, which is validated to check that there are no parameters with duplicate names, and that the parameters are in the right order, i.e. positional-only first, then positional-or-keyword, and that parameters with defaults follow parameters without defaults. The optional return_annotation argument, can be an arbitrary Python object, is the “return” annotation of the callable. Signature objects are immutable. Use Signature.replace() to make a modified copy.  Changed in version 3.5: Signature objects are picklable and hashable.   
empty  
A special class-level marker to specify absence of a return annotation. 
  
parameters  
An ordered mapping of parameters’ names to the corresponding Parameter objects. Parameters appear in strict definition order, including keyword-only parameters.  Changed in version 3.7: Python only explicitly guaranteed that it preserved the declaration order of keyword-only parameters as of version 3.7, although in practice this order had always been preserved in Python 3.  
  
return_annotation  
The “return” annotation for the callable. If the callable has no “return” annotation, this attribute is set to Signature.empty. 
  
bind(*args, **kwargs)  
Create a mapping from positional and keyword arguments to parameters. Returns BoundArguments if *args and **kwargs match the signature, or raises a TypeError. 
  
bind_partial(*args, **kwargs)  
Works the same way as Signature.bind(), but allows the omission of some required arguments (mimics functools.partial() behavior.) Returns BoundArguments, or raises a TypeError if the passed arguments do not match the signature. 
  
replace(*[, parameters][, return_annotation])  
Create a new Signature instance based on the instance replace was invoked on. It is possible to pass different parameters and/or return_annotation to override the corresponding properties of the base signature. To remove return_annotation from the copied Signature, pass in Signature.empty. >>> def test(a, b):
...     pass
>>> sig = signature(test)
>>> new_sig = sig.replace(return_annotation="new return anno")
>>> str(new_sig)
"(a, b) -> 'new return anno'"
 
  
classmethod from_callable(obj, *, follow_wrapped=True)  
Return a Signature (or its subclass) object for a given callable obj. Pass follow_wrapped=False to get a signature of obj without unwrapping its __wrapped__ chain. This method simplifies subclassing of Signature: class MySignature(Signature):
    pass
sig = MySignature.from_callable(min)
assert isinstance(sig, MySignature)
  New in version 3.5.
inspect.signature(callable, *, follow_wrapped=True)  
Return a Signature object for the given callable: >>> from inspect import signature
>>> def foo(a, *, b:int, **kwargs):
...     pass

>>> sig = signature(foo)

>>> str(sig)
'(a, *, b:int, **kwargs)'

>>> str(sig.parameters['b'])
'b:int'

>>> sig.parameters['b'].annotation
<class 'int'>
 Accepts a wide range of Python callables, from plain functions and classes to functools.partial() objects. Raises ValueError if no signature can be provided, and TypeError if that type of object is not supported. A slash(/) in the signature of a function denotes that the parameters prior to it are positional-only. For more info, see the FAQ entry on positional-only parameters.  New in version 3.5: follow_wrapped parameter. Pass False to get a signature of callable specifically (callable.__wrapped__ will not be used to unwrap decorated callables.)   Note Some callables may not be introspectable in certain implementations of Python. For example, in CPython, some built-in functions defined in C provide no metadata about their arguments.
bind(*args, **kwargs)  
Create a mapping from positional and keyword arguments to parameters. Returns BoundArguments if *args and **kwargs match the signature, or raises a TypeError.
bind_partial(*args, **kwargs)  
Works the same way as Signature.bind(), but allows the omission of some required arguments (mimics functools.partial() behavior.) Returns BoundArguments, or raises a TypeError if the passed arguments do not match the signature.
classmethod from_callable(obj, *, follow_wrapped=True)  
Return a Signature (or its subclass) object for a given callable obj. Pass follow_wrapped=False to get a signature of obj without unwrapping its __wrapped__ chain. This method simplifies subclassing of Signature: class MySignature(Signature):
    pass
sig = MySignature.from_callable(min)
assert isinstance(sig, MySignature)
  New in version 3.5.
parameters  
An ordered mapping of parameters’ names to the corresponding Parameter objects. Parameters appear in strict definition order, including keyword-only parameters.  Changed in version 3.7: Python only explicitly guaranteed that it preserved the declaration order of keyword-only parameters as of version 3.7, although in practice this order had always been preserved in Python 3.
replace(*[, parameters][, return_annotation])  
Create a new Signature instance based on the instance replace was invoked on. It is possible to pass different parameters and/or return_annotation to override the corresponding properties of the base signature. To remove return_annotation from the copied Signature, pass in Signature.empty. >>> def test(a, b):
...     pass
>>> sig = signature(test)
>>> new_sig = sig.replace(return_annotation="new return anno")
>>> str(new_sig)
"(a, b) -> 'new return anno'"
return_annotation  
The “return” annotation for the callable. If the callable has no “return” annotation, this attribute is set to Signature.empty.
inspect.stack(context=1)  
Return a list of frame records for the caller’s stack. The first entry in the returned list represents the caller; the last entry represents the outermost call on the stack.  Changed in version 3.5: A list of named tuples FrameInfo(frame, filename, lineno, function, code_context, index) is returned.
inspect.trace(context=1)  
Return a list of frame records for the stack between the current frame and the frame in which an exception currently being handled was raised in. The first entry in the list represents the caller; the last entry represents where the exception was raised.  Changed in version 3.5: A list of named tuples FrameInfo(frame, filename, lineno, function, code_context, index) is returned.
inspect.unwrap(func, *, stop=None)  
Get the object wrapped by func. It follows the chain of __wrapped__ attributes returning the last object in the chain. stop is an optional callback accepting an object in the wrapper chain as its sole argument that allows the unwrapping to be terminated early if the callback returns a true value. If the callback never returns a true value, the last object in the chain is returned as usual. For example, signature() uses this to stop unwrapping if any object in the chain has a __signature__ attribute defined. ValueError is raised if a cycle is encountered.  New in version 3.4.
class int([x])  
class int(x, base=10)  
Return an integer object constructed from a number or string x, or return 0 if no arguments are given. If x defines __int__(), int(x) returns x.__int__(). If x defines __index__(), it returns x.__index__(). If x defines __trunc__(), it returns x.__trunc__(). For floating point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in radix base. Optionally, the literal can be preceded by + or - (with no space in between) and surrounded by whitespace. A base-n literal consists of the digits 0 to n-1, with a to z (or A to Z) having values 10 to 35. The default base is 10. The allowed values are 0 and 2–36. Base-2, -8, and -16 literals can be optionally prefixed with 0b/0B, 0o/0O, or 0x/0X, as with integer literals in code. Base 0 means to interpret exactly as a code literal, so that the actual base is 2, 8, 10, or 16, and so that int('010', 0) is not legal, while int('010') is, as well as int('010', 8). The integer type is described in Numeric Types — int, float, complex.  Changed in version 3.4: If base is not an instance of int and the base object has a base.__index__ method, that method is called to obtain an integer for the base. Previous versions used base.__int__ instead of base.__index__.   Changed in version 3.6: Grouping digits with underscores as in code literals is allowed.   Changed in version 3.7: x is now a positional-only parameter.   Changed in version 3.8: Falls back to __index__() if __int__() is not defined.
int.as_integer_ratio()  
Return a pair of integers whose ratio is exactly equal to the original integer and with a positive denominator. The integer ratio of integers (whole numbers) is always the integer as the numerator and 1 as the denominator.  New in version 3.8.
int.bit_length()  
Return the number of bits necessary to represent an integer in binary, excluding the sign and leading zeros: >>> n = -37
>>> bin(n)
'-0b100101'
>>> n.bit_length()
6
 More precisely, if x is nonzero, then x.bit_length() is the unique positive integer k such that 2**(k-1) <= abs(x) < 2**k. Equivalently, when abs(x) is small enough to have a correctly rounded logarithm, then k = 1 + int(log(abs(x), 2)). If x is zero, then x.bit_length() returns 0. Equivalent to: def bit_length(self):
    s = bin(self)       # binary representation:  bin(-37) --> '-0b100101'
    s = s.lstrip('-0b') # remove leading zeros and minus sign
    return len(s)       # len('100101') --> 6
  New in version 3.1.
classmethod int.from_bytes(bytes, byteorder, *, signed=False)  
Return the integer represented by the given array of bytes. >>> int.from_bytes(b'\x00\x10', byteorder='big')
16
>>> int.from_bytes(b'\x00\x10', byteorder='little')
4096
>>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=True)
-1024
>>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=False)
64512
>>> int.from_bytes([255, 0, 0], byteorder='big')
16711680
 The argument bytes must either be a bytes-like object or an iterable producing bytes. The byteorder argument determines the byte order used to represent the integer. If byteorder is "big", the most significant byte is at the beginning of the byte array. If byteorder is "little", the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. The signed argument indicates whether two’s complement is used to represent the integer.  New in version 3.2.