neulab/docprompting-conala huggingface dataset:
dis.dis(x=None, *, file=None, depth=None)  
Disassemble the x object. x can denote either a module, a class, a method, a function, a generator, an asynchronous generator, a coroutine, a code object, a string of source code or a byte sequence of raw bytecode. For a module, it disassembles all functions. For a class, it disassembles all methods (including class and static methods). For a code object or sequence of raw bytecode, it prints one line per bytecode instruction. It also recursively disassembles nested code objects (the code of comprehensions, generator expressions and nested functions, and the code used for building nested classes). Strings are first compiled to code objects with the compile() built-in function before being disassembled. If no object is provided, this function disassembles the last traceback. The disassembly is written as text to the supplied file argument if provided and to sys.stdout otherwise. The maximal depth of recursion is limited by depth unless it is None. depth=0 means no recursion.  Changed in version 3.4: Added file parameter.   Changed in version 3.7: Implemented recursive disassembling and added depth parameter.   Changed in version 3.7: This can now handle coroutine and asynchronous generator objects.
dis.disassemble(code, lasti=-1, *, file=None)  
dis.disco(code, lasti=-1, *, file=None)  
Disassemble a code object, indicating the last instruction if lasti was provided. The output is divided in the following columns:  the line number, for the first instruction of each line the current instruction, indicated as -->, a labelled instruction, indicated with >>, the address of the instruction, the operation code name, operation parameters, and interpretation of the parameters in parentheses.  The parameter interpretation recognizes local and global variable names, constant values, branch targets, and compare operators. The disassembly is written as text to the supplied file argument if provided and to sys.stdout otherwise.  Changed in version 3.4: Added file parameter.
dis.distb(tb=None, *, file=None)  
Disassemble the top-of-stack function of a traceback, using the last traceback if none was passed. The instruction causing the exception is indicated. The disassembly is written as text to the supplied file argument if provided and to sys.stdout otherwise.  Changed in version 3.4: Added file parameter.
dis.findlabels(code)  
Detect all offsets in the raw compiled bytecode string code which are jump targets, and return a list of these offsets.
dis.findlinestarts(code)  
This generator function uses the co_firstlineno and co_lnotab attributes of the code object code to find the offsets which are starts of lines in the source code. They are generated as (offset, lineno) pairs. See Objects/lnotab_notes.txt for the co_lnotab format and how to decode it.  Changed in version 3.6: Line numbers can be decreasing. Before, they were always increasing.
dis.get_instructions(x, *, first_line=None)  
Return an iterator over the instructions in the supplied function, method, source code string or code object. The iterator generates a series of Instruction named tuples giving the details of each operation in the supplied code. If first_line is not None, it indicates the line number that should be reported for the first source line in the disassembled code. Otherwise, the source line information (if any) is taken directly from the disassembled code object.  New in version 3.4.
dis.hasfree  
Sequence of bytecodes that access a free variable (note that ‘free’ in this context refers to names in the current scope that are referenced by inner scopes or names in outer scopes that are referenced from this scope. It does not include references to global or builtin scopes).
class dis.Instruction  
Details for a bytecode operation  
opcode  
numeric code for operation, corresponding to the opcode values listed below and the bytecode values in the Opcode collections. 
  
opname  
human readable name for operation 
  
arg  
numeric argument to operation (if any), otherwise None 
  
argval  
resolved arg value (if known), otherwise same as arg 
  
argrepr  
human readable description of operation argument 
  
offset  
start index of operation within bytecode sequence 
  
starts_line  
line started by this opcode (if any), otherwise None 
  
is_jump_target  
True if other code jumps to here, otherwise False 
  New in version 3.4.
