neulab/docprompting-conala huggingface dataset:
is_package(fullname)  
Concrete implementation of InspectLoader.is_package(). A module is determined to be a package if its file path (as provided by ExecutionLoader.get_filename()) is a file named __init__ when the file extension is removed and the module name itself does not end in __init__.
load_module(fullname)  
Concrete implementation of Loader.load_module().  Deprecated since version 3.4: Use exec_module() instead.
path_mtime(path)  
Optional abstract method which returns the modification time for the specified path.  Deprecated since version 3.3: This method is deprecated in favour of path_stats(). You don’t have to implement it, but it is still available for compatibility purposes. Raise OSError if the path cannot be handled.   Changed in version 3.4: Raise OSError instead of NotImplementedError.
path_stats(path)  
Optional abstract method which returns a dict containing metadata about the specified path. Supported dictionary keys are:  
'mtime' (mandatory): an integer or floating-point number representing the modification time of the source code; 
'size' (optional): the size in bytes of the source code.  Any other keys in the dictionary are ignored, to allow for future extensions. If the path cannot be handled, OSError is raised.  New in version 3.3.   Changed in version 3.4: Raise OSError instead of NotImplementedError.
set_data(path, data)  
Optional abstract method which writes the specified bytes to a file path. Any intermediate directories which do not exist are to be created automatically. When writing to the path fails because the path is read-only (errno.EACCES/PermissionError), do not propagate the exception.  Changed in version 3.4: No longer raises NotImplementedError when called.
class importlib.abc.Traversable  
An object with a subset of pathlib.Path methods suitable for traversing directories and opening files.  New in version 3.9.
class importlib.abc.TraversableReader  
An abstract base class for resource readers capable of serving the files interface. Subclasses ResourceReader and provides concrete implementations of the ResourceReader’s abstract methods. Therefore, any loader supplying TraversableReader also supplies ResourceReader.  New in version 3.9.
importlib.find_loader(name, path=None)  
Find the loader for a module, optionally within the specified path. If the module is in sys.modules, then sys.modules[name].__loader__ is returned (unless the loader would be None or is not set, in which case ValueError is raised). Otherwise a search using sys.meta_path is done. None is returned if no loader is found. A dotted name does not have its parents implicitly imported as that requires loading them and that may not be desired. To properly import a submodule you will need to import all parent packages of the submodule and use the correct argument to path.  New in version 3.3.   Changed in version 3.4: If __loader__ is not set, raise ValueError, just like when the attribute is set to None.   Deprecated since version 3.4: Use importlib.util.find_spec() instead.
importlib.import_module(name, package=None)  
Import a module. The name argument specifies what module to import in absolute or relative terms (e.g. either pkg.mod or ..mod). If the name is specified in relative terms, then the package argument must be set to the name of the package which is to act as the anchor for resolving the package name (e.g. import_module('..mod', 'pkg.subpkg') will import pkg.mod). The import_module() function acts as a simplifying wrapper around importlib.__import__(). This means all semantics of the function are derived from importlib.__import__(). The most important difference between these two functions is that import_module() returns the specified package or module (e.g. pkg.mod), while __import__() returns the top-level package or module (e.g. pkg). If you are dynamically importing a module that was created since the interpreter began execution (e.g., created a Python source file), you may need to call invalidate_caches() in order for the new module to be noticed by the import system.  Changed in version 3.3: Parent packages are automatically imported.
importlib.invalidate_caches()  
Invalidate the internal caches of finders stored at sys.meta_path. If a finder implements invalidate_caches() then it will be called to perform the invalidation. This function should be called if any modules are created/installed while your program is running to guarantee all finders will notice the new module’s existence.  New in version 3.3.
importlib.machinery.all_suffixes()  
Returns a combined list of strings representing all file suffixes for modules recognized by the standard import machinery. This is a helper for code which simply needs to know if a filesystem path potentially refers to a module without needing any details on the kind of module (for example, inspect.getmodulename()).  New in version 3.3.
class importlib.machinery.BuiltinImporter  
An importer for built-in modules. All known built-in modules are listed in sys.builtin_module_names. This class implements the importlib.abc.MetaPathFinder and importlib.abc.InspectLoader ABCs. Only class methods are defined by this class to alleviate the need for instantiation.  Changed in version 3.5: As part of PEP 489, the builtin importer now implements Loader.create_module() and Loader.exec_module()
importlib.machinery.BYTECODE_SUFFIXES  
A list of strings representing the recognized file suffixes for bytecode modules (including the leading dot).  New in version 3.3.   Changed in version 3.5: The value is no longer dependent on __debug__.
importlib.machinery.DEBUG_BYTECODE_SUFFIXES  
A list of strings representing the file suffixes for non-optimized bytecode modules.  New in version 3.3.   Deprecated since version 3.5: Use BYTECODE_SUFFIXES instead.
class importlib.machinery.ExtensionFileLoader(fullname, path)  
A concrete implementation of importlib.abc.ExecutionLoader for extension modules. The fullname argument specifies the name of the module the loader is to support. The path argument is the path to the extension module’s file.  New in version 3.3.   
name  
Name of the module the loader supports. 
  
