neulab/docprompting-conala huggingface dataset:
tabnanny — Detection of ambiguous indentation Source code: Lib/tabnanny.py For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() described below.  Note The API provided by this module is likely to change in future releases; such changes may not be backward compatible.   
tabnanny.check(file_or_dir)  
If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The diagnostic messages are written to standard output using the print() function. 
  
tabnanny.verbose  
Flag indicating whether to print verbose messages. This is incremented by the -v option if called as a script. 
  
tabnanny.filename_only  
Flag indicating whether to print only the filenames of files containing whitespace related problems. This is set to true by the -q option if called as a script. 
  
exception tabnanny.NannyNag  
Raised by process_tokens() if detecting an ambiguous indent. Captured and handled in check(). 
  
tabnanny.process_tokens(tokens)  
This function is used by check() to process tokens generated by the tokenize module. 
  See also  
Module tokenize


Lexical scanner for Python source code.
tabnanny.check(file_or_dir)  
If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is checked for whitespace related problems. The diagnostic messages are written to standard output using the print() function.
tabnanny.filename_only  
Flag indicating whether to print only the filenames of files containing whitespace related problems. This is set to true by the -q option if called as a script.
exception tabnanny.NannyNag  
Raised by process_tokens() if detecting an ambiguous indent. Captured and handled in check().
tabnanny.process_tokens(tokens)  
This function is used by check() to process tokens generated by the tokenize module.
tabnanny.verbose  
Flag indicating whether to print verbose messages. This is incremented by the -v option if called as a script.
exception tarfile.CompressionError  
Is raised when a compression method is not supported or when the data cannot be decoded properly.
tarfile.DEFAULT_FORMAT  
The default format for creating archives. This is currently PAX_FORMAT.  Changed in version 3.8: The default format for new archives was changed to PAX_FORMAT from GNU_FORMAT.
tarfile.ENCODING  
The default character encoding: 'utf-8' on Windows, the value returned by sys.getfilesystemencoding() otherwise.
exception tarfile.ExtractError  
Is raised for non-fatal errors when using TarFile.extract(), but only if TarFile.errorlevel== 2.
exception tarfile.HeaderError  
Is raised by TarInfo.frombuf() if the buffer it gets is invalid.
tarfile.is_tarfile(name)  
Return True if name is a tar archive file, that the tarfile module can read. name may be a str, file, or file-like object.  Changed in version 3.9: Support for file and file-like objects.
tarfile.open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)  
Return a TarFile object for the pathname name. For detailed information on TarFile objects and the keyword arguments that are allowed, see TarFile Objects. mode has to be a string of the form 'filemode[:compression]', it defaults to 'r'. Here is a full list of mode combinations:   
mode action   
'r' or 'r:*' Open for reading with transparent compression (recommended).  
'r:' Open for reading exclusively without compression.  
'r:gz' Open for reading with gzip compression.  
'r:bz2' Open for reading with bzip2 compression.  
'r:xz' Open for reading with lzma compression.  
'x' or 'x:' Create a tarfile exclusively without compression. Raise an FileExistsError exception if it already exists.  
'x:gz' Create a tarfile with gzip compression. Raise an FileExistsError exception if it already exists.  
'x:bz2' Create a tarfile with bzip2 compression. Raise an FileExistsError exception if it already exists.  
'x:xz' Create a tarfile with lzma compression. Raise an FileExistsError exception if it already exists.  
'a' or 'a:' Open for appending with no compression. The file is created if it does not exist.  
'w' or 'w:' Open for uncompressed writing.  
'w:gz' Open for gzip compressed writing.  
'w:bz2' Open for bzip2 compressed writing.  
'w:xz' Open for lzma compressed writing.   Note that 'a:gz', 'a:bz2' or 'a:xz' is not possible. If mode is not suitable to open a certain (compressed) file for reading, ReadError is raised. Use mode 'r' to avoid this. If a compression method is not supported, CompressionError is raised. If fileobj is specified, it is used as an alternative to a file object opened in binary mode for name. It is supposed to be at position 0. For modes 'w:gz', 'r:gz', 'w:bz2', 'r:bz2', 'x:gz', 'x:bz2', tarfile.open() accepts the keyword argument compresslevel (default 9) to specify the compression level of the file. For special purposes, there is a second format for mode: 'filemode|[compression]'. tarfile.open() will return a TarFile object that processes its data as a stream of blocks. No random seeking will be done on the file. If given, fileobj may be any object that has a read() or write() method (depending on the mode). bufsize specifies the blocksize and defaults to 20 * 512 bytes. Use this variant in combination with e.g. sys.stdin, a socket file object or a tape device. However, such a TarFile object is limited in that it does not allow random access, see Examples. The currently possible modes:   
Mode Action   
'r|*' Open a stream of tar blocks for reading with transparent compression.  
'r|' Open a stream of uncompressed tar blocks for reading.  
'r|gz' Open a gzip compressed stream for reading.  
'r|bz2' Open a bzip2 compressed stream for reading.  
'r|xz' Open an lzma compressed stream for reading.  
'w|' Open an uncompressed stream for writing.  
'w|gz' Open a gzip compressed stream for writing.  
'w|bz2' Open a bzip2 compressed stream for writing.  
'w|xz' Open an lzma compressed stream for writing.    Changed in version 3.5: The 'x' (exclusive creation) mode was added.   Changed in version 3.6: The name parameter accepts a path-like object.
tarfile.PAX_FORMAT  
POSIX.1-2001 (pax) format.
exception tarfile.ReadError  
Is raised when a tar archive is opened, that either cannot be handled by the tarfile module or is somehow invalid.
exception tarfile.StreamError  
Is raised for the limitations that are typical for stream-like TarFile objects.
class tarfile.TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=ENCODING, errors='surrogateescape', pax_headers=None, debug=0, errorlevel=0)  
All following arguments are optional and can be accessed as instance attributes as well. name is the pathname of the archive. name may be a path-like object. It can be omitted if fileobj is given. In this case, the file object’s name attribute is used if it exists. mode is either 'r' to read from an existing archive, 'a' to append data to an existing file, 'w' to create a new file overwriting an existing one, or 'x' to create a new file only if it does not already exist. If fileobj is given, it is used for reading or writing data. If it can be determined, mode is overridden by fileobj’s mode. fileobj will be used from position 0.  Note fileobj is not closed, when TarFile is closed.  format controls the archive format for writing. It must be one of the constants USTAR_FORMAT, GNU_FORMAT or PAX_FORMAT that are defined at module level. When reading, format will be automatically detected, even if different formats are present in a single archive. The tarinfo argument can be used to replace the default TarInfo class with a different one. If dereference is False, add symbolic and hard links to the archive. If it is True, add the content of the target files to the archive. This has no effect on systems that do not support symbolic links. If ignore_zeros is False, treat an empty block as the end of the archive. If it is True, skip empty (and invalid) blocks and try to get as many members as possible. This is only useful for reading concatenated or damaged archives. debug can be set from 0 (no debug messages) up to 3 (all debug messages). The messages are written to sys.stderr. If errorlevel is 0, all errors are ignored when using TarFile.extract(). Nevertheless, they appear as error messages in the debug output, when debugging is enabled. If 1, all fatal errors are raised as OSError exceptions. If 2, all non-fatal errors are raised as TarError exceptions as well. The encoding and errors arguments define the character encoding to be used for reading or writing the archive and how conversion errors are going to be handled. The default settings will work for most users. See section Unicode issues for in-depth information. The pax_headers argument is an optional dictionary of strings which will be added as a pax global header if format is PAX_FORMAT.  Changed in version 3.2: Use 'surrogateescape' as the default for the errors argument.   Changed in version 3.5: The 'x' (exclusive creation) mode was added.   Changed in version 3.6: The name parameter accepts a path-like object.
TarFile.add(name, arcname=None, recursive=True, *, filter=None)  
Add the file name to the archive. name may be any type of file (directory, fifo, symbolic link, etc.). If given, arcname specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting recursive to False. Recursion adds entries in sorted order. If filter is given, it should be a function that takes a TarInfo object argument and returns the changed TarInfo object. If it instead returns None the TarInfo object will be excluded from the archive. See Examples for an example.  Changed in version 3.2: Added the filter parameter.   Changed in version 3.7: Recursion adds entries in sorted order.
TarFile.addfile(tarinfo, fileobj=None)  
Add the TarInfo object tarinfo to the archive. If fileobj is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo().
TarFile.close()  
Close the TarFile. In write mode, two finishing zero blocks are appended to the archive.
TarFile.extract(member, path="", set_attrs=True, *, numeric_owner=False)  
Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. member may be a filename or a TarInfo object. You can specify a different directory using path. path may be a path-like object. File attributes (owner, mtime, mode) are set unless set_attrs is false. If numeric_owner is True, the uid and gid numbers from the tarfile are used to set the owner/group for the extracted files. Otherwise, the named values from the tarfile are used.  Note The extract() method does not take care of several extraction issues. In most cases you should consider using the extractall() method.   Warning See the warning for extractall().   Changed in version 3.2: Added the set_attrs parameter.   Changed in version 3.5: Added the numeric_owner parameter.   Changed in version 3.6: The path parameter accepts a path-like object.
TarFile.extractall(path=".", members=None, *, numeric_owner=False)  
Extract all members from the archive to the current working directory or directory path. If optional members is given, it must be a subset of the list returned by getmembers(). Directory information like owner, modification time and permissions are set after all members have been extracted. This is done to work around two problems: A directory’s modification time is reset each time a file is created in it. And, if a directory’s permissions do not allow writing, extracting files to it will fail. If numeric_owner is True, the uid and gid numbers from the tarfile are used to set the owner/group for the extracted files. Otherwise, the named values from the tarfile are used.  Warning Never extract archives from untrusted sources without prior inspection. It is possible that files are created outside of path, e.g. members that have absolute filenames starting with "/" or filenames with two dots "..".   Changed in version 3.5: Added the numeric_owner parameter.   Changed in version 3.6: The path parameter accepts a path-like object.
TarFile.extractfile(member)  
Extract a member from the archive as a file object. member may be a filename or a TarInfo object. If member is a regular file or a link, an io.BufferedReader object is returned. For all other existing members, None is returned. If member does not appear in the archive, KeyError is raised.  Changed in version 3.3: Return an io.BufferedReader object.
TarFile.getmember(name)  
Return a TarInfo object for member name. If name can not be found in the archive, KeyError is raised.  Note If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version.
TarFile.getmembers()  
Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive.
TarFile.getnames()  
Return the members as a list of their names. It has the same order as the list returned by getmembers().
TarFile.gettarinfo(name=None, arcname=None, fileobj=None)  
Create a TarInfo object from the result of os.stat() or equivalent on an existing file. The file is either named by name, or specified as a file object fileobj with a file descriptor. name may be a path-like object. If given, arcname specifies an alternative name for the file in the archive, otherwise, the name is taken from fileobj’s name attribute, or the name argument. The name should be a text string. You can modify some of the TarInfo’s attributes before you add it using addfile(). If the file object is not an ordinary file object positioned at the beginning of the file, attributes such as size may need modifying. This is the case for objects such as GzipFile. The name may also be modified, in which case arcname could be a dummy string.  Changed in version 3.6: The name parameter accepts a path-like object.
TarFile.list(verbose=True, *, members=None)  
Print a table of contents to sys.stdout. If verbose is False, only the names of the members are printed. If it is True, output similar to that of ls -l is produced. If optional members is given, it must be a subset of the list returned by getmembers().  Changed in version 3.5: Added the members parameter.
TarFile.next()  
Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available.
classmethod TarFile.open(...)  
Alternative constructor. The tarfile.open() function is actually a shortcut to this classmethod.
TarFile.pax_headers  
A dictionary containing key-value pairs of pax global headers.
classmethod TarInfo.frombuf(buf, encoding, errors)  
Create and return a TarInfo object from string buffer buf. Raises HeaderError if the buffer is invalid.
classmethod TarInfo.fromtarfile(tarfile)  
Read the next member from the TarFile object tarfile and return it as a TarInfo object.
TarInfo.isdev()  
Return True if it is one of character device, block device or FIFO.
TarInfo.isfile()  
Return True if the Tarinfo object is a regular file.
TarInfo.linkname  
Name of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.
TarInfo.pax_headers  
A dictionary containing key-value pairs of an associated pax extended header.
TarInfo.tobuf(format=DEFAULT_FORMAT, encoding=ENCODING, errors='surrogateescape')  
Create a string buffer from a TarInfo object. For information on the arguments see the constructor of the TarFile class.  Changed in version 3.2: Use 'surrogateescape' as the default for the errors argument.
TarInfo.type  
File type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE. To determine the type of a TarInfo object more conveniently, use the is*() methods below.
tarfile.USTAR_FORMAT  
POSIX.1-1988 (ustar) format.
class telnetlib.Telnet(host=None, port=0[, timeout])  
Telnet represents a connection to a Telnet server. The instance is initially not connected by default; the open() method must be used to establish a connection. Alternatively, the host name and optional port number can be passed to the constructor too, in which case the connection to the server will be established before the constructor returns. The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). Do not reopen an already connected instance. This class has many read_*() methods. Note that some of them raise EOFError when the end of the connection is read, because they can return an empty string for other reasons. See the individual descriptions below. A Telnet object is a context manager and can be used in a with statement. When the with block ends, the close() method is called: >>> from telnetlib import Telnet
>>> with Telnet('localhost', 23) as tn:
...     tn.interact()
...
  Changed in version 3.6: Context manager support added
