neulab/docprompting-conala huggingface dataset:
read(filenames, encoding=None)  
Attempt to read and parse an iterable of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, a bytes object or a path-like object, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify an iterable of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the iterable will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files: import configparser, os

config = configparser.ConfigParser()
config.read_file(open('defaults.cfg'))
config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],
            encoding='cp1250')
  New in version 3.2: The encoding parameter. Previously, all files were read using the default encoding for open().   New in version 3.6.1: The filenames parameter accepts a path-like object.   New in version 3.7: The filenames parameter accepts a bytes object.
readfp(fp, filename=None)  
 Deprecated since version 3.2: Use read_file() instead.   Changed in version 3.2: readfp() now iterates on fp instead of calling fp.readline().  For existing code calling readfp() with arguments which don’t support iteration, the following generator may be used as a wrapper around the file-like object: def readline_generator(fp):
    line = fp.readline()
    while line:
        yield line
        line = fp.readline()
 Instead of parser.readfp(fp) use parser.read_file(readline_generator(fp)).
read_dict(dictionary, source='<dict>')  
Load configuration from any object that provides a dict-like items() method. Keys are section names, values are dictionaries with keys and values that should be present in the section. If the used dictionary type preserves order, sections and their keys will be added in order. Values are automatically converted to strings. Optional argument source specifies a context-specific name of the dictionary passed. If not given, <dict> is used. This method can be used to copy state between parsers.  New in version 3.2.
read_file(f, source=None)  
Read and parse configuration data from f which must be an iterable yielding Unicode strings (for example files opened in text mode). Optional argument source specifies the name of the file being read. If not given and f has a name attribute, that is used for source; the default is '<???>'.  New in version 3.2: Replaces readfp().
read_string(string, source='<string>')  
Parse configuration data from a string. Optional argument source specifies a context-specific name of the string passed. If not given, '<string>' is used. This should commonly be a filesystem path or a URL.  New in version 3.2.
remove_option(section, option)  
Remove the specified option from the specified section. If the section does not exist, raise NoSectionError. If the option existed to be removed, return True; otherwise return False.
remove_section(section)  
Remove the specified section from the configuration. If the section in fact existed, return True. Otherwise return False.
ConfigParser.SECTCRE  
A compiled regular expression used to parse section headers. The default matches [section] to the name "section". Whitespace is considered part of the section name, thus [  larch  ] will be read as a section of name "  larch  ". Override this attribute if that’s unsuitable. For example: >>> import re
>>> config = """
... [Section 1]
... option = value
...
... [  Section 2  ]
... another = val
... """
>>> typical = configparser.ConfigParser()
>>> typical.read_string(config)
>>> typical.sections()
['Section 1', '  Section 2  ']
>>> custom = configparser.ConfigParser()
>>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
>>> custom.read_string(config)
>>> custom.sections()
['Section 1', 'Section 2']
  Note While ConfigParser objects also use an OPTCRE attribute for recognizing option lines, it’s not recommended to override it because that would interfere with constructor options allow_no_value and delimiters.
sections()  
Return a list of the sections available; the default section is not included in the list.
set(section, option, value)  
If the given section exists, set the given option to the specified value; otherwise raise NoSectionError. option and value must be strings; if not, TypeError is raised.
write(fileobject, space_around_delimiters=True)  
Write a representation of the configuration to the specified file object, which must be opened in text mode (accepting strings). This representation can be parsed by a future read() call. If space_around_delimiters is true, delimiters between keys and values are surrounded by spaces.
exception configparser.DuplicateOptionError  
Exception raised by strict parsers if a single option appears twice during reading from a single file, string or dictionary. This catches misspellings and case sensitivity-related errors, e.g. a dictionary may have two keys representing the same case-insensitive configuration key.
exception configparser.DuplicateSectionError  
Exception raised if add_section() is called with the name of a section that is already present or in strict parsers when a section if found more than once in a single input file, string or dictionary.  New in version 3.2: Optional source and lineno attributes and arguments to __init__() were added.
class configparser.ExtendedInterpolation  
An alternative handler for interpolation which implements a more advanced syntax, used for instance in zc.buildout. Extended interpolation is using ${section:option} to denote a value from a foreign section. Interpolation can span multiple levels. For convenience, if the section: part is omitted, interpolation defaults to the current section (and possibly the default values from the special section). For example, the configuration specified above with basic interpolation, would look like this with extended interpolation: [Paths]
home_dir: /Users
my_dir: ${home_dir}/lumberjack
my_pictures: ${my_dir}/Pictures

