doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
tabnanny.verbose Flag indicating whether to print verbose messages. This is incremented by the -v option if called as a script.
python.library.tabnanny#tabnanny.verbose
tarfile — Read and write tar archive files Source code: Lib/tarfile.py The tarfile module makes it possible to read and write tar archives, including those using gzip, bz2 and lzma compression. Use the zipfile module to read or write .zip files, or the higher-level functions in shutil. Some facts and figures: reads an...
python.library.tarfile
exception tarfile.CompressionError Is raised when a compression method is not supported or when the data cannot be decoded properly.
python.library.tarfile#tarfile.CompressionError
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.
python.library.tarfile#tarfile.DEFAULT_FORMAT
tarfile.ENCODING The default character encoding: 'utf-8' on Windows, the value returned by sys.getfilesystemencoding() otherwise.
python.library.tarfile#tarfile.ENCODING
exception tarfile.ExtractError Is raised for non-fatal errors when using TarFile.extract(), but only if TarFile.errorlevel== 2.
python.library.tarfile#tarfile.ExtractError
tarfile.GNU_FORMAT GNU tar format.
python.library.tarfile#tarfile.GNU_FORMAT
exception tarfile.HeaderError Is raised by TarInfo.frombuf() if the buffer it gets is invalid.
python.library.tarfile#tarfile.HeaderError
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.
python.library.tarfile#tarfile.is_tarfile
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...
python.library.tarfile#tarfile.open
tarfile.PAX_FORMAT POSIX.1-2001 (pax) format.
python.library.tarfile#tarfile.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.
python.library.tarfile#tarfile.ReadError
exception tarfile.StreamError Is raised for the limitations that are typical for stream-like TarFile objects.
python.library.tarfile#tarfile.StreamError
exception tarfile.TarError Base class for all tarfile exceptions.
python.library.tarfile#tarfile.TarError
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...
python.library.tarfile#tarfile.TarFile
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 setti...
python.library.tarfile#tarfile.TarFile.add
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().
python.library.tarfile#tarfile.TarFile.addfile
TarFile.close() Close the TarFile. In write mode, two finishing zero blocks are appended to the archive.
python.library.tarfile#tarfile.TarFile.close
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....
python.library.tarfile#tarfile.TarFile.extract
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 se...
python.library.tarfile#tarfile.TarFile.extractall
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. ...
python.library.tarfile#tarfile.TarFile.extractfile
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.
python.library.tarfile#tarfile.TarFile.getmember
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.
python.library.tarfile#tarfile.TarFile.getmembers
TarFile.getnames() Return the members as a list of their names. It has the same order as the list returned by getmembers().
python.library.tarfile#tarfile.TarFile.getnames
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 n...
python.library.tarfile#tarfile.TarFile.gettarinfo
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...
python.library.tarfile#tarfile.TarFile.list
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.
python.library.tarfile#tarfile.TarFile.next
classmethod TarFile.open(...) Alternative constructor. The tarfile.open() function is actually a shortcut to this classmethod.
python.library.tarfile#tarfile.TarFile.open
TarFile.pax_headers A dictionary containing key-value pairs of pax global headers.
python.library.tarfile#tarfile.TarFile.pax_headers
class tarfile.TarInfo(name="") Create a TarInfo object.
python.library.tarfile#tarfile.TarInfo
classmethod TarInfo.frombuf(buf, encoding, errors) Create and return a TarInfo object from string buffer buf. Raises HeaderError if the buffer is invalid.
python.library.tarfile#tarfile.TarInfo.frombuf
classmethod TarInfo.fromtarfile(tarfile) Read the next member from the TarFile object tarfile and return it as a TarInfo object.
python.library.tarfile#tarfile.TarInfo.fromtarfile
TarInfo.gid Group ID of the user who originally stored this member.
python.library.tarfile#tarfile.TarInfo.gid
TarInfo.gname Group name.
python.library.tarfile#tarfile.TarInfo.gname
TarInfo.isblk() Return True if it is a block device.
python.library.tarfile#tarfile.TarInfo.isblk
TarInfo.ischr() Return True if it is a character device.
python.library.tarfile#tarfile.TarInfo.ischr
TarInfo.isdev() Return True if it is one of character device, block device or FIFO.
python.library.tarfile#tarfile.TarInfo.isdev
TarInfo.isdir() Return True if it is a directory.
python.library.tarfile#tarfile.TarInfo.isdir
TarInfo.isfifo() Return True if it is a FIFO.
python.library.tarfile#tarfile.TarInfo.isfifo
TarInfo.isfile() Return True if the Tarinfo object is a regular file.
python.library.tarfile#tarfile.TarInfo.isfile
TarInfo.islnk() Return True if it is a hard link.
python.library.tarfile#tarfile.TarInfo.islnk
TarInfo.isreg() Same as isfile().
python.library.tarfile#tarfile.TarInfo.isreg
TarInfo.issym() Return True if it is a symbolic link.
python.library.tarfile#tarfile.TarInfo.issym
TarInfo.linkname Name of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.
python.library.tarfile#tarfile.TarInfo.linkname
TarInfo.mode Permission bits.
python.library.tarfile#tarfile.TarInfo.mode
TarInfo.mtime Time of last modification.
python.library.tarfile#tarfile.TarInfo.mtime
TarInfo.name Name of the archive member.
python.library.tarfile#tarfile.TarInfo.name
TarInfo.pax_headers A dictionary containing key-value pairs of an associated pax extended header.
python.library.tarfile#tarfile.TarInfo.pax_headers
TarInfo.size Size in bytes.
python.library.tarfile#tarfile.TarInfo.size
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.
python.library.tarfile#tarfile.TarInfo.tobuf
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.
python.library.tarfile#tarfile.TarInfo.type
TarInfo.uid User ID of the user who originally stored this member.
python.library.tarfile#tarfile.TarInfo.uid
TarInfo.uname User name.
python.library.tarfile#tarfile.TarInfo.uname
tarfile.USTAR_FORMAT POSIX.1-1988 (ustar) format.
python.library.tarfile#tarfile.USTAR_FORMAT
telnetlib — Telnet client Source code: Lib/telnetlib.py The telnetlib module provides a Telnet class that implements the Telnet protocol. See RFC 854 for details about the protocol. In addition, it provides symbolic constants for the protocol characters (see below), and for the telnet options. The symbolic names of the...
python.library.telnetlib
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 cas...
python.library.telnetlib#telnetlib.Telnet
Telnet.close() Close the connection.
python.library.telnetlib#telnetlib.Telnet.close
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 ...
python.library.telnetlib#telnetlib.Telnet.expect
Telnet.fileno() Return the file descriptor of the socket object used internally.
python.library.telnetlib#telnetlib.Telnet.fileno
Telnet.get_socket() Return the socket object used internally.
python.library.telnetlib#telnetlib.Telnet.get_socket
Telnet.interact() Interaction function, emulates a very dumb Telnet client.
python.library.telnetlib#telnetlib.Telnet.interact
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.
python.library.telnetlib#telnetlib.Telnet.msg
Telnet.mt_interact() Multithreaded version of interact().
python.library.telnetlib#telnetlib.Telnet.mt_interact
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 sett...
python.library.telnetlib#telnetlib.Telnet.open
Telnet.read_all() Read all data until EOF as bytes; block until connection closed.
python.library.telnetlib#telnetlib.Telnet.read_all
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.
python.library.telnetlib#telnetlib.Telnet.read_eager
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.
python.library.telnetlib#telnetlib.Telnet.read_lazy
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.
python.library.telnetlib#telnetlib.Telnet.read_sb_data
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.
python.library.telnetlib#telnetlib.Telnet.read_some
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.
python.library.telnetlib#telnetlib.Telnet.read_until
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.
python.library.telnetlib#telnetlib.Telnet.read_very_eager
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.
python.library.telnetlib#telnetlib.Telnet.read_very_lazy
Telnet.set_debuglevel(debuglevel) Set the debug level. The higher the value of debuglevel, the more debug output you get (on sys.stdout).
python.library.telnetlib#telnetlib.Telnet.set_debuglevel
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.
python.library.telnetlib#telnetlib.Telnet.set_option_negotiation_callback
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,...
python.library.telnetlib#telnetlib.Telnet.write
tempfile — Generate temporary files and directories Source code: Lib/tempfile.py This module creates temporary files and directories. It works on all supported platforms. TemporaryFile, NamedTemporaryFile, TemporaryDirectory, and SpooledTemporaryFile are high-level interfaces which provide automatic cleanup and can be ...
python.library.tempfile
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 e...
python.library.tempfile#tempfile.gettempdir
tempfile.gettempdirb() Same as gettempdir() but the return value is in bytes. New in version 3.5.
python.library.tempfile#tempfile.gettempdirb
tempfile.gettempprefix() Return the filename prefix used to create temporary files. This does not contain the directory component.
python.library.tempfile#tempfile.gettempprefix
tempfile.gettempprefixb() Same as gettempprefix() but the return value is in bytes. New in version 3.5.
python.library.tempfile#tempfile.gettempprefixb
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 tempo...
python.library.tempfile#tempfile.mkdtemp
tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False) Creates a temporary file in the most secure manner possible. There are no race conditions in the file’s creation, assuming that the platform properly implements the os.O_EXCL flag for os.open(). The file is readable and writable only by the creating use...
python.library.tempfile#tempfile.mkstemp
tempfile.mktemp(suffix='', prefix='tmp', dir=None) Deprecated since version 2.3: Use mkstemp() instead. Return an absolute pathname of a file that did not exist at the time the call is made. The prefix, suffix, and dir arguments are similar to those of mkstemp(), except that bytes file names, suffix=None and prefix...
python.library.tempfile#tempfile.mktemp
tempfile.NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True, *, errors=None) This function operates exactly as TemporaryFile() does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not ...
python.library.tempfile#tempfile.NamedTemporaryFile
tempfile.SpooledTemporaryFile(max_size=0, mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None) This function operates exactly as TemporaryFile() does, except that data is spooled in memory until the file size exceeds max_size, or until the file’s fileno() method i...
python.library.tempfile#tempfile.SpooledTemporaryFile
tempfile.tempdir When set to a value other than None, this variable defines the default value for the dir argument to the functions defined in this module. If tempdir is None (the default) at any call to any of the above functions except gettempprefix() it is initialized following the algorithm described in gettempdi...
python.library.tempfile#tempfile.tempdir
tempfile.TemporaryDirectory(suffix=None, prefix=None, dir=None) This function securely creates a temporary directory using the same rules as mkdtemp(). The resulting object can be used as a context manager (see Examples). On completion of the context or destruction of the temporary directory object the newly created ...
python.library.tempfile#tempfile.TemporaryDirectory
tempfile.TemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None) Return a file-like object that can be used as a temporary storage area. The file is created securely, using the same rules as mkstemp(). It will be destroyed as soon as it is closed (inclu...
python.library.tempfile#tempfile.TemporaryFile
termios — POSIX style tty control This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see termios(3) Unix manual page. It is only available for those Unix versions that support POSIX termios style tty I/O control configured during installation. All functi...
python.library.termios
termios.tcdrain(fd) Wait until all output written to file descriptor fd has been transmitted.
python.library.termios#termios.tcdrain
termios.tcflow(fd, action) Suspend or resume input or output on file descriptor fd. The action argument can be TCOOFF to suspend output, TCOON to restart output, TCIOFF to suspend input, or TCION to restart input.
python.library.termios#termios.tcflow
termios.tcflush(fd, queue) Discard queued data on file descriptor fd. The queue selector specifies which queue: TCIFLUSH for the input queue, TCOFLUSH for the output queue, or TCIOFLUSH for both queues.
python.library.termios#termios.tcflush
termios.tcgetattr(fd) Return a list containing the tty attributes for file descriptor fd, as follows: [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list of the tty special characters (each a string of length 1, except the items with indices VMIN and VTIME, which are integers when these fields are def...
python.library.termios#termios.tcgetattr
termios.tcsendbreak(fd, duration) Send a break on file descriptor fd. A zero duration sends a break for 0.25–0.5 seconds; a nonzero duration has a system dependent meaning.
python.library.termios#termios.tcsendbreak
termios.tcsetattr(fd, when, attributes) Set the tty attributes for file descriptor fd from the attributes, which is a list like the one returned by tcgetattr(). The when argument determines when the attributes are changed: TCSANOW to change immediately, TCSADRAIN to change after transmitting all queued output, or TCS...
python.library.termios#termios.tcsetattr
test — Regression tests package for Python Note The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s standard library is discouraged as code mentioned here can change or be removed without notice betwee...
python.library.test
test.support.ALWAYS_EQ Object that is equal to anything. Used to test mixed type comparison.
python.library.test#test.support.ALWAYS_EQ
@test.support.anticipate_failure(condition) A decorator to conditionally mark tests with unittest.expectedFailure(). Any use of this decorator should have an associated comment identifying the relevant tracker issue.
python.library.test#test.support.anticipate_failure
test.support.args_from_interpreter_flags() Return a list of command line arguments reproducing the current settings in sys.flags and sys.warnoptions.
python.library.test#test.support.args_from_interpreter_flags
class test.support.BasicTestRunner run(test) Run test and return the result.
python.library.test#test.support.BasicTestRunner