path  
Path to the extension module. 
  
create_module(spec)  
Creates the module object from the given specification in accordance with PEP 489.  New in version 3.5.  
  
exec_module(module)  
Initializes the given module object in accordance with PEP 489.  New in version 3.5.  
  
is_package(fullname)  
Returns True if the file path points to a package’s __init__ module based on EXTENSION_SUFFIXES. 
  
get_code(fullname)  
Returns None as extension modules lack a code object. 
  
get_source(fullname)  
Returns None as extension modules do not have source code. 
  
get_filename(fullname)  
Returns path.  New in version 3.4.
create_module(spec)  
Creates the module object from the given specification in accordance with PEP 489.  New in version 3.5.
exec_module(module)  
Initializes the given module object in accordance with PEP 489.  New in version 3.5.
get_filename(fullname)  
Returns path.  New in version 3.4.
is_package(fullname)  
Returns True if the file path points to a package’s __init__ module based on EXTENSION_SUFFIXES.
importlib.machinery.EXTENSION_SUFFIXES  
A list of strings representing the recognized file suffixes for extension modules.  New in version 3.3.
class importlib.machinery.FileFinder(path, *loader_details)  
A concrete implementation of importlib.abc.PathEntryFinder which caches results from the file system. The path argument is the directory for which the finder is in charge of searching. The loader_details argument is a variable number of 2-item tuples each containing a loader and a sequence of file suffixes the loader recognizes. The loaders are expected to be callables which accept two arguments of the module’s name and the path to the file found. The finder will cache the directory contents as necessary, making stat calls for each module search to verify the cache is not outdated. Because cache staleness relies upon the granularity of the operating system’s state information of the file system, there is a potential race condition of searching for a module, creating a new file, and then searching for the module the new file represents. If the operations happen fast enough to fit within the granularity of stat calls, then the module search will fail. To prevent this from happening, when you create a module dynamically, make sure to call importlib.invalidate_caches().  New in version 3.3.   
path  
The path the finder will search in. 
  
find_spec(fullname, target=None)  
Attempt to find the spec to handle fullname within path.  New in version 3.4.  
  
find_loader(fullname)  
Attempt to find the loader to handle fullname within path. 
  
invalidate_caches()  
Clear out the internal cache. 
  