opcode  
numeric code for operation, corresponding to the opcode values listed below and the bytecode values in the Opcode collections.
dis.show_code(x, *, file=None)  
Print detailed code object information for the supplied function, method, source code string or code object to file (or sys.stdout if file is not specified). This is a convenient shorthand for print(code_info(x), file=file), intended for interactive exploration at the interpreter prompt.  New in version 3.2.   Changed in version 3.4: Added file parameter.
dis.stack_effect(opcode, oparg=None, *, jump=None)  
Compute the stack effect of opcode with argument oparg. If the code has a jump target and jump is True, stack_effect() will return the stack effect of jumping. If jump is False, it will return the stack effect of not jumping. And if jump is None (default), it will return the maximal stack effect of both cases.  New in version 3.4.   Changed in version 3.8: Added jump parameter.
distutils — Building and installing Python modules The distutils package provides support for building and installing additional modules into a Python installation. The new modules may be either 100%-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C. Most Python users will not want to use this module directly, but instead use the cross-version tools maintained by the Python Packaging Authority. In particular, setuptools is an enhanced alternative to distutils that provides:  support for declaring project dependencies additional mechanisms for configuring which files to include in source releases (including plugins for integration with version control systems) the ability to declare project “entry points”, which can be used as the basis for application plugin systems the ability to automatically generate Windows command line executables at installation time rather than needing to prebuild them consistent behaviour across all supported Python versions  The recommended pip installer runs all setup.py scripts with setuptools, even if the script itself only imports distutils. Refer to the Python Packaging User Guide for more information. For the benefits of packaging tool authors and users seeking a deeper understanding of the details of the current packaging and distribution system, the legacy distutils based user documentation and API reference remain available:  Installing Python Modules (Legacy version) Distributing Python Modules (Legacy version)
divmod(a, b)  
Take two (non complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For integers, the result is the same as (a // b, a % b). For floating point numbers the result is (q, a % b), where q is usually math.floor(a /
b) but may be 1 less than that. In any case q * b + a % b is very close to a, if a % b is non-zero it has the same sign as b, and 0
<= abs(a % b) < abs(b).
doctest.COMPARISON_FLAGS  
A bitmask or’ing together all the comparison flags above.
doctest.debug(module, name, pm=False)  
Debug the doctests for an object. The module and name arguments are the same as for function testsource() above. The synthesized Python script for the named object’s docstring is written to a temporary file, and then that file is run under the control of the Python debugger, pdb. A shallow copy of module.__dict__ is used for both local and global execution context. Optional argument pm controls whether post-mortem debugging is used. If pm has a true value, the script file is run directly, and the debugger gets involved only if the script terminates via raising an unhandled exception. If it does, then post-mortem debugging is invoked, via pdb.post_mortem(), passing the traceback object from the unhandled exception. If pm is not specified, or is false, the script is run under the debugger from the start, via passing an appropriate exec() call to pdb.run().
class doctest.DebugRunner(checker=None, verbose=None, optionflags=0)  
A subclass of DocTestRunner that raises an exception as soon as a failure is encountered. If an unexpected exception occurs, an UnexpectedException exception is raised, containing the test, the example, and the original exception. If the output doesn’t match, then a DocTestFailure exception is raised, containing the test, the example, and the actual output. For information about the constructor parameters and methods, see the documentation for DocTestRunner in section Advanced API.
doctest.debug_src(src, pm=False, globs=None)  
Debug the doctests in a string. This is like function debug() above, except that a string containing doctest examples is specified directly, via the src argument. Optional argument pm has the same meaning as in function debug() above. Optional argument globs gives a dictionary to use as both local and global execution context. If not specified, or None, an empty dictionary is used. If specified, a shallow copy of the dictionary is used.
doctest.DocFileSuite(*paths, module_relative=True, package=None, setUp=None, tearDown=None, globs=None, optionflags=0, parser=DocTestParser(), encoding=None)  
Convert doctest tests from one or more text files to a unittest.TestSuite. The returned unittest.TestSuite is to be run by the unittest framework and runs the interactive examples in each file. If an example in any file fails, then the synthesized unit test fails, and a failureException exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. Pass one or more paths (as strings) to text files to be examined. Options may be provided as keyword arguments: Optional argument module_relative specifies how the filenames in paths should be interpreted:  If module_relative is True (the default), then each filename in paths specifies an OS-independent module-relative path. By default, this path is relative to the calling module’s directory; but if the package argument is specified, then it is relative to that package. To ensure OS-independence, each filename should use / characters to separate path segments, and may not be an absolute path (i.e., it may not begin with /). If module_relative is False, then each filename in paths specifies an OS-specific path. The path may be absolute or relative; relative paths are resolved with respect to the current working directory.  Optional argument package is a Python package or the name of a Python package whose directory should be used as the base directory for module-relative filenames in paths. If no package is specified, then the calling module’s directory is used as the base directory for module-relative filenames. It is an error to specify package if module_relative is False. Optional argument setUp specifies a set-up function for the test suite. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. Optional argument tearDown specifies a tear-down function for the test suite. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. Optional argument globs is a dictionary containing the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, globs is a new empty dictionary. Optional argument optionflags specifies the default doctest options for the tests, created by or-ing together individual option flags. See section Option Flags. See function set_unittest_reportflags() below for a better way to set reporting options. Optional argument parser specifies a DocTestParser (or subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., DocTestParser()). Optional argument encoding specifies an encoding that should be used to convert the file to unicode. The global __file__ is added to the globals provided to doctests loaded from a text file using DocFileSuite().
class doctest.DocTest(examples, globs, name, filename, lineno, docstring)  
A collection of doctest examples that should be run in a single namespace. The constructor arguments are used to initialize the attributes of the same names. DocTest defines the following attributes. They are initialized by the constructor, and should not be modified directly.  
examples  
A list of Example objects encoding the individual interactive Python examples that should be run by this test. 
  
globs  
The namespace (aka globals) that the examples should be run in. This is a dictionary mapping names to values. Any changes to the namespace made by the examples (such as binding new variables) will be reflected in globs after the test is run. 
  
name  
A string name identifying the DocTest. Typically, this is the name of the object or file that the test was extracted from. 
  
filename  
The name of the file that this DocTest was extracted from; or None if the filename is unknown, or if the DocTest was not extracted from a file. 
  
lineno  
The line number within filename where this DocTest begins, or None if the line number is unavailable. This line number is zero-based with respect to the beginning of the file. 
  
docstring  
The string that the test was extracted from, or None if the string is unavailable, or if the test was not extracted from a string.
docstring  
The string that the test was extracted from, or None if the string is unavailable, or if the test was not extracted from a string.
examples  
A list of Example objects encoding the individual interactive Python examples that should be run by this test.
filename  
The name of the file that this DocTest was extracted from; or None if the filename is unknown, or if the DocTest was not extracted from a file.
globs  
The namespace (aka globals) that the examples should be run in. This is a dictionary mapping names to values. Any changes to the namespace made by the examples (such as binding new variables) will be reflected in globs after the test is run.
lineno  
The line number within filename where this DocTest begins, or None if the line number is unavailable. This line number is zero-based with respect to the beginning of the file.
name  
A string name identifying the DocTest. Typically, this is the name of the object or file that the test was extracted from.
exception doctest.DocTestFailure(test, example, got)  
An exception raised by DocTestRunner to signal that a doctest example’s actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names.
DocTestFailure.test  
The DocTest object that was being run when the example failed.
class doctest.DocTestFinder(verbose=False, parser=DocTestParser(), recurse=True, exclude_empty=True)  
A processing class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. DocTests can be extracted from modules, classes, functions, methods, staticmethods, classmethods, and properties. The optional argument verbose can be used to display the objects searched by the finder. It defaults to False (no output). The optional argument parser specifies the DocTestParser object (or a drop-in replacement) that is used to extract doctests from docstrings. If the optional argument recurse is false, then DocTestFinder.find() will only examine the given object, and not any contained objects. If the optional argument exclude_empty is false, then DocTestFinder.find() will include tests for objects with empty docstrings. DocTestFinder defines the following method:  
find(obj[, name][, module][, globs][, extraglobs])  
Return a list of the DocTests that are defined by obj’s docstring, or by any of its contained objects’ docstrings. The optional argument name specifies the object’s name; this name will be used to construct names for the returned DocTests. If name is not specified, then obj.__name__ is used. The optional parameter module is the module that contains the given object. If the module is not specified or is None, then the test finder will attempt to automatically determine the correct module. The object’s module is used:  As a default namespace, if globs is not specified. To prevent the DocTestFinder from extracting DocTests from objects that are imported from other modules. (Contained objects with modules other than module are ignored.) To find the name of the file containing the object. To help find the line number of the object within its file.  If module is False, no attempt to find the module will be made. This is obscure, of use mostly in testing doctest itself: if module is False, or is None but cannot be found automatically, then all objects are considered to belong to the (non-existent) module, so all contained objects will (recursively) be searched for doctests. The globals for each DocTest is formed by combining globs and extraglobs (bindings in extraglobs override bindings in globs). A new shallow copy of the globals dictionary is created for each DocTest. If globs is not specified, then it defaults to the module’s __dict__, if specified, or {} otherwise. If extraglobs is not specified, then it defaults to {}.
find(obj[, name][, module][, globs][, extraglobs])  
Return a list of the DocTests that are defined by obj’s docstring, or by any of its contained objects’ docstrings. The optional argument name specifies the object’s name; this name will be used to construct names for the returned DocTests. If name is not specified, then obj.__name__ is used. The optional parameter module is the module that contains the given object. If the module is not specified or is None, then the test finder will attempt to automatically determine the correct module. The object’s module is used:  As a default namespace, if globs is not specified. To prevent the DocTestFinder from extracting DocTests from objects that are imported from other modules. (Contained objects with modules other than module are ignored.) To find the name of the file containing the object. To help find the line number of the object within its file.  If module is False, no attempt to find the module will be made. This is obscure, of use mostly in testing doctest itself: if module is False, or is None but cannot be found automatically, then all objects are considered to belong to the (non-existent) module, so all contained objects will (recursively) be searched for doctests. The globals for each DocTest is formed by combining globs and extraglobs (bindings in extraglobs override bindings in globs). A new shallow copy of the globals dictionary is created for each DocTest. If globs is not specified, then it defaults to the module’s __dict__, if specified, or {} otherwise. If extraglobs is not specified, then it defaults to {}.
class doctest.DocTestParser  
A processing class used to extract interactive examples from a string, and use them to create a DocTest object. DocTestParser defines the following methods:  
get_doctest(string, globs, name, filename, lineno)  
Extract all doctest examples from the given string, and collect them into a DocTest object. globs, name, filename, and lineno are attributes for the new DocTest object. See the documentation for DocTest for more information. 
  
get_examples(string, name='<string>')  
Extract all doctest examples from the given string, and return them as a list of Example objects. Line numbers are 0-based. The optional argument name is a name identifying this string, and is only used for error messages. 
  
parse(string, name='<string>')  
Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument name is a name identifying this string, and is only used for error messages.
get_doctest(string, globs, name, filename, lineno)  
Extract all doctest examples from the given string, and collect them into a DocTest object. globs, name, filename, and lineno are attributes for the new DocTest object. See the documentation for DocTest for more information.
get_examples(string, name='<string>')  
Extract all doctest examples from the given string, and return them as a list of Example objects. Line numbers are 0-based. The optional argument name is a name identifying this string, and is only used for error messages.
parse(string, name='<string>')  
Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument name is a name identifying this string, and is only used for error messages.
report_failure(out, test, example, got)  
Report that the given example failed. This method is provided to allow subclasses of DocTestRunner to customize their output; it should not be called directly. example is the example about to be processed. got is the actual output from the example. test is the test containing example. out is the output function that was passed to DocTestRunner.run().
report_start(out, test, example)  
Report that the test runner is about to process the given example. This method is provided to allow subclasses of DocTestRunner to customize their output; it should not be called directly. example is the example about to be processed. test is the test containing example. out is the output function that was passed to DocTestRunner.run().
report_success(out, test, example, got)  
Report that the given example ran successfully. This method is provided to allow subclasses of DocTestRunner to customize their output; it should not be called directly. example is the example about to be processed. got is the actual output from the example. test is the test containing example. out is the output function that was passed to DocTestRunner.run().
report_unexpected_exception(out, test, example, exc_info)  
Report that the given example raised an unexpected exception. This method is provided to allow subclasses of DocTestRunner to customize their output; it should not be called directly. example is the example about to be processed. exc_info is a tuple containing information about the unexpected exception (as returned by sys.exc_info()). test is the test containing example. out is the output function that was passed to DocTestRunner.run().
run(test, compileflags=None, out=None, clear_globs=True)  
Run the examples in test (a DocTest object), and display the results using the writer function out. The examples are run in the namespace test.globs. If clear_globs is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use clear_globs=False. compileflags gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to globs. The output of each example is checked using the DocTestRunner’s output checker, and the results are formatted by the DocTestRunner.report_*() methods.
summarize(verbose=None)  
Print a summary of all the test cases that have been run by this DocTestRunner, and return a named tuple TestResults(failed, attempted). The optional verbose argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner’s verbosity is used.