[Escape]
cost: $$80  # use a $$ to escape the $ sign ($ is the only character that needs to be escaped)
 Values from other sections can be fetched as well: [Common]
home_dir: /Users
library_dir: /Library
system_dir: /System
macports_dir: /opt/local

[Frameworks]
Python: 3.2
path: ${Common:system_dir}/Library/Frameworks/

[Arthur]
nickname: Two Sheds
last_name: Jackson
my_dir: ${Common:home_dir}/twosheds
my_pictures: ${my_dir}/Pictures
python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}
exception configparser.InterpolationDepthError  
Exception raised when string interpolation cannot be completed because the number of iterations exceeds MAX_INTERPOLATION_DEPTH. Subclass of InterpolationError.
exception configparser.InterpolationError  
Base class for exceptions raised when problems occur performing string interpolation.
exception configparser.InterpolationMissingOptionError  
Exception raised when an option referenced from a value does not exist. Subclass of InterpolationError.
exception configparser.InterpolationSyntaxError  
Exception raised when the source text into which substitutions are made does not conform to the required syntax. Subclass of InterpolationError.
configparser.MAX_INTERPOLATION_DEPTH  
The maximum depth for recursive interpolation for get() when the raw parameter is false. This is relevant only when the default interpolation is used.
exception configparser.MissingSectionHeaderError  
Exception raised when attempting to parse a file which has no section headers.
exception configparser.NoOptionError  
Exception raised when a specified option is not found in the specified section.
exception configparser.ParsingError  
Exception raised when errors occur attempting to parse a file.  Changed in version 3.2: The filename attribute and __init__() argument were renamed to source for consistency.
class configparser.RawConfigParser(defaults=None, dict_type=dict, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configparser.DEFAULTSECT[, interpolation])  
Legacy variant of the ConfigParser. It has interpolation disabled by default and allows for non-string section names, option names, and values via its unsafe add_section and set methods, as well as the legacy defaults= keyword argument handling.  Changed in version 3.8: The default dict_type is dict, since it now preserves insertion order.   Note Consider using ConfigParser instead which checks types of the values to be stored internally. If you don’t want interpolation, you can use ConfigParser(interpolation=None).   
add_section(section)  
Add a section named section to the instance. If a section by the given name already exists, DuplicateSectionError is raised. If the default section name is passed, ValueError is raised. Type of section is not checked which lets users create non-string named sections. This behaviour is unsupported and may cause internal errors. 
  
set(section, option, value)  
If the given section exists, set the given option to the specified value; otherwise raise NoSectionError. While it is possible to use RawConfigParser (or ConfigParser with raw parameters set to true) for internal storage of non-string values, full functionality (including interpolation and output to files) can only be achieved using string values. This method lets users assign non-string values to keys internally. This behaviour is unsupported and will cause errors when attempting to write to a file or get it in non-raw mode. Use the mapping protocol API which does not allow such assignments to take place.
add_section(section)  
Add a section named section to the instance. If a section by the given name already exists, DuplicateSectionError is raised. If the default section name is passed, ValueError is raised. Type of section is not checked which lets users create non-string named sections. This behaviour is unsupported and may cause internal errors.
set(section, option, value)  
If the given section exists, set the given option to the specified value; otherwise raise NoSectionError. While it is possible to use RawConfigParser (or ConfigParser with raw parameters set to true) for internal storage of non-string values, full functionality (including interpolation and output to files) can only be achieved using string values. This method lets users assign non-string values to keys internally. This behaviour is unsupported and will cause errors when attempting to write to a file or get it in non-raw mode. Use the mapping protocol API which does not allow such assignments to take place.
exception ConnectionAbortedError  
A subclass of ConnectionError, raised when a connection attempt is aborted by the peer. Corresponds to errno ECONNABORTED.
exception ConnectionError  
A base class for connection-related issues. Subclasses are BrokenPipeError, ConnectionAbortedError, ConnectionRefusedError and ConnectionResetError.
exception ConnectionRefusedError  
A subclass of ConnectionError, raised when a connection attempt is refused by the peer. Corresponds to errno ECONNREFUSED.
exception ConnectionResetError  
A subclass of ConnectionError, raised when a connection is reset by the peer. Corresponds to errno ECONNRESET.
Built-in Constants A small number of constants live in the built-in namespace. They are:  
False  
The false value of the bool type. Assignments to False are illegal and raise a SyntaxError. 
  
True  
The true value of the bool type. Assignments to True are illegal and raise a SyntaxError. 
  