classmethod path_hook(*loader_details)  
A class method which returns a closure for use on sys.path_hooks. An instance of FileFinder is returned by the closure using the path argument given to the closure directly and loader_details indirectly. If the argument to the closure is not an existing directory, ImportError is raised.
find_loader(fullname)  
Attempt to find the loader to handle fullname within path.
find_spec(fullname, target=None)  
Attempt to find the spec to handle fullname within path.  New in version 3.4.
classmethod path_hook(*loader_details)  
A class method which returns a closure for use on sys.path_hooks. An instance of FileFinder is returned by the closure using the path argument given to the closure directly and loader_details indirectly. If the argument to the closure is not an existing directory, ImportError is raised.
class importlib.machinery.FrozenImporter  
An importer for frozen modules. This class implements the importlib.abc.MetaPathFinder and importlib.abc.InspectLoader ABCs. Only class methods are defined by this class to alleviate the need for instantiation.  Changed in version 3.4: Gained create_module() and exec_module() methods.
class importlib.machinery.ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None)  
A specification for a module’s import-system-related state. This is typically exposed as the module’s __spec__ attribute. In the descriptions below, the names in parentheses give the corresponding attribute available directly on the module object. E.g. module.__spec__.origin == module.__file__. Note however that while the values are usually equivalent, they can differ since there is no synchronization between the two objects. Thus it is possible to update the module’s __path__ at runtime, and this will not be automatically reflected in __spec__.submodule_search_locations.  New in version 3.4.   
name 
 (__name__) A string for the fully-qualified name of the module.  
loader 
 (__loader__) The Loader that should be used when loading the module. Finders should always set this.  
origin 
 (__file__) Name of the place from which the module is loaded, e.g. “builtin” for built-in modules and the filename for modules loaded from source. Normally “origin” should be set, but it may be None (the default) which indicates it is unspecified (e.g. for namespace packages).  
submodule_search_locations 
 (__path__) List of strings for where to find submodules, if a package (None otherwise).  
loader_state 
 Container of extra module-specific data for use during loading (or None).  
cached 
 (__cached__) String for where the compiled module should be stored (or None).  
parent 
 (__package__) (Read-only) The fully-qualified name of the package under which the module should be loaded as a submodule (or the empty string for top-level modules). For packages, it is the same as __name__.  
has_location 
 Boolean indicating whether or not the module’s “origin” attribute refers to a loadable location.
importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES  
A list of strings representing the file suffixes for optimized bytecode modules.  New in version 3.3.   Deprecated since version 3.5: Use BYTECODE_SUFFIXES instead.
class importlib.machinery.PathFinder  
A Finder for sys.path and package __path__ attributes. This class implements the importlib.abc.MetaPathFinder ABC. Only class methods are defined by this class to alleviate the need for instantiation.  
classmethod find_spec(fullname, path=None, target=None)  
Class method that attempts to find a spec for the module specified by fullname on sys.path or, if defined, on path. For each path entry that is searched, sys.path_importer_cache is checked. If a non-false object is found then it is used as the path entry finder to look for the module being searched for. If no entry is found in sys.path_importer_cache, then sys.path_hooks is searched for a finder for the path entry and, if found, is stored in sys.path_importer_cache along with being queried about the module. If no finder is ever found then None is both stored in the cache and returned.  New in version 3.4.   Changed in version 3.5: If the current working directory – represented by an empty string – is no longer valid then None is returned but no value is cached in sys.path_importer_cache.  
  
classmethod find_module(fullname, path=None)  
A legacy wrapper around find_spec().  Deprecated since version 3.4: Use find_spec() instead.  
  
classmethod invalidate_caches()  
Calls importlib.abc.PathEntryFinder.invalidate_caches() on all finders stored in sys.path_importer_cache that define the method. Otherwise entries in sys.path_importer_cache set to None are deleted.  Changed in version 3.7: Entries of None in sys.path_importer_cache are deleted.  
  Changed in version 3.4: Calls objects in sys.path_hooks with the current working directory for '' (i.e. the empty string).