Telnet.expect(list, timeout=None)  
Read until one from a list of a regular expressions matches. The first argument is a list of regular expressions, either compiled (regex objects) or uncompiled (byte strings). The optional second argument is a timeout, in seconds; the default is to block indefinitely. Return a tuple of three items: the index in the list of the first regular expression that matches; the match object returned; and the bytes read up till and including the match. If end of file is found and no bytes were read, raise EOFError. Otherwise, when nothing matches, return (-1, None, data) where data is the bytes received so far (may be empty bytes if a timeout happened). If a regular expression ends with a greedy match (such as .*) or if more than one expression can match the same input, the results are non-deterministic, and may depend on the I/O timing.
Telnet.interact()  
Interaction function, emulates a very dumb Telnet client.
Telnet.msg(msg, *args)  
Print a debug message when the debug level is > 0. If extra arguments are present, they are substituted in the message using the standard string formatting operator.
Telnet.open(host, port=0[, timeout])  
Connect to a host. The optional second argument is the port number, which defaults to the standard Telnet port (23). The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). Do not try to reopen an already connected instance. Raises an auditing event telnetlib.Telnet.open with arguments self, host, port.
Telnet.read_all()  
Read all data until EOF as bytes; block until connection closed.
Telnet.read_eager()  
Read readily available data. Raise EOFError if connection closed and no cooked data available. Return b'' if no cooked data available otherwise. Do not block unless in the midst of an IAC sequence.
Telnet.read_lazy()  
Process and return data already in the queues (lazy). Raise EOFError if connection closed and no data available. Return b'' if no cooked data available otherwise. Do not block unless in the midst of an IAC sequence.
Telnet.read_sb_data()  
Return the data collected between a SB/SE pair (suboption begin/end). The callback should access these data when it was invoked with a SE command. This method never blocks.
Telnet.read_some()  
Read at least one byte of cooked data unless EOF is hit. Return b'' if EOF is hit. Block if no data is immediately available.
Telnet.read_until(expected, timeout=None)  
Read until a given byte string, expected, is encountered or until timeout seconds have passed. When no match is found, return whatever is available instead, possibly empty bytes. Raise EOFError if the connection is closed and no cooked data is available.
Telnet.read_very_eager()  
Read everything that can be without blocking in I/O (eager). Raise EOFError if connection closed and no cooked data available. Return b'' if no cooked data available otherwise. Do not block unless in the midst of an IAC sequence.
Telnet.read_very_lazy()  
Return any data available in the cooked queue (very lazy). Raise EOFError if connection closed and no data available. Return b'' if no cooked data available otherwise. This method never blocks.
Telnet.set_debuglevel(debuglevel)  
Set the debug level. The higher the value of debuglevel, the more debug output you get (on sys.stdout).
Telnet.set_option_negotiation_callback(callback)  
Each time a telnet option is read on the input flow, this callback (if set) is called with the following parameters: callback(telnet socket, command (DO/DONT/WILL/WONT), option). No other action is done afterwards by telnetlib.
Telnet.write(buffer)  
Write a byte string to the socket, doubling any IAC characters. This can block if the connection is blocked. May raise OSError if the connection is closed. Raises an auditing event telnetlib.Telnet.write with arguments self, buffer.  Changed in version 3.3: This method used to raise socket.error, which is now an alias of OSError.
tempfile.gettempdir()  
Return the name of the directory used for temporary files. This defines the default value for the dir argument to all functions in this module. Python searches a standard list of directories to find one which the calling user can create files in. The list is:  The directory named by the TMPDIR environment variable. The directory named by the TEMP environment variable. The directory named by the TMP environment variable. 
A platform-specific location:  On Windows, the directories C:\TEMP, C:\TMP, \TEMP, and \TMP, in that order. On all other platforms, the directories /tmp, /var/tmp, and /usr/tmp, in that order.   As a last resort, the current working directory.  The result of this search is cached, see the description of tempdir below.
tempfile.gettempdirb()  
Same as gettempdir() but the return value is in bytes.  New in version 3.5.
tempfile.gettempprefix()  
Return the filename prefix used to create temporary files. This does not contain the directory component.
tempfile.gettempprefixb()  
Same as gettempprefix() but the return value is in bytes.  New in version 3.5.
tempfile.mkdtemp(suffix=None, prefix=None, dir=None)  
Creates a temporary directory in the most secure manner possible. There are no race conditions in the directory’s creation. The directory is readable, writable, and searchable only by the creating user ID. The user of mkdtemp() is responsible for deleting the temporary directory and its contents when done with it. The prefix, suffix, and dir arguments are the same as for mkstemp(). mkdtemp() returns the absolute pathname of the new directory. Raises an auditing event tempfile.mkdtemp with argument fullpath.  Changed in version 3.5: suffix, prefix, and dir may now be supplied in bytes in order to obtain a bytes return value. Prior to this, only str was allowed. suffix and prefix now accept and default to None to cause an appropriate default value to be used.   Changed in version 3.6: The dir parameter now accepts a path-like object.