doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
faulthandler.enable(file=sys.stderr, all_threads=True)
Enable the fault handler: install handlers for the SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals to dump the Python traceback. If all_threads is True, produce tracebacks for every running thread. Otherwise, dump only the current thread. The file must be kep... | python.library.faulthandler#faulthandler.enable |
faulthandler.is_enabled()
Check if the fault handler is enabled. | python.library.faulthandler#faulthandler.is_enabled |
faulthandler.register(signum, file=sys.stderr, all_threads=True, chain=False)
Register a user signal: install a handler for the signum signal to dump the traceback of all threads, or of the current thread if all_threads is False, into file. Call the previous handler if chain is True. The file must be kept open until ... | python.library.faulthandler#faulthandler.register |
faulthandler.unregister(signum)
Unregister a user signal: uninstall the handler of the signum signal installed by register(). Return True if the signal was registered, False otherwise. Not available on Windows. | python.library.faulthandler#faulthandler.unregister |
fcntl — The fcntl and ioctl system calls This module performs file control and I/O control on file descriptors. It is an interface to the fcntl() and ioctl() Unix routines. For a complete description of these calls, see fcntl(2) and ioctl(2) Unix manual pages. All functions in this module take a file descriptor fd as t... | python.library.fcntl |
fcntl.fcntl(fd, cmd, arg=0)
Perform the operation cmd on file descriptor fd (file objects providing a fileno() method are accepted as well). The values used for cmd are operating system dependent, and are available as constants in the fcntl module, using the same names as used in the relevant C header files. The argu... | python.library.fcntl#fcntl.fcntl |
fcntl.flock(fd, operation)
Perform the lock operation operation on file descriptor fd (file objects providing a fileno() method are accepted as well). See the Unix manual flock(2) for details. (On some systems, this function is emulated using fcntl().) If the flock() fails, an OSError exception is raised. Raises an a... | python.library.fcntl#fcntl.flock |
fcntl.ioctl(fd, request, arg=0, mutate_flag=True)
This function is identical to the fcntl() function, except that the argument handling is even more complicated. The request parameter is limited to values that can fit in 32-bits. Additional constants of interest for use as the request argument can be found in the ter... | python.library.fcntl#fcntl.ioctl |
fcntl.lockf(fd, cmd, len=0, start=0, whence=0)
This is essentially a wrapper around the fcntl() locking calls. fd is the file descriptor (file objects providing a fileno() method are accepted as well) of the file to lock or unlock, and cmd is one of the following values:
LOCK_UN – unlock
LOCK_SH – acquire a shared... | python.library.fcntl#fcntl.lockf |
filecmp — File and Directory Comparisons Source code: Lib/filecmp.py The filecmp module defines functions to compare files and directories, with various optional time/correctness trade-offs. For comparing files, see also the difflib module. The filecmp module defines the following functions:
filecmp.cmp(f1, f2, shall... | python.library.filecmp |
filecmp.clear_cache()
Clear the filecmp cache. This may be useful if a file is compared so quickly after it is modified that it is within the mtime resolution of the underlying filesystem. New in version 3.4. | python.library.filecmp#filecmp.clear_cache |
filecmp.cmp(f1, f2, shallow=True)
Compare the files named f1 and f2, returning True if they seem equal, False otherwise. If shallow is true, files with identical os.stat() signatures are taken to be equal. Otherwise, the contents of the files are compared. Note that no external programs are called from this function,... | python.library.filecmp#filecmp.cmp |
filecmp.cmpfiles(dir1, dir2, common, shallow=True)
Compare the files in the two directories dir1 and dir2 whose names are given by common. Returns three lists of file names: match, mismatch, errors. match contains the list of files that match, mismatch contains the names of those that don’t, and errors lists the name... | python.library.filecmp#filecmp.cmpfiles |
filecmp.DEFAULT_IGNORES
New in version 3.4. List of directories ignored by dircmp by default. | python.library.filecmp#filecmp.DEFAULT_IGNORES |
class filecmp.dircmp(a, b, ignore=None, hide=None)
Construct a new directory comparison object, to compare the directories a and b. ignore is a list of names to ignore, and defaults to filecmp.DEFAULT_IGNORES. hide is a list of names to hide, and defaults to [os.curdir, os.pardir]. The dircmp class compares files by ... | python.library.filecmp#filecmp.dircmp |
common
Files and subdirectories in both a and b. | python.library.filecmp#filecmp.dircmp.common |
common_dirs
Subdirectories in both a and b. | python.library.filecmp#filecmp.dircmp.common_dirs |
common_files
Files in both a and b. | python.library.filecmp#filecmp.dircmp.common_files |
common_funny
Names in both a and b, such that the type differs between the directories, or names for which os.stat() reports an error. | python.library.filecmp#filecmp.dircmp.common_funny |
diff_files
Files which are in both a and b, whose contents differ according to the class’s file comparison operator. | python.library.filecmp#filecmp.dircmp.diff_files |
funny_files
Files which are in both a and b, but could not be compared. | python.library.filecmp#filecmp.dircmp.funny_files |
left
The directory a. | python.library.filecmp#filecmp.dircmp.left |
left_list
Files and subdirectories in a, filtered by hide and ignore. | python.library.filecmp#filecmp.dircmp.left_list |
left_only
Files and subdirectories only in a. | python.library.filecmp#filecmp.dircmp.left_only |
report()
Print (to sys.stdout) a comparison between a and b. | python.library.filecmp#filecmp.dircmp.report |
report_full_closure()
Print a comparison between a and b and common subdirectories (recursively). | python.library.filecmp#filecmp.dircmp.report_full_closure |
report_partial_closure()
Print a comparison between a and b and common immediate subdirectories. | python.library.filecmp#filecmp.dircmp.report_partial_closure |
right
The directory b. | python.library.filecmp#filecmp.dircmp.right |
right_list
Files and subdirectories in b, filtered by hide and ignore. | python.library.filecmp#filecmp.dircmp.right_list |
right_only
Files and subdirectories only in b. | python.library.filecmp#filecmp.dircmp.right_only |
same_files
Files which are identical in both a and b, using the class’s file comparison operator. | python.library.filecmp#filecmp.dircmp.same_files |
subdirs
A dictionary mapping names in common_dirs to dircmp objects. | python.library.filecmp#filecmp.dircmp.subdirs |
exception FileExistsError
Raised when trying to create a file or directory which already exists. Corresponds to errno EEXIST. | python.library.exceptions#FileExistsError |
fileinput — Iterate over lines from multiple input streams Source code: Lib/fileinput.py This module implements a helper class and functions to quickly write a loop over standard input or a list of files. If you just want to read or write one file see open(). The typical use is: import fileinput
for line in fileinput.i... | python.library.fileinput |
fileinput.close()
Close the sequence. | python.library.fileinput#fileinput.close |
class fileinput.FileInput(files=None, inplace=False, backup='', *, mode='r', openhook=None)
Class FileInput is the implementation; its methods filename(), fileno(), lineno(), filelineno(), isfirstline(), isstdin(), nextfile() and close() correspond to the functions of the same name in the module. In addition it has a... | python.library.fileinput#fileinput.FileInput |
fileinput.filelineno()
Return the line number in the current file. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line within the file. | python.library.fileinput#fileinput.filelineno |
fileinput.filename()
Return the name of the file currently being read. Before the first line has been read, returns None. | python.library.fileinput#fileinput.filename |
fileinput.fileno()
Return the integer “file descriptor” for the current file. When no file is opened (before the first line and between files), returns -1. | python.library.fileinput#fileinput.fileno |
fileinput.hook_compressed(filename, mode)
Transparently opens files compressed with gzip and bzip2 (recognized by the extensions '.gz' and '.bz2') using the gzip and bz2 modules. If the filename extension is not '.gz' or '.bz2', the file is opened normally (ie, using open() without any decompression). Usage example: ... | python.library.fileinput#fileinput.hook_compressed |
fileinput.hook_encoded(encoding, errors=None)
Returns a hook which opens each file with open(), using the given encoding and errors to read the file. Usage example: fi =
fileinput.FileInput(openhook=fileinput.hook_encoded("utf-8",
"surrogateescape")) Changed in version 3.6: Added the optional errors parameter. | python.library.fileinput#fileinput.hook_encoded |
fileinput.input(files=None, inplace=False, backup='', *, mode='r', openhook=None)
Create an instance of the FileInput class. The instance will be used as global state for the functions of this module, and is also returned to use during iteration. The parameters to this function will be passed along to the constructor... | python.library.fileinput#fileinput.input |
fileinput.isfirstline()
Return True if the line just read is the first line of its file, otherwise return False. | python.library.fileinput#fileinput.isfirstline |
fileinput.isstdin()
Return True if the last line was read from sys.stdin, otherwise return False. | python.library.fileinput#fileinput.isstdin |
fileinput.lineno()
Return the cumulative line number of the line that has just been read. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line. | python.library.fileinput#fileinput.lineno |
fileinput.nextfile()
Close the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count. The filename is not changed until after the first line of the next file has been read. Before the first line has b... | python.library.fileinput#fileinput.nextfile |
exception FileNotFoundError
Raised when a file or directory is requested but doesn’t exist. Corresponds to errno ENOENT. | python.library.exceptions#FileNotFoundError |
filter(function, iterable)
Construct an iterator from those elements of iterable for which function returns true. iterable may be either a sequence, a container which supports iteration, or an iterator. If function is None, the identity function is assumed, that is, all elements of iterable that are false are removed... | python.library.functions#filter |
class float([x])
Return a floating point number constructed from a number or string x. If the argument is a string, it should contain a decimal number, optionally preceded by a sign, and optionally embedded in whitespace. The optional sign may be '+' or '-'; a '+' sign has no effect on the value produced. The argumen... | python.library.functions#float |
float.as_integer_ratio()
Return a pair of integers whose ratio is exactly equal to the original float and with a positive denominator. Raises OverflowError on infinities and a ValueError on NaNs. | python.library.stdtypes#float.as_integer_ratio |
classmethod float.fromhex(s)
Class method to return the float represented by a hexadecimal string s. The string s may have leading and trailing whitespace. | python.library.stdtypes#float.fromhex |
float.hex()
Return a representation of a floating-point number as a hexadecimal string. For finite floating-point numbers, this representation will always include a leading 0x and a trailing p and exponent. | python.library.stdtypes#float.hex |
float.is_integer()
Return True if the float instance is finite with integral value, and False otherwise: >>> (-2.0).is_integer()
True
>>> (3.2).is_integer()
False | python.library.stdtypes#float.is_integer |
exception FloatingPointError
Not currently used. | python.library.exceptions#FloatingPointError |
fnmatch — Unix filename pattern matching Source code: Lib/fnmatch.py This module provides support for Unix shell-style wildcards, which are not the same as regular expressions (which are documented in the re module). The special characters used in shell-style wildcards are:
Pattern Meaning
* matches everything
... | python.library.fnmatch |
fnmatch.filter(names, pattern)
Construct a list from those elements of the iterable names that match pattern. It is the same as [n for n in names if fnmatch(n, pattern)], but implemented more efficiently. | python.library.fnmatch#fnmatch.filter |
fnmatch.fnmatch(filename, pattern)
Test whether the filename string matches the pattern string, returning True or False. Both parameters are case-normalized using os.path.normcase(). fnmatchcase() can be used to perform a case-sensitive comparison, regardless of whether that’s standard for the operating system. This ... | python.library.fnmatch#fnmatch.fnmatch |
fnmatch.fnmatchcase(filename, pattern)
Test whether filename matches pattern, returning True or False; the comparison is case-sensitive and does not apply os.path.normcase(). | python.library.fnmatch#fnmatch.fnmatchcase |
fnmatch.translate(pattern)
Return the shell-style pattern converted to a regular expression for using with re.match(). Example: >>> import fnmatch, re
>>>
>>> regex = fnmatch.translate('*.txt')
>>> regex
'(?s:.*\\.txt)\\Z'
>>> reobj = re.compile(regex)
>>> reobj.match('foobar.txt')
<re.Match object; span=(0, 10), mat... | python.library.fnmatch#fnmatch.translate |
format(value[, format_spec])
Convert a value to a “formatted” representation, as controlled by format_spec. The interpretation of format_spec will depend on the type of the value argument, however there is a standard formatting syntax that is used by most built-in types: Format Specification Mini-Language. The defaul... | python.library.functions#format |
fractions — Rational numbers Source code: Lib/fractions.py The fractions module provides support for rational number arithmetic. A Fraction instance can be constructed from a pair of integers, from another rational number, or from a string.
class fractions.Fraction(numerator=0, denominator=1)
class fractions.Fracti... | python.library.fractions |
class fractions.Fraction(numerator=0, denominator=1)
class fractions.Fraction(other_fraction)
class fractions.Fraction(float)
class fractions.Fraction(decimal)
class fractions.Fraction(string)
The first version requires that numerator and denominator are instances of numbers.Rational and returns a new Fractio... | python.library.fractions#fractions.Fraction |
as_integer_ratio()
Return a tuple of two integers, whose ratio is equal to the Fraction and with a positive denominator. New in version 3.8. | python.library.fractions#fractions.Fraction.as_integer_ratio |
denominator
Denominator of the Fraction in lowest term. | python.library.fractions#fractions.Fraction.denominator |
from_decimal(dec)
This class method constructs a Fraction representing the exact value of dec, which must be a decimal.Decimal instance. Note From Python 3.2 onwards, you can also construct a Fraction instance directly from a decimal.Decimal instance. | python.library.fractions#fractions.Fraction.from_decimal |
from_float(flt)
This class method constructs a Fraction representing the exact value of flt, which must be a float. Beware that Fraction.from_float(0.3) is not the same value as Fraction(3, 10). Note From Python 3.2 onwards, you can also construct a Fraction instance directly from a float. | python.library.fractions#fractions.Fraction.from_float |
limit_denominator(max_denominator=1000000)
Finds and returns the closest Fraction to self that has denominator at most max_denominator. This method is useful for finding rational approximations to a given floating-point number: >>> from fractions import Fraction
>>> Fraction('3.1415926535897932').limit_denominator(10... | python.library.fractions#fractions.Fraction.limit_denominator |
numerator
Numerator of the Fraction in lowest term. | python.library.fractions#fractions.Fraction.numerator |
__ceil__()
Returns the least int >= self. This method can also be accessed through the math.ceil() function. | python.library.fractions#fractions.Fraction.__ceil__ |
__floor__()
Returns the greatest int <= self. This method can also be accessed through the math.floor() function: >>> from math import floor
>>> floor(Fraction(355, 113))
3 | python.library.fractions#fractions.Fraction.__floor__ |
__round__()
__round__(ndigits)
The first version returns the nearest int to self, rounding half to even. The second version rounds self to the nearest multiple of Fraction(1, 10**ndigits) (logically, if ndigits is negative), again rounding half toward even. This method can also be accessed through the round() funct... | python.library.fractions#fractions.Fraction.__round__ |
class frozenset([iterable])
Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types — set, frozenset for documentation about this class. For other containers see the built-in set, list, tuple, and dict classes, as well as the collections ... | python.library.functions#frozenset |
class set([iterable])
class frozenset([iterable])
Return a new set or frozenset object whose elements are taken from iterable. The elements of a set must be hashable. To represent sets of sets, the inner sets must be frozenset objects. If iterable is not specified, a new empty set is returned. Sets can be created b... | python.library.stdtypes#frozenset |
add(elem)
Add element elem to the set. | python.library.stdtypes#frozenset.add |
clear()
Remove all elements from the set. | python.library.stdtypes#frozenset.clear |
copy()
Return a shallow copy of the set. | python.library.stdtypes#frozenset.copy |
difference(*others)
set - other - ...
Return a new set with elements in the set that are not in the others. | python.library.stdtypes#frozenset.difference |
difference_update(*others)
set -= other | ...
Update the set, removing elements found in others. | python.library.stdtypes#frozenset.difference_update |
discard(elem)
Remove element elem from the set if it is present. | python.library.stdtypes#frozenset.discard |
intersection(*others)
set & other & ...
Return a new set with elements common to the set and all others. | python.library.stdtypes#frozenset.intersection |
intersection_update(*others)
set &= other & ...
Update the set, keeping only elements found in it and all others. | python.library.stdtypes#frozenset.intersection_update |
isdisjoint(other)
Return True if the set has no elements in common with other. Sets are disjoint if and only if their intersection is the empty set. | python.library.stdtypes#frozenset.isdisjoint |
issubset(other)
set <= other
Test whether every element in the set is in other. | python.library.stdtypes#frozenset.issubset |
issuperset(other)
set >= other
Test whether every element in other is in the set. | python.library.stdtypes#frozenset.issuperset |
pop()
Remove and return an arbitrary element from the set. Raises KeyError if the set is empty. | python.library.stdtypes#frozenset.pop |
remove(elem)
Remove element elem from the set. Raises KeyError if elem is not contained in the set. | python.library.stdtypes#frozenset.remove |
symmetric_difference(other)
set ^ other
Return a new set with elements in either the set or other but not both. | python.library.stdtypes#frozenset.symmetric_difference |
symmetric_difference_update(other)
set ^= other
Update the set, keeping only elements found in either set, but not in both. | python.library.stdtypes#frozenset.symmetric_difference_update |
union(*others)
set | other | ...
Return a new set with elements from the set and all others. | python.library.stdtypes#frozenset.union |
update(*others)
set |= other | ...
Update the set, adding elements from all others. | python.library.stdtypes#frozenset.update |
ftplib — FTP protocol client Source code: Lib/ftplib.py This module defines the class FTP and a few related items. The FTP class implements the client side of the FTP protocol. You can use this to write Python programs that perform a variety of automated FTP jobs, such as mirroring other FTP servers. It is also used by... | python.library.ftplib |
ftplib.all_errors
The set of all exceptions (as a tuple) that methods of FTP instances may raise as a result of problems with the FTP connection (as opposed to programming errors made by the caller). This set includes the four exceptions listed above as well as OSError and EOFError. | python.library.ftplib#ftplib.all_errors |
exception ftplib.error_perm
Exception raised when an error code signifying a permanent error (response codes in the range 500–599) is received. | python.library.ftplib#ftplib.error_perm |
exception ftplib.error_proto
Exception raised when a reply is received from the server that does not fit the response specifications of the File Transfer Protocol, i.e. begin with a digit in the range 1–5. | python.library.ftplib#ftplib.error_proto |
exception ftplib.error_reply
Exception raised when an unexpected reply is received from the server. | python.library.ftplib#ftplib.error_reply |
exception ftplib.error_temp
Exception raised when an error code signifying a temporary error (response codes in the range 400–499) is received. | python.library.ftplib#ftplib.error_temp |
class ftplib.FTP(host='', user='', passwd='', acct='', timeout=None, source_address=None, *, encoding='utf-8')
Return a new instance of the FTP class. When host is given, the method call connect(host) is made. When user is given, additionally the method call login(user, passwd, acct) is made (where passwd and acct de... | python.library.ftplib#ftplib.FTP |
FTP.abort()
Abort a file transfer that is in progress. Using this does not always work, but it’s worth a try. | python.library.ftplib#ftplib.FTP.abort |
FTP.close()
Close the connection unilaterally. This should not be applied to an already closed connection such as after a successful call to quit(). After this call the FTP instance should not be used any more (after a call to close() or quit() you cannot reopen the connection by issuing another login() method). | python.library.ftplib#ftplib.FTP.close |
FTP.connect(host='', port=0, timeout=None, source_address=None)
Connect to the given host and port. The default port number is 21, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called... | python.library.ftplib#ftplib.FTP.connect |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.