classmethod find_module(fullname, path=None)  
A legacy wrapper around find_spec().  Deprecated since version 3.4: Use find_spec() instead.
classmethod find_spec(fullname, path=None, target=None)  
Class method that attempts to find a spec for the module specified by fullname on sys.path or, if defined, on path. For each path entry that is searched, sys.path_importer_cache is checked. If a non-false object is found then it is used as the path entry finder to look for the module being searched for. If no entry is found in sys.path_importer_cache, then sys.path_hooks is searched for a finder for the path entry and, if found, is stored in sys.path_importer_cache along with being queried about the module. If no finder is ever found then None is both stored in the cache and returned.  New in version 3.4.   Changed in version 3.5: If the current working directory – represented by an empty string – is no longer valid then None is returned but no value is cached in sys.path_importer_cache.
classmethod invalidate_caches()  
Calls importlib.abc.PathEntryFinder.invalidate_caches() on all finders stored in sys.path_importer_cache that define the method. Otherwise entries in sys.path_importer_cache set to None are deleted.  Changed in version 3.7: Entries of None in sys.path_importer_cache are deleted.
class importlib.machinery.SourceFileLoader(fullname, path)  
A concrete implementation of importlib.abc.SourceLoader by subclassing importlib.abc.FileLoader and providing some concrete implementations of other methods.  New in version 3.3.   
name  
The name of the module that this loader will handle. 
  
path  
The path to the source file. 
  
is_package(fullname)  
Return True if path appears to be for a package. 
  
path_stats(path)  
Concrete implementation of importlib.abc.SourceLoader.path_stats(). 
  
set_data(path, data)  
Concrete implementation of importlib.abc.SourceLoader.set_data(). 
  
load_module(name=None)  
Concrete implementation of importlib.abc.Loader.load_module() where specifying the name of the module to load is optional.  Deprecated since version 3.6: Use importlib.abc.Loader.exec_module() instead.
load_module(name=None)  
Concrete implementation of importlib.abc.Loader.load_module() where specifying the name of the module to load is optional.  Deprecated since version 3.6: Use importlib.abc.Loader.exec_module() instead.
path_stats(path)  
Concrete implementation of importlib.abc.SourceLoader.path_stats().
set_data(path, data)  
Concrete implementation of importlib.abc.SourceLoader.set_data().
class importlib.machinery.SourcelessFileLoader(fullname, path)  
A concrete implementation of importlib.abc.FileLoader which can import bytecode files (i.e. no source code files exist). Please note that direct use of bytecode files (and thus not source code files) inhibits your modules from being usable by all Python implementations or new versions of Python which change the bytecode format.  New in version 3.3.   
name  
The name of the module the loader will handle. 
  
path  
The path to the bytecode file. 
  
is_package(fullname)  
Determines if the module is a package based on path. 
  
get_code(fullname)  
Returns the code object for name created from path. 
  
get_source(fullname)  
Returns None as bytecode files have no source when this loader is used. 
  
load_module(name=None) 
 Concrete implementation of importlib.abc.Loader.load_module() where specifying the name of the module to load is optional.  Deprecated since version 3.6: Use importlib.abc.Loader.exec_module() instead.
get_source(fullname)  
Returns None as bytecode files have no source when this loader is used.
is_package(fullname)  
Determines if the module is a package based on path.
importlib.machinery.SOURCE_SUFFIXES  
A list of strings representing the recognized file suffixes for source modules.  New in version 3.3.
class importlib.machinery.WindowsRegistryFinder  
Finder for modules declared in the Windows registry. This class implements the importlib.abc.MetaPathFinder ABC. Only class methods are defined by this class to alleviate the need for instantiation.  New in version 3.3.   Deprecated since version 3.6: Use site configuration instead. Future versions of Python may not enable this finder by default.
importlib.reload(module)  
Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to try out the new version without leaving the Python interpreter. The return value is the module object (which can be different if re-importing causes a different object to be placed in sys.modules). When reload() is executed:  Python module’s code is recompiled and the module-level code re-executed, defining a new set of objects which are bound to names in the module’s dictionary by reusing the loader which originally loaded the module. The init function of extension modules is not called a second time. As with all other objects in Python the old objects are only reclaimed after their reference counts drop to zero. The names in the module namespace are updated to point to any new or changed objects. Other references to the old objects (such as names external to the module) are not rebound to refer to the new objects and must be updated in each namespace where they occur if that is desired.  There are a number of other caveats: When a module is reloaded, its dictionary (containing the module’s global variables) is retained. Redefinitions of names will override the old definitions, so this is generally not a problem. If the new version of a module does not define a name that was defined by the old version, the old definition remains. This feature can be used to the module’s advantage if it maintains a global table or cache of objects — with a try statement it can test for the table’s presence and skip its initialization if desired: try:
    cache
