Comprehensive Python Guide
Comprehensive Python Guide
Documentation
Python Library Documentation: module math
NAME
math
MODULE REFERENCE
[Link]
DESCRIPTION
This module provides access to the mathematical functions
defined by the C standard.
FUNCTIONS
acos(x, /)
Return the arc cosine (measured in radians) of x.
acosh(x, /)
Return the inverse hyperbolic cosine of x.
asin(x, /)
Return the arc sine (measured in radians) of x.
asinh(x, /)
Return the inverse hyperbolic sine of x.
atan(x, /)
Return the arc tangent (measured in radians) of x.
atan2(y, x, /)
Return the arc tangent (measured in radians) of y/x.
atanh(x, /)
Return the inverse hyperbolic tangent of x.
ceil(x, /)
Return the ceiling of x as an Integral.
comb(n, k, /)
Number of ways to choose k items from n items without repetition and
without order.
copysign(x, y, /)
Return a float with the magnitude (absolute value) of x but the sign
of y.
cos(x, /)
Return the cosine of x (measured in radians).
cosh(x, /)
Return the hyperbolic cosine of x.
degrees(x, /)
Convert angle x from radians to degrees.
dist(p, q, /)
Return the Euclidean distance between two points p and q.
erf(x, /)
Error function at x.
erfc(x, /)
Complementary error function at x.
exp(x, /)
Return e raised to the power of x.
expm1(x, /)
Return exp(x)-1.
fabs(x, /)
Return the absolute value of the float x.
factorial(x, /)
Find x!.
floor(x, /)
Return the floor of x as an Integral.
fmod(x, y, /)
Return fmod(x, y), according to platform C.
x % y may differ.
frexp(x, /)
Return the mantissa and exponent of x, as pair (m, e).
fsum(seq, /)
Return an accurate floating point sum of values in the iterable seq.
gamma(x, /)
Gamma function at x.
gcd(*integers)
Greatest Common Divisor.
hypot(...)
hypot(*coordinates) -> value
rel_tol
maximum difference for being considered "close", relative to the
magnitude of the input values
abs_tol
maximum difference for being considered "close", regardless of the
magnitude of the input values
-inf, inf and NaN behave similarly to the IEEE 754 Standard. That
is, NaN is not close to anything, even itself. inf and -inf are
only close to themselves.
isfinite(x, /)
Return True if x is neither an infinity nor a NaN, and False
otherwise.
isinf(x, /)
Return True if x is a positive or negative infinity, and False
otherwise.
isnan(x, /)
Return True if x is a NaN (not a number), and False otherwise.
isqrt(n, /)
Return the integer part of the square root of the input.
lcm(*integers)
Least Common Multiple.
ldexp(x, i, /)
Return x * (2**i).
lgamma(x, /)
Natural logarithm of absolute value of Gamma function at x.
log(...)
log(x, [base=math.e])
Return the logarithm of x to the given base.
log10(x, /)
Return the base 10 logarithm of x.
log1p(x, /)
Return the natural logarithm of 1+x (base e).
log2(x, /)
Return the base 2 logarithm of x.
modf(x, /)
Return the fractional and integer parts of x.
nextafter(x, y, /)
Return the next floating-point value after x towards y.
perm(n, k=None, /)
Number of ways to choose k items from n items without repetition and
with order.
pow(x, y, /)
Return x**y (x to the power of y).
prod(iterable, /, *, start=1)
Calculate the product of all the elements in the input iterable.
When the iterable is empty, return the start value. This function is
intended specifically for use with numeric values and may reject
non-numeric types.
radians(x, /)
Convert angle x from degrees to radians.
remainder(x, y, /)
Difference between x and the closest integer multiple of y.
sin(x, /)
Return the sine of x (measured in radians).
sinh(x, /)
Return the hyperbolic sine of x.
sqrt(x, /)
Return the square root of x.
tan(x, /)
Return the tangent of x (measured in radians).
tanh(x, /)
Return the hyperbolic tangent of x.
trunc(x, /)
Truncates the Real x to the nearest Integral toward 0.
Uses the __trunc__ magic method.
ulp(x, /)
Return the value of the least significant bit of the float x.
DATA
e = 2.718281828459045
inf = inf
nan = nan
pi = 3.141592653589793
tau = 6.283185307179586
FILE
/usr/local/lib/python3.10/lib-dynload/[Link]-310-x86_64-[Link]
NAME
sys
MODULE REFERENCE
[Link]
DESCRIPTION
This module provides access to some objects used or maintained by the
interpreter and to functions that interact strongly with the interpreter.
Dynamic objects:
Static objects:
Functions:
FUNCTIONS
__breakpointhook__ = breakpointhook(...)
breakpointhook(*args, **kws)
__displayhook__ = displayhook(object, /)
Print an object to [Link] and also save it in builtins._
__unraisablehook__ = unraisablehook(unraisable, /)
Handle an unraisable exception.
addaudithook(hook)
Adds a new audit hook callback.
audit(...)
audit(event, *args)
breakpointhook(...)
breakpointhook(*args, **kws)
call_tracing(func, args, /)
Call func(*args), while tracing is enabled.
The tracing state is saved, and restored afterwards. This is intended
to be called from a debugger from a checkpoint, to recursively debug
some other code.
displayhook(object, /)
Print an object to [Link] and also save it in builtins._
exc_info()
Return current exception information: (type, value, traceback).
exit(status=None, /)
Exit the interpreter by raising SystemExit(status).
get_asyncgen_hooks()
Return the installed asynchronous generators hooks.
get_coroutine_origin_tracking_depth()
Check status of origin tracking for coroutine objects in this thread.
get_int_max_str_digits()
Return the maximum string digits limit for non-binary int<->str
conversions.
getallocatedblocks()
Return the number of memory blocks currently allocated.
getdefaultencoding()
Return the current default encoding used by the Unicode
implementation.
getdlopenflags()
Return the current value of the flags that are used for dlopen calls.
getfilesystemencodeerrors()
Return the error mode used Unicode to OS filename conversion.
getfilesystemencoding()
Return the encoding used to convert Unicode filenames to OS filenames.
getprofile()
Return the profiling function set with [Link].
getrecursionlimit()
Return the current value of the recursion limit.
getrefcount(object, /)
Return the reference count of object.
The count returned is generally one higher than you might expect,
because it includes the (temporary) reference as an argument to
getrefcount().
getsizeof(...)
getsizeof(object [, default]) -> int
getswitchinterval()
Return the current thread switch interval; see
[Link]().
gettrace()
Return the global debug tracing function set with [Link].
intern(string, /)
``Intern'' the given string.
This enters the string in the (global) table of interned strings whose
purpose is to speed up dictionary lookups. Return the string itself or
the previously interned string object with the same value.
is_finalizing()
Return True if Python is exiting.
set_asyncgen_hooks(...)
set_asyncgen_hooks(* [, firstiter] [, finalizer])
set_coroutine_origin_tracking_depth(depth)
Enable or disable origin tracking for coroutine objects in this
thread.
set_int_max_str_digits(maxdigits)
Set the maximum string digits limit for non-binary int<->str
conversions.
setdlopenflags(flags, /)
Set the flags used by the interpreter for dlopen calls.
setprofile(...)
setprofile(function)
setrecursionlimit(limit, /)
Set the maximum depth of the Python interpreter stack to n.
setswitchinterval(interval, /)
Set the ideal thread switching delay inside the Python interpreter.
settrace(...)
settrace(function)
unraisablehook(unraisable, /)
Handle an unraisable exception.
DATA
__stderr__ = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf...
__stdin__ = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8...
__stdout__ = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf...
abiflags = ''
api_version = 1013
argv = ['/usr/bin/entry/entry_point']
base_exec_prefix = '/usr/local'
base_prefix = '/usr/local'
builtin_module_names = ('_abc', '_ast', '_codecs', '_collections', '_f...
byteorder = 'little'
copyright = 'Copyright (c) 2001-2023 Python Software Foundati...ematis...
dont_write_bytecode = False
exec_prefix = '/usr/local'
executable = '/usr/local/bin/python3'
flags = [Link](debug=0, inspect=0, interactive=0, opt..., warn_defa...
float_info = sys.float_info(max=1.7976931348623157e+308, max_...epsilo...
float_repr_style = 'short'
hash_info = sys.hash_info(width=64, modulus=2305843009213693...iphash2...
hexversion = 50991344
implementation = namespace(name='cpython', cache_tag='cpython-310...xv...
int_info = sys.int_info(bits_per_digit=30, sizeof_digit=4, ..._str_dig...
maxsize = 9223372036854775807
maxunicode = 1114111
meta_path = [<_distutils_hack.DistutilsMetaFinder object>, <class '_fr...
modules = {'PIL': <module 'PIL' from '/usr/local/lib/python3.10/site-p...
orig_argv = ['python3', '/usr/bin/entry/entry_point']
path = ['/usr/bin/entry', '/home/bard', '/usr/bin/entry', '/usr/local/...
path_hooks = [<class '[Link]'>, <function [Link]...
path_importer_cache = {'/home/bard': FileFinder('/home/bard'), '/usr/b...
platform = 'linux'
platlibdir = 'lib'
prefix = '/usr/local'
pycache_prefix = None
stderr = <__main__.Tee object>
stdin = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>
stdlib_module_names = frozenset({'__future__', '_abc', '_aix_support',...
stdout = <__main__.Tee object>
thread_info = sys.thread_info(name='pthread', lock='semaphore', versio...
version = '3.10.16 (main, Apr 8 2025, 01:38:46) [GCC 12.2.0]'
version_info = sys.version_info(major=3, minor=10, micro=16, releasele...
warnoptions = []
FILE
(built-in)
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
[Link]
DESCRIPTION
This exports:
- all functions from posix or nt, e.g. unlink, stat, etc.
- [Link] is either posixpath or ntpath
- [Link] is either 'posix' or 'nt'
- [Link] is a string representing the current directory (always '.')
- [Link] is a string representing the parent directory (always '..')
- [Link] is the (or a most common) pathname separator ('/' or '\\')
- [Link] is the extension separator (always '.')
- [Link] is the alternate pathname separator (None or '/')
- [Link] is the component separator used in $PATH etc
- [Link] is the line separator in text files ('\r' or '\n' or
'\r\n')
- [Link] is the default search path for executables
- [Link] is the file path of the null device ('/dev/null', etc.)
Programs that import and use 'os' stand a better chance of being
portable between different platforms. Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to [Link]
(e.g., split and join).
CLASSES
[Link]([Link])
[Link]
[Link]
[Link]
[Link]([Link])
stat_result
statvfs_result
terminal_size
posix.sched_param
posix.times_result
posix.uname_result
posix.waitid_result
class DirEntry([Link])
| Methods defined here:
|
| __fspath__(self, /)
| Returns the path for the entry.
|
| __repr__(self, /)
| Return repr(self).
|
| inode(self, /)
| Return inode of the entry; cached per entry.
|
| is_dir(self, /, *, follow_symlinks=True)
| Return True if the entry is a directory; cached per entry.
|
| is_file(self, /, *, follow_symlinks=True)
| Return True if the entry is a file; cached per entry.
|
| is_symlink(self, /)
| Return True if the entry is a symbolic link; cached per entry.
|
| stat(self, /, *, follow_symlinks=True)
| Return stat_result object for the entry; cached per entry.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
| the entry's base filename, relative to scandir() "path" argument
|
| path
| the entry's full path name; equivalent to
[Link](scandir_path, [Link])
class sched_param([Link])
| sched_param(sched_priority)
|
| Currently has only one field: sched_priority
|
| sched_priority
| A scheduling parameter.
|
| Method resolution order:
| sched_param
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| sched_priority
| the scheduling priority
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('sched_priority',)
|
| n_fields = 1
|
| n_sequence_fields = 1
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class stat_result([Link])
| stat_result(iterable=(), /)
|
| stat_result: Result from stat, fstat, or lstat.
|
| This object may be accessed either as a tuple of
| (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
| or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and
so on.
|
| Posix/windows: If your platform supports st_blksize, st_blocks,
st_rdev,
| or st_flags, they are available as attributes only.
|
| See [Link] for more information.
|
| Method resolution order:
| stat_result
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| st_atime
| time of last access
|
| st_atime_ns
| time of last access in nanoseconds
|
| st_blksize
| blocksize for filesystem I/O
|
| st_blocks
| number of blocks allocated
|
| st_ctime
| time of last change
|
| st_ctime_ns
| time of last change in nanoseconds
|
| st_dev
| device
|
| st_gid
| group ID of owner
|
| st_ino
| inode
|
| st_mode
| protection bits
|
| st_mtime
| time of last modification
|
| st_mtime_ns
| time of last modification in nanoseconds
|
| st_nlink
| number of hard links
|
| st_rdev
| device type (if inode device)
|
| st_size
| total size, in bytes
|
| st_uid
| user ID of owner
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('st_mode', 'st_ino', 'st_dev', 'st_nlink',
'st_uid',...
|
| n_fields = 19
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 3
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class statvfs_result([Link])
| statvfs_result(iterable=(), /)
|
| statvfs_result: Result from statvfs or fstatvfs.
|
| This object may be accessed either as a tuple of
| (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag,
namemax),
| or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.
|
| See [Link] for more information.
|
| Method resolution order:
| statvfs_result
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| f_bavail
|
| f_bfree
|
| f_blocks
|
| f_bsize
|
| f_favail
|
| f_ffree
|
| f_files
|
| f_flag
|
| f_frsize
|
| f_fsid
|
| f_namemax
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('f_bsize', 'f_frsize', 'f_blocks', 'f_bfree',
'f_bav...
|
| n_fields = 11
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class terminal_size([Link])
| terminal_size(iterable=(), /)
|
| A tuple of (columns, lines) for holding terminal window size
|
| Method resolution order:
| terminal_size
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| columns
| width of the terminal window in characters
|
| lines
| height of the terminal window in characters
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('columns', 'lines')
|
| n_fields = 2
|
| n_sequence_fields = 2
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class times_result([Link])
| times_result(iterable=(), /)
|
| times_result: Result from [Link]().
|
| This object may be accessed either as a tuple of
| (user, system, children_user, children_system, elapsed),
| or via the attributes user, system, children_user, children_system,
| and elapsed.
|
| See [Link] for more information.
|
| Method resolution order:
| times_result
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| children_system
| system time of children
|
| children_user
| user time of children
|
| elapsed
| elapsed time since an arbitrary point in the past
|
| system
| system time
|
| user
| user time
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('user', 'system', 'children_user',
'children_system'...
|
| n_fields = 5
|
| n_sequence_fields = 5
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class uname_result([Link])
| uname_result(iterable=(), /)
|
| uname_result: Result from [Link]().
|
| This object may be accessed either as a tuple of
| (sysname, nodename, release, version, machine),
| or via the attributes sysname, nodename, release, version, and
machine.
|
| See [Link] for more information.
|
| Method resolution order:
| uname_result
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| machine
| hardware identifier
|
| nodename
| name of machine on network (implementation-defined)
|
| release
| operating system release
|
| sysname
| operating system name
|
| version
| operating system version
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('sysname', 'nodename', 'release', 'version',
'machin...
|
| n_fields = 5
|
| n_sequence_fields = 5
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
class waitid_result([Link])
| waitid_result(iterable=(), /)
|
| waitid_result: Result from waitid.
|
| This object may be accessed either as a tuple of
| (si_pid, si_uid, si_signo, si_status, si_code),
| or via the attributes si_pid, si_uid, and so on.
|
| See [Link] for more information.
|
| Method resolution order:
| waitid_result
| [Link]
| [Link]
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| si_code
|
| si_pid
|
| si_signo
|
| si_status
|
| si_uid
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('si_pid', 'si_uid', 'si_signo', 'si_status',
'si_cod...
|
| n_fields = 5
|
| n_sequence_fields = 5
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
FUNCTIONS
WCOREDUMP(status, /)
Return True if the process returning status was dumped to a core file.
WEXITSTATUS(status)
Return the process return code from status.
WIFCONTINUED(status)
Return True if a particular process was continued from a job control
stop.
WIFEXITED(status)
Return True if the process returning status exited via the exit()
system call.
WIFSIGNALED(status)
Return True if the process returning status was terminated by a
signal.
WIFSTOPPED(status)
Return True if the process returning status was stopped.
WSTOPSIG(status)
Return the signal that stopped the process that provided the status
value.
WTERMSIG(status)
Return the signal that terminated the process that provided the status
value.
_exit(status)
Exit to the system with specified status, without normal exit
processing.
abort()
Abort the interpreter immediately.
path
Path to be tested; can be string, bytes, or a path-like object.
mode
Operating-system mode bitfield. Can be F_OK to test existence,
or the inclusive-OR of R_OK, W_OK, and X_OK.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that
directory.
effective_ids
If True, access will use the effective uid/gid instead of
the real uid/gid.
follow_symlinks
If False, and the last element of the path is a symbolic link,
access will examine the symbolic link itself instead of the file
the link points to.
dir_fd, effective_ids, and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
Note that most operations will use the effective uid/gid, therefore
this
routine can be used in a suid/sgid environment to test if the
invoking user
has the specified access to the path.
chdir(path)
Change the current working directory to the specified path.
path
Path to be modified. May always be specified as a str, bytes, or
a path-like object.
On some platforms, path may also be specified as an open file
descriptor.
If this functionality is unavailable, using it raises an
exception.
mode
Operating-system mode bitfield.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that
directory.
follow_symlinks
If False, and the last element of the path is a symbolic link,
chmod will modify the symbolic link itself instead of the file
the link points to.
chroot(path)
Change root directory to path.
close(fd)
Close a file descriptor.
closerange(fd_low, fd_high, /)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
confstr(name, /)
Return a string-valued system configuration variable.
cpu_count()
Return the number of CPUs in the system; return None if
indeterminable.
ctermid()
Return the name of the controlling terminal for this process.
device_encoding(fd)
Return a string describing the encoding of a terminal's file
descriptor.
dup(fd, /)
Return a duplicate of a file descriptor.
eventfd(initval, flags=524288)
Creates and returns an event notification file descriptor.
eventfd_read(fd)
Read eventfd value
eventfd_write(fd, value)
Write eventfd value.
execl(file, *args)
execl(file, *args)
Execute the executable file with argument list args, replacing the
current process.
execle(file, *args)
execle(file, *args, env)
execlp(file, *args)
execlp(file, *args)
execlpe(file, *args)
execlpe(file, *args, env)
execv(path, argv, /)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
execvp(file, args)
execvp(file, args)
fchdir(fd)
Change to the directory of the given file descriptor.
fchmod(fd, mode)
Change the access permissions of the file given by file descriptor fd.
fdatasync(fd)
Force write of fd to disk without forcing update of metadata.
fork()
Fork a child process.
forkpty()
Fork a new process with a new pseudo-terminal as controlling tty.
fpathconf(fd, name, /)
Return the configuration limit name for the file descriptor fd.
If there is no limit, return -1.
fsdecode(filename)
Decode filename (an [Link], bytes, or str) from the filesystem
encoding with 'surrogateescape' error handler, return str unchanged.
On
Windows, use 'strict' error handler if the file system encoding is
'mbcs' (which is the default encoding).
fsencode(filename)
Encode filename (an [Link], bytes, or str) to the filesystem
encoding with 'surrogateescape' error handler, return bytes unchanged.
On Windows, use 'strict' error handler if the file system encoding is
'mbcs' (which is the default encoding).
fspath(path)
Return the file system path representation of the object.
fstat(fd)
Perform a stat system call on the given file descriptor.
fstatvfs(fd, /)
Perform an fstatvfs system call on the given fd.
Equivalent to statvfs(fd).
fsync(fd)
Force write of fd to disk.
ftruncate(fd, length, /)
Truncate a file, specified by file descriptor, to a specific length.
The advantage of fwalk() over walk() is that it's safe against symlink
races (when follow_symlinks is False).
Caution:
Since fwalk() yields file descriptors, those are only valid until the
next iteration step, so you should dup() them if you want to keep them
for a longer period.
Example:
import os
for root, dirs, files, rootfd in [Link]('python/Lib/email'):
print(root, "consumes", end="")
print(sum([Link](name, dir_fd=rootfd).st_size for name in files),
end="")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
[Link]('CVS') # don't visit CVS directories
get_blocking(fd, /)
Get the blocking mode of the file descriptor.
get_exec_path(env=None)
Returns the sequence of directories that will be searched for the
named executable (similar to a shell) when launching a process.
get_inheritable(fd, /)
Get the close-on-exe flag of the specified file descriptor.
get_terminal_size(...)
Return the size of the terminal window as (columns, lines).
The optional argument fd (default standard output) specifies
which file descriptor should be queried.
getcwd()
Return a unicode string representing the current working directory.
getcwdb()
Return a bytes string representing the current working directory.
getegid()
Return the current process's effective group id.
getenv(key, default=None)
Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default.
key, default and the result are str.
getenvb(key, default=None)
Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default.
key, default and the result are bytes.
geteuid()
Return the current process's effective user id.
getgid()
Return the current process's group id.
getgrouplist(user, group, /)
Returns a list of groups to which a user belongs.
user
username to lookup
group
base group id of the user
getgroups()
Return list of supplemental group IDs for the process.
getloadavg()
Return average recent system load information.
Return the number of processes in the system run queue averaged over
the last 1, 5, and 15 minutes as a tuple of three floats.
Raises OSError if the load average was unobtainable.
getlogin()
Return the actual login name.
getpgid(pid)
Call the system call getpgid(), and return the result.
getpgrp()
Return the current process group id.
getpid()
Return the current process id.
getppid()
Return the parent's process id.
If the parent process has already exited, Windows machines will still
return its id; others systems will return the id of the 'init' process
(1).
getpriority(which, who)
Return program scheduling priority.
getrandom(size, flags=0)
Obtain a series of random bytes.
getresgid()
Return a tuple of the current process's real, effective, and saved
group ids.
getresuid()
Return a tuple of the current process's real, effective, and saved
user ids.
getsid(pid, /)
Call the system call getsid(pid) and return the result.
getuid()
Return the current process's user id.
getxattr(path, attribute, *, follow_symlinks=True)
Return the value of extended attribute attribute on path.
initgroups(username, gid, /)
Initialize the group access list.
Call the system initgroups() to initialize the group access list with
all of
the groups of which the specified username is a member, plus the
specified
group id.
isatty(fd, /)
Return True if the fd is connected to a terminal.
kill(pid, signal, /)
Kill a process with a signal.
killpg(pgid, signal, /)
Kill a process group with a signal.
listdir(path=None)
Return a list containing the names of the files in the directory.
listxattr(path=None, *, follow_symlinks=True)
Return a list of extended attributes on path.
fd
An open file descriptor.
command
One of F_LOCK, F_TLOCK, F_ULOCK or F_TEST.
length
The number of bytes to lock, starting at the current position.
lstat(path, *, dir_fd=None)
Perform a stat system call on the given path, without following
symbolic links.
major(device, /)
Extracts a device major number from a raw device number.
makedev(major, minor, /)
Composes a raw device number from the major and minor device numbers.
memfd_create(name, flags=1)
minor(device, /)
Extracts a device minor number from a raw device number.
Create a node in the file system (file, device special file or named
pipe)
at path. mode specifies both the permissions to use and the
type of node to be created, being combined (bitwise OR) with one of
S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. If S_IFCHR or S_IFBLK is set
on mode,
device defines the newly created device special file (probably using
[Link]()). Otherwise device is ignored.
nice(increment, /)
Add increment to the priority of process and return the new priority.
openpty()
Open a pseudo-terminal.
pathconf(path, name)
Return the configuration limit name for the file or directory path.
pidfd_open(pid, flags=0)
Return a file descriptor referring to the process *pid*.
pipe()
Create a pipe.
pipe2(flags, /)
Create a pipe with flags set atomically.
posix_spawn(...)
Execute the program specified by path in a new process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
file_actions
A sequence of file action tuples.
setpgroup
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
resetids
If the value is `true` the POSIX_SPAWN_RESETIDS will be activated.
setsid
If the value is `true` the POSIX_SPAWN_SETSID or
POSIX_SPAWN_SETSID_NP will be activated.
setsigmask
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
setsigdef
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
scheduler
A tuple with the scheduler policy (optional) and parameters.
posix_spawnp(...)
Execute the program specified by path in a new process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
file_actions
A sequence of file action tuples.
setpgroup
The pgroup to use with the POSIX_SPAWN_SETPGROUP flag.
resetids
If the value is `True` the POSIX_SPAWN_RESETIDS will be activated.
setsid
If the value is `True` the POSIX_SPAWN_SETSID or
POSIX_SPAWN_SETSID_NP will be activated.
setsigmask
The sigmask to use with the POSIX_SPAWN_SETSIGMASK flag.
setsigdef
The sigmask to use with the POSIX_SPAWN_SETSIGDEF flag.
scheduler
A tuple with the scheduler policy (optional) and parameters.
Read length bytes from file descriptor fd, starting at offset bytes
from
the beginning of the file. The file offset remains unchanged.
- RWF_HIPRI
- RWF_NOWAIT
putenv(name, value, /)
Change or add an environment variable.
- RWF_DSYNC
- RWF_SYNC
- RWF_APPEND
read(fd, length, /)
Read from a file descriptor. Returns a bytes object.
readlink(path, *, dir_fd=None)
Return a string representing the path to which the symbolic link
points.
readv(fd, buffers, /)
Read from a file descriptor fd into an iterable of buffers.
register_at_fork(...)
Register callables to be called when forking a new process.
before
A callable to be called in the parent before the fork() syscall.
after_in_child
A callable to be called in the child after fork().
after_in_parent
A callable to be called in the parent after fork().
remove(path, *, dir_fd=None)
Remove a file (same as unlink()).
removedirs(name)
removedirs(name)
renames(old, new)
renames(old, new)
Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
rmdir(path, *, dir_fd=None)
Remove a directory.
scandir(path=None)
Return an iterator of DirEntry objects for given path.
sched_get_priority_max(policy)
Get the maximum scheduling priority for policy.
sched_get_priority_min(policy)
Get the minimum scheduling priority for policy.
sched_getaffinity(pid, /)
Return the affinity of the process identified by pid (or the current
process if zero).
sched_getparam(pid, /)
Returns scheduling parameters for the process identified by pid.
sched_getscheduler(pid, /)
Get the scheduling policy for the process identified by pid.
Passing 0 for pid returns the scheduling policy for the calling
process.
sched_rr_get_interval(pid, /)
Return the round-robin quantum for the process identified by pid, in
seconds.
sched_setaffinity(pid, mask, /)
Set the CPU affinity of the process identified by pid to mask.
sched_yield()
Voluntarily relinquish the CPU.
set_blocking(fd, blocking, /)
Set the blocking mode of the specified file descriptor.
set_inheritable(fd, inheritable, /)
Set the inheritable flag of the specified file descriptor.
setegid(egid, /)
Set the current process's effective group id.
seteuid(euid, /)
Set the current process's effective user id.
setgid(gid, /)
Set the current process's group id.
setgroups(groups, /)
Set the groups of the current process to list.
setpgid(pid, pgrp, /)
Call the system call setpgid(pid, pgrp).
setpgrp()
Make the current process the leader of its process group.
setreuid(ruid, euid, /)
Set the current process's real and effective user ids.
setsid()
Call the system call setsid().
setuid(uid, /)
Set the current process's user id.
Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it.
Execute file (which is looked for along $PATH) with arguments from
args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it.
Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it.
src
Source file descriptor.
dst
Destination file descriptor.
count
Number of bytes to copy.
offset_src
Starting offset in src.
offset_dst
Starting offset in dst.
flags
Flags to modify the semantics of the call.
path
Path to be examined; can be string, bytes, a path-like object or
open-file-descriptor int.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be a relative string; path will then be relative
to
that directory.
follow_symlinks
If False, and the last element of the path is a symbolic link,
stat will examine the symbolic link itself instead of the file
the link points to.
statvfs(path)
Perform a statvfs system call on the given path.
path may always be specified as a string.
On some platforms, path may also be specified as an open file
descriptor.
If this functionality is unavailable, using it raises an exception.
strerror(code, /)
Translate an error code to a message string.
sync()
Force write of everything to disk.
sysconf(name, /)
Return an integer-valued system configuration variable.
system(command)
Execute the command in a subshell.
tcgetpgrp(fd, /)
Return the process group associated with the terminal specified by fd.
tcsetpgrp(fd, pgid, /)
Set the process group associated with the terminal specified by fd.
times()
Return a collection containing process timing information.
The object returned behaves like a named tuple with these fields:
(utime, stime, cutime, cstime, elapsed_time)
All fields are floating point numbers.
truncate(path, length)
Truncate a file, specified by path, to a specific length.
On some platforms, path may also be specified as an open file
descriptor.
If this functionality is unavailable, using it raises an exception.
ttyname(fd, /)
Return the name of the terminal device connected to 'fd'.
fd
Integer file descriptor handle.
umask(mask, /)
Set the current numeric umask and return the previous umask.
uname()
Return an object identifying the current operating system.
The object behaves like a named tuple with the following fields:
(sysname, nodename, release, version, machine)
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).
unsetenv(name, /)
Delete an environment variable.
urandom(size, /)
Return a bytes object containing random bytes suitable for
cryptographic use.
utime(...)
Set the access and modified time of path.
wait()
Wait for completion of a child process.
wait3(options)
Wait for completion of a child process.
wait4(pid, options)
Wait for completion of a specific child process.
idtype
Must be one of be P_PID, P_PGID or P_ALL.
id
The id to wait on.
options
Constructed from the ORing of one or more of WEXITED, WSTOPPED
or WCONTINUED and additionally may be ORed with WNOHANG or
WNOWAIT.
waitpid(pid, options, /)
Wait for completion of a given child process.
waitstatus_to_exitcode(status)
Convert a wait status to an exit code.
On Unix:
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
When topdown is true, the caller can modify the dirnames list in-place
(e.g., via del or slice assignment), and walk will only recurse into
the
subdirectories whose names remain in dirnames; this can be used to
prune the
search, or to impose a specific order of visiting. Modifying dirnames
when
topdown is false has no effect on the behavior of [Link](), since the
directories in dirnames have already been generated by the time
dirnames
itself is generated. No matter the value of topdown, the list of
subdirectories is retrieved before the tuples for the directory and
its
subdirectories are generated.
Caution: if you pass a relative pathname for top, don't change the
current working directory between resumptions of walk. walk never
changes the current directory, and assumes that the client doesn't
either.
Example:
import os
from [Link] import join, getsize
for root, dirs, files in [Link]('python/Lib/email'):
print(root, "consumes", end="")
print(sum(getsize(join(root, name)) for name in files), end="")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
[Link]('CVS') # don't visit CVS directories
write(fd, data, /)
Write a bytes object to a file descriptor.
writev(fd, buffers, /)
Iterate over buffers, and write the contents of each to a file
descriptor.
DATA
CLD_CONTINUED = 6
CLD_DUMPED = 3
CLD_EXITED = 1
CLD_KILLED = 2
CLD_STOPPED = 5
CLD_TRAPPED = 4
EFD_CLOEXEC = 524288
EFD_NONBLOCK = 2048
EFD_SEMAPHORE = 1
EX_CANTCREAT = 73
EX_CONFIG = 78
EX_DATAERR = 65
EX_IOERR = 74
EX_NOHOST = 68
EX_NOINPUT = 66
EX_NOPERM = 77
EX_NOUSER = 67
EX_OK = 0
EX_OSERR = 71
EX_OSFILE = 72
EX_PROTOCOL = 76
EX_SOFTWARE = 70
EX_TEMPFAIL = 75
EX_UNAVAILABLE = 69
EX_USAGE = 64
F_LOCK = 1
F_OK = 0
F_TEST = 3
F_TLOCK = 2
F_ULOCK = 0
GRND_NONBLOCK = 1
GRND_RANDOM = 2
MFD_ALLOW_SEALING = 2
MFD_CLOEXEC = 1
MFD_HUGETLB = 4
MFD_HUGE_16GB = 2281701376
MFD_HUGE_16MB = 1610612736
MFD_HUGE_1GB = 2013265920
MFD_HUGE_1MB = 1342177280
MFD_HUGE_256MB = 1879048192
MFD_HUGE_2GB = 2080374784
MFD_HUGE_2MB = 1409286144
MFD_HUGE_32MB = 1677721600
MFD_HUGE_512KB = 1275068416
MFD_HUGE_512MB = 1946157056
MFD_HUGE_64KB = 1073741824
MFD_HUGE_8MB = 1543503872
MFD_HUGE_MASK = 63
MFD_HUGE_SHIFT = 26
NGROUPS_MAX = 65536
O_ACCMODE = 3
O_APPEND = 1024
O_ASYNC = 8192
O_CLOEXEC = 524288
O_CREAT = 64
O_DIRECT = 16384
O_DIRECTORY = 65536
O_DSYNC = 4096
O_EXCL = 128
O_FSYNC = 1052672
O_LARGEFILE = 0
O_NDELAY = 2048
O_NOATIME = 262144
O_NOCTTY = 256
O_NOFOLLOW = 131072
O_NONBLOCK = 2048
O_PATH = 2097152
O_RDONLY = 0
O_RDWR = 2
O_RSYNC = 1052672
O_SYNC = 1052672
O_TMPFILE = 4259840
O_TRUNC = 512
O_WRONLY = 1
POSIX_FADV_DONTNEED = 4
POSIX_FADV_NOREUSE = 5
POSIX_FADV_NORMAL = 0
POSIX_FADV_RANDOM = 1
POSIX_FADV_SEQUENTIAL = 2
POSIX_FADV_WILLNEED = 3
POSIX_SPAWN_CLOSE = 1
POSIX_SPAWN_DUP2 = 2
POSIX_SPAWN_OPEN = 0
PRIO_PGRP = 1
PRIO_PROCESS = 0
PRIO_USER = 2
P_ALL = 0
P_NOWAIT = 1
P_NOWAITO = 1
P_PGID = 2
P_PID = 1
P_PIDFD = 3
P_WAIT = 0
RTLD_DEEPBIND = 8
RTLD_GLOBAL = 256
RTLD_LAZY = 1
RTLD_LOCAL = 0
RTLD_NODELETE = 4096
RTLD_NOLOAD = 4
RTLD_NOW = 2
RWF_APPEND = 16
RWF_DSYNC = 2
RWF_HIPRI = 1
RWF_NOWAIT = 8
RWF_SYNC = 4
R_OK = 4
SCHED_BATCH = 3
SCHED_FIFO = 1
SCHED_IDLE = 5
SCHED_OTHER = 0
SCHED_RESET_ON_FORK = 1073741824
SCHED_RR = 2
SEEK_CUR = 1
SEEK_DATA = 3
SEEK_END = 2
SEEK_HOLE = 4
SEEK_SET = 0
SPLICE_F_MORE = 4
SPLICE_F_MOVE = 1
SPLICE_F_NONBLOCK = 2
ST_APPEND = 256
ST_MANDLOCK = 64
ST_NOATIME = 1024
ST_NODEV = 4
ST_NODIRATIME = 2048
ST_NOEXEC = 8
ST_NOSUID = 2
ST_RDONLY = 1
ST_RELATIME = 4096
ST_SYNCHRONOUS = 16
ST_WRITE = 128
TMP_MAX = 238328
WCONTINUED = 8
WEXITED = 4
WNOHANG = 1
WNOWAIT = 16777216
WSTOPPED = 2
WUNTRACED = 2
W_OK = 2
XATTR_CREATE = 1
XATTR_REPLACE = 2
XATTR_SIZE_MAX = 65536
X_OK = 1
__all__ = ['altsep', 'curdir', 'pardir', 'sep', 'pathsep', 'linesep', ...
altsep = None
confstr_names = {'CS_GNU_LIBC_VERSION': 2, 'CS_GNU_LIBPTHREAD_VERSION'...
curdir = '.'
defpath = '/bin:/usr/bin'
devnull = '/dev/null'
environ = environ({'PYTHONPATH': ':/usr/bin/entry', 'BORG_...n:/usr/lo...
environb = environ({b'PYTHONPATH': b':/usr/bin/entry', b'BO...n:/usr/l...
extsep = '.'
linesep = '\n'
name = 'posix'
pardir = '..'
pathconf_names = {'PC_ALLOC_SIZE_MIN': 18, 'PC_ASYNC_IO': 10, 'PC_CHOW...
pathsep = ':'
sep = '/'
supports_bytes_environ = True
sysconf_names = {'SC_2_CHAR_TERM': 95, 'SC_2_C_BIND': 47, 'SC_2_C_DEV'...
FILE
/usr/local/lib/python3.10/[Link]
NAME
itertools - Functional tools for creating and using iterators.
DESCRIPTION
Infinite iterators:
count(start=0, step=1) --> start, start+step, start+2*step, ...
cycle(p) --> p0, p1, ... plast, p0, p1, ...
repeat(elem [,n]) --> elem, elem, elem, ... endlessly or up to n times
Combinatoric generators:
product(p, q, ... [repeat=1]) --> cartesian product
permutations(p[, r])
combinations(p, r)
combinations_with_replacement(p, r)
CLASSES
[Link]
accumulate
chain
combinations
combinations_with_replacement
compress
count
cycle
dropwhile
filterfalse
groupby
islice
pairwise
permutations
product
repeat
starmap
takewhile
zip_longest
class accumulate([Link])
| accumulate(iterable, func=None, *, initial=None)
|
| Return series of accumulated sums (or other binary function results).
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class chain([Link])
| chain(*iterables) --> chain object
|
| Return a chain object whose .__next__() method returns elements from
the
| first iterable until it is exhausted, then elements from the next
| iterable, until all of the iterables are exhausted.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| from_iterable(iterable, /) from [Link]
| Alternative chain() constructor taking a single iterable argument
that evaluates lazily.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class combinations([Link])
| combinations(iterable, r)
|
| Return successive r-length combinations of elements in the iterable.
|
| combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| __sizeof__(...)
| Returns size in memory, in bytes.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class combinations_with_replacement([Link])
| combinations_with_replacement(iterable, r)
|
| Return successive r-length combinations of elements in the iterable
allowing individual elements to have successive repeats.
|
| combinations_with_replacement('ABC', 2) --> ('A','A'), ('A','B'),
('A','C'), ('B','B'), ('B','C'), ('C','C')
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| __sizeof__(...)
| Returns size in memory, in bytes.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class compress([Link])
| compress(data, selectors)
|
| Return data elements corresponding to true selector elements.
|
| Forms a shorter iterator from selected data elements using the
selectors to
| choose the data elements.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class count([Link])
| count(start=0, step=1)
|
| Return a count object whose .__next__() method returns consecutive
values.
|
| Equivalent to:
| def count(firstval=0, step=1):
| x = firstval
| while 1:
| yield x
| x += step
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class cycle([Link])
| cycle(iterable, /)
|
| Return elements from the iterable until it is exhausted. Then repeat
the sequence indefinitely.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class dropwhile([Link])
| dropwhile(predicate, iterable, /)
|
| Drop items from the iterable while predicate(item) is true.
|
| Afterwards, return every element until the iterable is exhausted.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class filterfalse([Link])
| filterfalse(function, iterable, /)
|
| Return those items of iterable for which function(item) is false.
|
| If function is None, return the items that are false.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class groupby([Link])
| groupby(iterable, key=None)
|
| make an iterator that returns consecutive keys and groups from the
iterable
|
| iterable
| Elements to divide into groups according to the key function.
| key
| A function for computing the group category for each element.
| If the key function is not specified or is None, the element itself
| is used for grouping.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class islice([Link])
| islice(iterable, stop) --> islice object
| islice(iterable, start, stop[, step]) --> islice object
|
| Return an iterator whose next() method returns selected values from an
| iterable. If start is specified, will skip all preceding elements;
| otherwise, start defaults to zero. Step defaults to one. If
| specified as another value, step determines how many values are
| skipped between successive calls. Works like a slice() on a list
| but returns an iterator.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class pairwise([Link])
| pairwise(iterable, /)
|
| Return an iterator of overlapping pairs taken from the input iterator.
|
| s -> (s0,s1), (s1,s2), (s2, s3), ...
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class permutations([Link])
| permutations(iterable, r=None)
|
| Return successive r-length permutations of elements in the iterable.
|
| permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| __sizeof__(...)
| Returns size in memory, in bytes.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class product([Link])
| product(*iterables, repeat=1) --> product object
|
| Cartesian product of input iterables. Equivalent to nested for-loops.
|
| For example, product(A, B) returns the same as: ((x,y) for x in A for
y in B).
| The leftmost iterators are in the outermost for-loop, so the output
tuples
| cycle in a manner similar to an odometer (with the rightmost element
changing
| on every iteration).
|
| To compute the product of an iterable with itself, specify the number
| of repetitions with the optional repeat keyword argument. For example,
| product(A, repeat=4) means the same as product(A, A, A, A).
|
| product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1)
('b',2)
| product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1)
(1,0,0) ...
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| __sizeof__(...)
| Returns size in memory, in bytes.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class repeat([Link])
| repeat(object [,times]) -> create an iterator which returns the object
| for the specified number of times. If not specified, returns the
object
| endlessly.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __length_hint__(...)
| Private method returning an estimate of len(list(it)).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class starmap([Link])
| starmap(function, iterable, /)
|
| Return an iterator whose values are returned from the function
evaluated with an argument tuple taken from the given sequence.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class takewhile([Link])
| takewhile(predicate, iterable, /)
|
| Return successive entries from an iterable as long as the predicate
evaluates to true for each entry.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class zip_longest([Link])
| zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest
object
|
| Return a zip_longest object whose .__next__() method returns a tuple
where
| the i-th element comes from the i-th iterable argument.
The .__next__()
| method continues until the longest iterable in the argument sequence
| is exhausted and then it raises StopIteration. When the shorter
iterables
| are exhausted, the fillvalue is substituted in their place. The
fillvalue
| defaults to None or can be specified by a keyword argument.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Return state information for pickling.
|
| __setstate__(...)
| Set state information for unpickling.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
FUNCTIONS
tee(iterable, n=2, /)
Returns a tuple of n independent iterators.
FILE
(built-in)
NAME
collections
MODULE REFERENCE
[Link]
DESCRIPTION
This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
PACKAGE CONTENTS
abc
SUBMODULES
_collections_abc
CLASSES
[Link]([Link])
Counter
OrderedDict
defaultdict
[Link]
deque
[Link]([Link])
ChainMap
UserDict
[Link]([Link])
UserList
[Link]([Link],
[Link])
UserString
class ChainMap([Link])
| ChainMap(*maps)
|
| A ChainMap groups multiple dicts (or other mappings) together
| to create a single, updateable view.
|
| The underlying mappings are stored in a list. That list is public and
can
| be accessed or updated using the *maps* attribute. There is no other
| state.
|
| Lookups search the underlying mappings successively until a key is
found.
| In contrast, writes, updates, and deletions only operate on the first
| mapping.
|
| Method resolution order:
| ChainMap
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
|
| Methods defined here:
|
| __bool__(self)
|
| __contains__(self, key)
|
| __copy__ = copy(self)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, *maps)
| Initialize a ChainMap by setting *maps* to the given mappings.
| If no mappings are provided, a single empty dictionary is used.
|
| __ior__(self, other)
|
| __iter__(self)
|
| __len__(self)
|
| __missing__(self, key)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, value)
|
| clear(self)
| Clear maps[0], leaving maps[1:] intact.
|
| copy(self)
| New ChainMap or subclass with a new copy of maps[0] and refs to
maps[1:]
|
| get(self, key, default=None)
| [Link](k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| new_child(self, m=None, **kwargs)
| New ChainMap with a new map followed by all previous maps.
| If no map is provided, an empty dict is used.
| Keyword arguments update the map or new empty dict.
|
| pop(self, key, *args)
| Remove *key* from maps[0] and return its value. Raise KeyError if
*key* not in maps[0].
|
| popitem(self)
| Remove and return an item pair from maps[0]. Raise KeyError is
maps[0] is empty.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, *args) from [Link]
| Create a ChainMap with a single dict created from the iterable.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| parents
| New ChainMap from maps[1:].
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| setdefault(self, key, default=None)
| [Link](k[,d]) -> [Link](k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| [Link]([E, ]**F) -> None. Update D from mapping/iterable E and
F.
| If E present and has a .keys() method, does: for k in E: D[k]
= E[k]
| If E present and lacks .keys() method, does: for (k, v) in E:
D[k] = v
| In either case, this is followed by: for k, v in [Link](): D[k] =
v
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __eq__(self, other)
| Return self==value.
|
| items(self)
| [Link]() -> a set-like object providing a view on D's items
|
| keys(self)
| [Link]() -> a set-like object providing a view on D's keys
|
| values(self)
| [Link]() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from [Link]:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __subclasshook__(C) from [Link]
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by [Link].__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__ = GenericAlias(...) from [Link]
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is
(int,).
class Counter([Link])
| Counter(iterable=None, /, **kwds)
|
| Dict subclass for counting hashable items. Sometimes called a bag
| or multiset. Elements are stored as dictionary keys and their counts
| are stored as dictionary values.
|
| >>> c = Counter('abcdeabcdabcaba') # count elements from a string
|
| >>> c.most_common(3) # three most common elements
| [('a', 5), ('b', 4), ('c', 3)]
| >>> sorted(c) # list all unique elements
| ['a', 'b', 'c', 'd', 'e']
| >>> ''.join(sorted([Link]())) # list elements with repetitions
| 'aaaaabbbbcccdde'
| >>> sum([Link]()) # total of all counts
| 15
|
| >>> c['a'] # count of letter 'a'
| 5
| >>> for elem in 'shazam': # update counts from an iterable
| ... c[elem] += 1 # by adding 1 to each element's
count
| >>> c['a'] # now there are seven 'a'
| 7
| >>> del c['b'] # remove all 'b'
| >>> c['b'] # now there are zero 'b'
| 0
|
| >>> d = Counter('simsalabim') # make another counter
| >>> [Link](d) # add in the second counter
| >>> c['a'] # now there are nine 'a'
| 9
|
| >>> [Link]() # empty the counter
| >>> c
| Counter()
|
| Note: If a count is set to zero or reduced to zero, it will remain
| in the counter until the entry is deleted or the counter is cleared:
|
| >>> c = Counter('aaabbc')
| >>> c['b'] -= 2 # reduce the count of 'b' by two
| >>> c.most_common() # 'b' is still in, but its count
is zero
| [('a', 3), ('c', 1), ('b', 0)]
|
| Method resolution order:
| Counter
| [Link]
| [Link]
|
| Methods defined here:
|
| __add__(self, other)
| Add counts from two counters.
|
| >>> Counter('abbb') + Counter('bcc')
| Counter({'b': 4, 'c': 2, 'a': 1})
|
| __and__(self, other)
| Intersection is the minimum of corresponding counts.
|
| >>> Counter('abbb') & Counter('bcc')
| Counter({'b': 1})
|
| __delitem__(self, elem)
| Like dict.__delitem__() but does not raise KeyError for missing
values.
|
| __eq__(self, other)
| True if all counts agree. Missing counts are treated as zero.
|
| __ge__(self, other)
| True if all counts in self are a superset of those in other.
|
| __gt__(self, other)
| True if all counts in self are a proper superset of those in
other.
|
| __iadd__(self, other)
| Inplace add from another counter, keeping only positive counts.
|
| >>> c = Counter('abbb')
| >>> c += Counter('bcc')
| >>> c
| Counter({'b': 4, 'c': 2, 'a': 1})
|
| __iand__(self, other)
| Inplace intersection is the minimum of corresponding counts.
|
| >>> c = Counter('abbb')
| >>> c &= Counter('bcc')
| >>> c
| Counter({'b': 1})
|
| __init__(self, iterable=None, /, **kwds)
| Create a new, empty Counter object. And if given, count elements
| from an input iterable. Or, initialize the count from another
mapping
| of elements to their counts.
|
| >>> c = Counter() # a new, empty counter
| >>> c = Counter('gallahad') # a new counter from
an iterable
| >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a
mapping
| >>> c = Counter(a=4, b=2) # a new counter from
keyword args
|
| __ior__(self, other)
| Inplace union is the maximum of value from either counter.
|
| >>> c = Counter('abbb')
| >>> c |= Counter('bcc')
| >>> c
| Counter({'b': 3, 'c': 2, 'a': 1})
|
| __isub__(self, other)
| Inplace subtract counter, but keep only results with positive
counts.
|
| >>> c = Counter('abbbc')
| >>> c -= Counter('bccd')
| >>> c
| Counter({'b': 2, 'a': 1})
|
| __le__(self, other)
| True if all counts in self are a subset of those in other.
|
| __lt__(self, other)
| True if all counts in self are a proper subset of those in other.
|
| __missing__(self, key)
| The count of elements not in the Counter is zero.
|
| __ne__(self, other)
| True if any counts disagree. Missing counts are treated as zero.
|
| __neg__(self)
| Subtracts from an empty counter. Strips positive and zero counts,
| and flips the sign on negative counts.
|
| __or__(self, other)
| Union is the maximum of value in either of the input counters.
|
| >>> Counter('abbb') | Counter('bcc')
| Counter({'b': 3, 'c': 2, 'a': 1})
|
| __pos__(self)
| Adds an empty counter, effectively stripping negative and zero
counts
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| __sub__(self, other)
| Subtract count, but keep only results with positive counts.
|
| >>> Counter('abbbc') - Counter('bccd')
| Counter({'b': 2, 'a': 1})
|
| copy(self)
| Return a shallow copy.
|
| elements(self)
| Iterator over elements repeating each as many times as its count.
|
| >>> c = Counter('ABCABC')
| >>> sorted([Link]())
| ['A', 'A', 'B', 'B', 'C', 'C']
|
| # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
| >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
| >>> product = 1
| >>> for factor in prime_factors.elements(): # loop over
factors
| ... product *= factor # and multiply
them
| >>> product
| 1836
|
| Note, if an element's count has been set to zero or is a negative
| number, elements() will ignore it.
|
| most_common(self, n=None)
| List the n most common elements and their counts from the most
| common to the least. If n is None, then list all element counts.
|
| >>> Counter('abracadabra').most_common(3)
| [('a', 5), ('b', 2), ('r', 2)]
|
| subtract(self, iterable=None, /, **kwds)
| Like [Link]() but subtracts counts instead of replacing them.
| Counts can be reduced below zero. Both the inputs and outputs are
| allowed to contain zero and negative counts.
|
| Source can be an iterable, a dictionary, or another Counter
instance.
|
| >>> c = Counter('which')
| >>> [Link]('witch') # subtract elements from
another iterable
| >>> [Link](Counter('watch')) # subtract elements from
another counter
| >>> c['h'] # 2 in which, minus 1 in
witch, minus 1 in watch
| 0
| >>> c['w'] # 1 in which, minus 1 in
witch, minus 1 in watch
| -1
|
| total(self)
| Sum of the counts
|
| update(self, iterable=None, /, **kwds)
| Like [Link]() but add counts instead of replacing them.
|
| Source can be an iterable, a dictionary, or another Counter
instance.
|
| >>> c = Counter('which')
| >>> [Link]('witch') # add elements from another
iterable
| >>> d = Counter('watch')
| >>> [Link](d) # add elements from another
counter
| >>> c['h'] # four 'h' in which, witch, and
watch
| 4
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, v=None) from [Link]
| Create a new dictionary with keys from iterable and values set to
value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __iter__(self, /)
| Implement iter(self).
|
| __len__(self, /)
| Return len(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| [Link]() -> None. Remove all items from D.
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else
default.
|
| items(...)
| [Link]() -> a set-like object providing a view on D's items
|
| keys(...)
| [Link]() -> a set-like object providing a view on D's keys
|
| pop(...)
| [Link](k[,d]) -> v, remove specified key and return the
corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the
dictionary.
|
| Return the value for key if key is in the dictionary, else
default.
|
| values(...)
| [Link]() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from [Link]:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class OrderedDict([Link])
| Dictionary that remembers insertion order
|
| Method resolution order:
| OrderedDict
| [Link]
| [Link]
|
| Methods defined here:
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __reduce__(...)
| Return state information for pickling
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
| od.__reversed__() <==> reversed(od)
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| [Link]() -> None. Remove all items from od.
|
| copy(...)
| [Link]() -> a shallow copy of od
|
| items(...)
| [Link]() -> a set-like object providing a view on D's items
|
| keys(...)
| [Link]() -> a set-like object providing a view on D's keys
|
| move_to_end(self, /, key, last=True)
| Move an existing element to the end (or beginning if last is
false).
|
| Raise KeyError if the element does not exist.
|
| pop(...)
| [Link](key[,default]) -> v, remove specified key and return the
corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /, last=True)
| Remove and return a (key, value) pair from the dictionary.
|
| Pairs are returned in LIFO order if last is true or FIFO order if
false.
|
| setdefault(self, /, key, default=None)
| Insert key with a value of default if key is not in the
dictionary.
|
| Return the value for key if key is in the dictionary, else
default.
|
| update(...)
| [Link]([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E:
D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v
in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| [Link]() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, value=None) from [Link]
| Create a new ordered dictionary with keys from iterable and values
set to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __len__(self, /)
| Return len(self).
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else
default.
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from [Link]:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
class UserDict([Link])
| UserDict(dict=None, /, **kwargs)
|
| Method resolution order:
| UserDict
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
|
| Methods defined here:
|
| __contains__(self, key)
| # Modify __contains__ to work correctly when __missing__ is
present
|
| __copy__(self)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, dict=None, /, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other)
|
| __iter__(self)
|
| __len__(self)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, item)
|
| copy(self)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, value=None) from [Link]
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| clear(self)
| [Link]() -> None. Remove all items from D.
|
| pop(self, key, default=<object object at 0x7fc5385603f0>)
| [Link](k[,d]) -> v, remove specified key and return the
corresponding value.
| If key is not found, d is returned if given, otherwise KeyError is
raised.
|
| popitem(self)
| [Link]() -> (k, v), remove and return some (key, value) pair
| as a 2-tuple; but raise KeyError if D is empty.
|
| setdefault(self, key, default=None)
| [Link](k[,d]) -> [Link](k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| [Link]([E, ]**F) -> None. Update D from mapping/iterable E and
F.
| If E present and has a .keys() method, does: for k in E: D[k]
= E[k]
| If E present and lacks .keys() method, does: for (k, v) in E:
D[k] = v
| In either case, this is followed by: for k, v in [Link](): D[k] =
v
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __eq__(self, other)
| Return self==value.
|
| get(self, key, default=None)
| [Link](k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| items(self)
| [Link]() -> a set-like object providing a view on D's items
|
| keys(self)
| [Link]() -> a set-like object providing a view on D's keys
|
| values(self)
| [Link]() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from [Link]:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __subclasshook__(C) from [Link]
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by [Link].__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__ = GenericAlias(...) from [Link]
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is
(int,).
class UserList([Link])
| UserList(initlist=None)
|
| A more or less complete user-defined wrapper around list objects.
|
| Method resolution order:
| UserList
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
|
| Methods defined here:
|
| __add__(self, other)
|
| __contains__(self, item)
|
| __copy__(self)
|
| __delitem__(self, i)
|
| __eq__(self, other)
| Return self==value.
|
| __ge__(self, other)
| Return self>=value.
|
| __getitem__(self, i)
|
| __gt__(self, other)
| Return self>value.
|
| __iadd__(self, other)
|
| __imul__(self, n)
|
| __init__(self, initlist=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, other)
| Return self<=value.
|
| __len__(self)
|
| __lt__(self, other)
| Return self<value.
|
| __mul__(self, n)
|
| __radd__(self, other)
|
| __repr__(self)
| Return repr(self).
|
| __rmul__ = __mul__(self, n)
|
| __setitem__(self, i, item)
|
| append(self, item)
| [Link](value) -- append value to the end of the sequence
|
| clear(self)
| [Link]() -> None -- remove all items from S
|
| copy(self)
|
| count(self, item)
| [Link](value) -> integer -- return number of occurrences of value
|
| extend(self, other)
| [Link](iterable) -- extend sequence by appending elements from
the iterable
|
| index(self, item, *args)
| [Link](value, [start, [stop]]) -> integer -- return first index
of value.
| Raises ValueError if the value is not present.
|
| Supporting start and stop arguments is optional, but
| recommended.
|
| insert(self, i, item)
| [Link](index, value) -- insert value before index
|
| pop(self, i=-1)
| [Link]([index]) -> item -- remove and return item at index (default
last).
| Raise IndexError if list is empty or index is out of range.
|
| remove(self, item)
| [Link](value) -- remove first occurrence of value.
| Raise ValueError if the value is not present.
|
| reverse(self)
| [Link]() -- reverse *IN PLACE*
|
| sort(self, /, *args, **kwds)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __subclasshook__(C) from [Link]
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by [Link].__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__ = GenericAlias(...) from [Link]
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is
(int,).
class UserString([Link])
| UserString(seq)
|
| Method resolution order:
| UserString
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
| [Link]
|
| Methods defined here:
|
| __add__(self, other)
|
| __complex__(self)
|
| __contains__(self, char)
|
| __eq__(self, string)
| Return self==value.
|
| __float__(self)
|
| __ge__(self, string)
| Return self>=value.
|
| __getitem__(self, index)
|
| __getnewargs__(self)
|
| __gt__(self, string)
| Return self>value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, seq)
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self)
|
| __le__(self, string)
| Return self<=value.
|
| __len__(self)
|
| __lt__(self, string)
| Return self<value.
|
| __mod__(self, args)
|
| __mul__(self, n)
|
| __radd__(self, other)
|
| __repr__(self)
| Return repr(self).
|
| __rmod__(self, template)
|
| __rmul__ = __mul__(self, n)
|
| __str__(self)
| Return str(self).
|
| capitalize(self)
| # the following methods are defined in alphabetical order:
|
| casefold(self)
|
| center(self, width, *args)
|
| count(self, sub, start=0, end=9223372036854775807)
| [Link](value) -> integer -- return number of occurrences of value
|
| encode(self, encoding='utf-8', errors='strict')
|
| endswith(self, suffix, start=0, end=9223372036854775807)
|
| expandtabs(self, tabsize=8)
|
| find(self, sub, start=0, end=9223372036854775807)
|
| format(self, /, *args, **kwds)
|
| format_map(self, mapping)
|
| index(self, sub, start=0, end=9223372036854775807)
| [Link](value, [start, [stop]]) -> integer -- return first index
of value.
| Raises ValueError if the value is not present.
|
| Supporting start and stop arguments is optional, but
| recommended.
|
| isalnum(self)
|
| isalpha(self)
|
| isascii(self)
|
| isdecimal(self)
|
| isdigit(self)
|
| isidentifier(self)
|
| islower(self)
|
| isnumeric(self)
|
| isprintable(self)
|
| isspace(self)
|
| istitle(self)
|
| isupper(self)
|
| join(self, seq)
|
| ljust(self, width, *args)
|
| lower(self)
|
| lstrip(self, chars=None)
|
| partition(self, sep)
|
| removeprefix(self, prefix, /)
|
| removesuffix(self, suffix, /)
|
| replace(self, old, new, maxsplit=-1)
|
| rfind(self, sub, start=0, end=9223372036854775807)
|
| rindex(self, sub, start=0, end=9223372036854775807)
|
| rjust(self, width, *args)
|
| rpartition(self, sep)
|
| rsplit(self, sep=None, maxsplit=-1)
|
| rstrip(self, chars=None)
|
| split(self, sep=None, maxsplit=-1)
|
| splitlines(self, keepends=False)
|
| startswith(self, prefix, start=0, end=9223372036854775807)
|
| strip(self, chars=None)
|
| swapcase(self)
|
| title(self)
|
| translate(self, *args)
|
| upper(self)
|
| zfill(self, width)
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| maketrans(...)
| Return a translation table usable for [Link]().
|
| If there is only one argument, it must be a dictionary mapping
Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or
None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length,
and
| in the resulting dictionary, each character in x will be mapped to
the
| character at the same position in y. If there is a third argument,
it
| must be a string, whose characters will be mapped to None in the
result.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __subclasshook__(C) from [Link]
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by [Link].__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| __class_getitem__ = GenericAlias(...) from [Link]
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is
(int,).
class defaultdict([Link])
| defaultdict(default_factory=None, /, [...]) --> dict with default
factory
|
| The default factory is called without arguments to produce
| a new value when a key is not present, in __getitem__ only.
| A defaultdict compares equal to a dict with the same items.
| All remaining arguments are treated the same as if they were
| passed to the dict constructor, including keyword arguments.
|
| Method resolution order:
| defaultdict
| [Link]
| [Link]
|
| Methods defined here:
|
| __copy__(...)
| [Link]() -> a shallow copy of D.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __missing__(...)
| __missing__(key) # Called by __getitem__ for missing key; pseudo-
code:
| if self.default_factory is None: raise KeyError((key,))
| self[key] = value = self.default_factory()
| return value
|
| __or__(self, value, /)
| Return self|value.
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| __ror__(self, value, /)
| Return value|self.
|
| copy(...)
| [Link]() -> a shallow copy of D.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| default_factory
| Factory for default value called by __missing__().
|
| ----------------------------------------------------------------------
| Methods inherited from [Link]:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| [Link]() -> None. Remove all items from D.
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else
default.
|
| items(...)
| [Link]() -> a set-like object providing a view on D's items
|
| keys(...)
| [Link]() -> a set-like object providing a view on D's keys
|
| pop(...)
| [Link](k[,d]) -> v, remove specified key and return the
corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the
dictionary.
|
| Return the value for key if key is in the dictionary, else
default.
|
| update(...)
| [Link]([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E:
D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v
in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| [Link]() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from [Link]:
|
| fromkeys(iterable, value=None, /) from [Link]
| Create a new dictionary with keys from iterable and values set to
value.
|
| ----------------------------------------------------------------------
| Static methods inherited from [Link]:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from [Link]:
|
| __hash__ = None
class deque([Link])
| deque([iterable[, maxlen]]) --> deque object
|
| A list-like sequence optimized for data accesses near its endpoints.
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __contains__(self, key, /)
| Return key in self.
|
| __copy__(...)
| Return a shallow copy of a deque.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iadd__(self, value, /)
| Implement self+=value.
|
| __imul__(self, value, /)
| Implement self*=value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
| D.__reversed__() -- return a reverse iterator over the deque
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -- size of D in memory, in bytes
|
| append(...)
| Add an element to the right side of the deque.
|
| appendleft(...)
| Add an element to the left side of the deque.
|
| clear(...)
| Remove all elements from the deque.
|
| copy(...)
| Return a shallow copy of a deque.
|
| count(...)
| [Link](value) -> integer -- return number of occurrences of value
|
| extend(...)
| Extend the right side of the deque with elements from the iterable
|
| extendleft(...)
| Extend the left side of the deque with elements from the iterable
|
| index(...)
| [Link](value, [start, [stop]]) -> integer -- return first index
of value.
| Raises ValueError if the value is not present.
|
| insert(...)
| [Link](index, object) -- insert object before index
|
| pop(...)
| Remove and return the rightmost element.
|
| popleft(...)
| Remove and return the leftmost element.
|
| remove(...)
| [Link](value) -- remove first occurrence of value.
|
| reverse(...)
| [Link]() -- reverse *IN PLACE*
|
| rotate(...)
| Rotate the deque n steps to the right (default n=1). If n is
negative, rotates left.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...) from [Link]
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from [Link]
| Create and return a new object. See help(type) for accurate
signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| maxlen
| maximum size of a deque or None if unbounded
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
FUNCTIONS
namedtuple(typename, field_names, *, rename=False, defaults=None,
module=None)
Returns a new subclass of tuple with named fields.
DATA
__all__ = ['ChainMap', 'Counter', 'OrderedDict', 'UserDict', 'UserList...
FILE
/usr/local/lib/python3.10/collections/__init__.py