None  
The sole value of the type NoneType. None is frequently used to represent the absence of a value, as when default arguments are not passed to a function. Assignments to None are illegal and raise a SyntaxError. 
  
NotImplemented  
Special value which should be returned by the binary special methods (e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate that the operation is not implemented with respect to the other type; may be returned by the in-place binary special methods (e.g. __imul__(), __iand__(), etc.) for the same purpose. It should not be evaluated in a boolean context.  Note When a binary (or in-place) method returns NotImplemented the interpreter will try the reflected operation on the other type (or some other fallback, depending on the operator). If all attempts return NotImplemented, the interpreter will raise an appropriate exception. Incorrectly returning NotImplemented will result in a misleading error message or the NotImplemented value being returned to Python code. See Implementing the arithmetic operations for examples.   Note NotImplementedError and NotImplemented are not interchangeable, even though they have similar names and purposes. See NotImplementedError for details on when to use it.   Changed in version 3.9: Evaluating NotImplemented in a boolean context is deprecated. While it currently evaluates as true, it will emit a DeprecationWarning. It will raise a TypeError in a future version of Python.  
  
Ellipsis  
The same as the ellipsis literal “...”. Special value used mostly in conjunction with extended slicing syntax for user-defined container data types. 
  
__debug__  
This constant is true if Python was not started with an -O option. See also the assert statement. 
  Note The names None, False, True and __debug__ cannot be reassigned (assignments to them, even as an attribute name, raise SyntaxError), so they can be considered “true” constants.  Constants added by the site module The site module (which is imported automatically during startup, except if the -S command-line option is given) adds several constants to the built-in namespace. They are useful for the interactive interpreter shell and should not be used in programs.  
quit(code=None)  
exit(code=None)  
Objects that when printed, print a message like “Use quit() or Ctrl-D (i.e. EOF) to exit”, and when called, raise SystemExit with the specified exit code. 
  
copyright  
credits  
Objects that when printed or called, print the text of copyright or credits, respectively. 
  
license  
Object that when printed, prints the message “Type license() to see the full license text”, and when called, displays the full license text in a pager-like fashion (one screen at a time).
container.__iter__()  
Return an iterator object. The object is required to support the iterator protocol described below. If a container supports different types of iteration, additional methods can be provided to specifically request iterators for those iteration types. (An example of an object supporting multiple forms of iteration would be a tree structure which supports both breadth-first and depth-first traversal.) This method corresponds to the tp_iter slot of the type structure for Python objects in the Python/C API.
class contextlib.AbstractAsyncContextManager  
An abstract base class for classes that implement object.__aenter__() and object.__aexit__(). A default implementation for object.__aenter__() is provided which returns self while object.__aexit__() is an abstract method which by default returns None. See also the definition of Asynchronous Context Managers.  New in version 3.7.
class contextlib.AbstractContextManager  
An abstract base class for classes that implement object.__enter__() and object.__exit__(). A default implementation for object.__enter__() is provided which returns self while object.__exit__() is an abstract method which by default returns None. See also the definition of Context Manager Types.  New in version 3.6.
@contextlib.asynccontextmanager  
Similar to contextmanager(), but creates an asynchronous context manager. This function is a decorator that can be used to define a factory function for async with statement asynchronous context managers, without needing to create a class or separate __aenter__() and __aexit__() methods. It must be applied to an asynchronous generator function. A simple example: from contextlib import asynccontextmanager

@asynccontextmanager
async def get_connection():
    conn = await acquire_db_connection()
    try:
        yield conn
    finally:
        await release_db_connection(conn)

async def get_all_users():
    async with get_connection() as conn:
        return conn.query('SELECT ...')
  New in version 3.7.
class contextlib.AsyncExitStack  
An asynchronous context manager, similar to ExitStack, that supports combining both synchronous and asynchronous context managers, as well as having coroutines for cleanup logic. The close() method is not implemented, aclose() must be used instead.  
enter_async_context(cm)  
Similar to enter_context() but expects an asynchronous context manager. 
  
push_async_exit(exit)  
Similar to push() but expects either an asynchronous context manager or a coroutine function. 
  
push_async_callback(callback, /, *args, **kwds)  
Similar to callback() but expects a coroutine function. 
  
aclose()  
Similar to close() but properly handles awaitables. 
 Continuing the example for asynccontextmanager(): async with AsyncExitStack() as stack:
    connections = [await stack.enter_async_context(get_connection())
        for i in range(5)]
    # All opened connections will automatically be released at the end of
    # the async with statement, even if attempts to open a connection
    # later in the list raise an exception.
  New in version 3.7.
enter_async_context(cm)  
Similar to enter_context() but expects an asynchronous context manager.
push_async_callback(callback, /, *args, **kwds)  
Similar to callback() but expects a coroutine function.
push_async_exit(exit)  
Similar to push() but expects either an asynchronous context manager or a coroutine function.
contextlib.closing(thing)  
Return a context manager that closes thing upon completion of the block. This is basically equivalent to: from contextlib import contextmanager

@contextmanager
def closing(thing):
    try:
        yield thing
    finally:
        thing.close()
 And lets you write code like this: from contextlib import closing
from urllib.request import urlopen

with closing(urlopen('http://www.python.org')) as page:
    for line in page:
        print(line)
 without needing to explicitly close page. Even if an error occurs, page.close() will be called when the with block is exited.
class contextlib.ContextDecorator  
A base class that enables a context manager to also be used as a decorator. Context managers inheriting from ContextDecorator have to implement __enter__ and __exit__ as normal. __exit__ retains its optional exception handling even when used as a decorator. ContextDecorator is used by contextmanager(), so you get this functionality automatically. Example of ContextDecorator: from contextlib import ContextDecorator

class mycontext(ContextDecorator):
    def __enter__(self):
        print('Starting')
        return self

    def __exit__(self, *exc):
        print('Finishing')
        return False

>>> @mycontext()
... def function():
...     print('The bit in the middle')
...
>>> function()
Starting
The bit in the middle
Finishing

>>> with mycontext():
...     print('The bit in the middle')
...
Starting
The bit in the middle
Finishing
 This change is just syntactic sugar for any construct of the following form: def f():
    with cm():
        # Do stuff
 ContextDecorator lets you instead write: @cm()
def f():
    # Do stuff
 It makes it clear that the cm applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too). Existing context managers that already have a base class can be extended by using ContextDecorator as a mixin class: from contextlib import ContextDecorator