except NameError:
    cache = {}
 It is generally not very useful to reload built-in or dynamically loaded modules. Reloading sys, __main__, builtins and other key modules is not recommended. In many cases extension modules are not designed to be initialized more than once, and may fail in arbitrary ways when reloaded. If a module imports objects from another module using from … import …, calling reload() for the other module does not redefine the objects imported from it — one way around this is to re-execute the from statement, another is to use import and qualified names (module.name) instead. If a module instantiates instances of a class, reloading the module that defines the class does not affect the method definitions of the instances — they continue to use the old class definition. The same is true for derived classes.  New in version 3.4.   Changed in version 3.7: ModuleNotFoundError is raised when the module being reloaded lacks a ModuleSpec.
importlib.resources.as_file(traversable)  
Given a importlib.resources.abc.Traversable object representing a file, typically from importlib.resources.files(), return a context manager for use in a with statement. The context manager provides a pathlib.Path object. Exiting the context manager cleans up any temporary file created when the resource was extracted from e.g. a zip file. Use as_file when the Traversable methods (read_text, etc) are insufficient and an actual file on the file system is required.  New in version 3.9.
importlib.resources.contents(package)  
Return an iterable over the named items within the package. The iterable returns str resources (e.g. files) and non-resources (e.g. directories). The iterable does not recurse into subdirectories. package is either a name or a module object which conforms to the Package requirements.
importlib.resources.files(package)  
Returns an importlib.resources.abc.Traversable object representing the resource container for the package (think directory) and its resources (think files). A Traversable may contain other containers (think subdirectories). package is either a name or a module object which conforms to the Package requirements.  New in version 3.9.
importlib.resources.is_resource(package, name)  
Return True if there is a resource named name in the package, otherwise False. Remember that directories are not resources! package is either a name or a module object which conforms to the Package requirements.
importlib.resources.open_binary(package, resource)  
Open for binary reading the resource within package. package is either a name or a module object which conforms to the Package requirements. resource is the name of the resource to open within package; it may not contain path separators and it may not have sub-resources (i.e. it cannot be a directory). This function returns a typing.BinaryIO instance, a binary I/O stream open for reading.
importlib.resources.open_text(package, resource, encoding='utf-8', errors='strict')  
Open for text reading the resource within package. By default, the resource is opened for reading as UTF-8. package is either a name or a module object which conforms to the Package requirements. resource is the name of the resource to open within package; it may not contain path separators and it may not have sub-resources (i.e. it cannot be a directory). encoding and errors have the same meaning as with built-in open(). This function returns a typing.TextIO instance, a text I/O stream open for reading.
importlib.resources.Package  
The Package type is defined as Union[str, ModuleType]. This means that where the function describes accepting a Package, you can pass in either a string or a module. Module objects must have a resolvable __spec__.submodule_search_locations that is not None.
importlib.resources.path(package, resource)  
Return the path to the resource as an actual file system path. This function returns a context manager for use in a with statement. The context manager provides a pathlib.Path object. Exiting the context manager cleans up any temporary file created when the resource needs to be extracted from e.g. a zip file. package is either a name or a module object which conforms to the Package requirements. resource is the name of the resource to open within package; it may not contain path separators and it may not have sub-resources (i.e. it cannot be a directory).