class mycontext(ContextBaseClass, ContextDecorator):
    def __enter__(self):
        return self

    def __exit__(self, *exc):
        return False
  Note As the decorated function must be able to be called multiple times, the underlying context manager must support use in multiple with statements. If this is not the case, then the original construct with the explicit with statement inside the function should be used.   New in version 3.2.
@contextlib.contextmanager  
This function is a decorator that can be used to define a factory function for with statement context managers, without needing to create a class or separate __enter__() and __exit__() methods. While many objects natively support use in with statements, sometimes a resource needs to be managed that isn’t a context manager in its own right, and doesn’t implement a close() method for use with contextlib.closing An abstract example would be the following to ensure correct resource management: from contextlib import contextmanager

@contextmanager
def managed_resource(*args, **kwds):
    # Code to acquire resource, e.g.:
    resource = acquire_resource(*args, **kwds)
    try:
        yield resource
    finally:
        # Code to release resource, e.g.:
        release_resource(resource)

>>> with managed_resource(timeout=3600) as resource:
...     # Resource is released at the end of this block,
...     # even if code in the block raises an exception
 The function being decorated must return a generator-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the with statement’s as clause, if any. At the point where the generator yields, the block nested in the with statement is executed. The generator is then resumed after the block is exited. If an unhandled exception occurs in the block, it is reraised inside the generator at the point where the yield occurred. Thus, you can use a try…except…finally statement to trap the error (if any), or ensure that some cleanup takes place. If an exception is trapped merely in order to log it or to perform some action (rather than to suppress it entirely), the generator must reraise that exception. Otherwise the generator context manager will indicate to the with statement that the exception has been handled, and execution will resume with the statement immediately following the with statement. contextmanager() uses ContextDecorator so the context managers it creates can be used as decorators as well as in with statements. When used as a decorator, a new generator instance is implicitly created on each function call (this allows the otherwise “one-shot” context managers created by contextmanager() to meet the requirement that context managers support multiple invocations in order to be used as decorators).  Changed in version 3.2: Use of ContextDecorator.
callback(callback, /, *args, **kwds)  
Accepts an arbitrary callback function and arguments and adds it to the callback stack. Unlike the other methods, callbacks added this way cannot suppress exceptions (as they are never passed the exception details). The passed in callback is returned from the function, allowing this method to be used as a function decorator.
close()  
Immediately unwinds the callback stack, invoking callbacks in the reverse order of registration. For any context managers and exit callbacks registered, the arguments passed in will indicate that no exception occurred.
enter_context(cm)  
Enters a new context manager and adds its __exit__() method to the callback stack. The return value is the result of the context manager’s own __enter__() method. These context managers may suppress exceptions just as they normally would if used directly as part of a with statement.