logging API Reference
Full documentation for logging (0.5.1.2)
logging.BASIC_FORMAT
Error rendering doc: No Python documentation found for '%(levelname)s:%(name)s:%(message)s'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
logging.BufferingFormatter
Python Library Documentation: class BufferingFormatter in module logging class BufferingFormatter(builtins.object) | BufferingFormatter(linefmt=None) | | A formatter suitable for formatting a number of records. | | Methods defined here: | | __init__(self, linefmt=None) | Optionally specify a formatter which will be used to format each | individual record. | | format(self, records) | Format the specified records and return the result as a string. | | formatFooter(self, records) | Return the footer string for the specified records. | | formatHeader(self, records) | Return the header string for the specified records. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.CRITICAL
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.DEBUG
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.ERROR
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.FATAL
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.FileHandler
Python Library Documentation: class FileHandler in module logging class FileHandler(StreamHandler) | FileHandler(filename, mode='a', encoding=None, delay=False, errors=None) | | A handler class which writes formatted logging records to disk files. | | Method resolution order: | FileHandler | StreamHandler | Handler | Filterer | builtins.object | | Methods defined here: | | __init__(self, filename, mode='a', encoding=None, delay=False, errors=None) | Open the specified file and use it as the stream for logging. | | __repr__(self) | Return repr(self). | | close(self) | Closes the stream. | | emit(self, record) | Emit a record. | | If the stream was not opened because 'delay' was specified in the | constructor, open it before calling the superclass's emit. | | If stream is not open, current mode is 'w' and `_closed=True`, record | will not be emitted (see Issue #42378). | | ---------------------------------------------------------------------- | Methods inherited from StreamHandler: | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from Handler: | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.Filter
Python Library Documentation: class Filter in module logging class Filter(builtins.object) | Filter(name='') | | Filter instances are used to perform arbitrary filtering of LogRecords. | | Loggers and Handlers can optionally use Filter instances to filter | records as desired. The base filter class only allows events which are | below a certain point in the logger hierarchy. For example, a filter | initialized with "A.B" will allow events logged by loggers "A.B", | "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If | initialized with the empty string, all events are passed. | | Methods defined here: | | __init__(self, name='') | Initialize a filter. | | Initialize with the name of the logger which, together with its | children, will have its events allowed through the filter. If no | name is specified, allow every event. | | filter(self, record) | Determine if the specified record is to be logged. | | Returns True if the record should be logged, or False otherwise. | If deemed appropriate, the record may be modified in-place. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.Filterer
Python Library Documentation: class Filterer in module logging class Filterer(builtins.object) | A base class for loggers and handlers which allows them to share | common code. | | Methods defined here: | | __init__(self) | Initialize the list of filters to be an empty list. | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.Formatter
Python Library Documentation: class Formatter in module logging
class Formatter(builtins.object)
| Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
|
| Formatter instances are used to convert a LogRecord to text.
|
| Formatters need to know how a LogRecord is constructed. They are
| responsible for converting a LogRecord to (usually) a string which can
| be interpreted by either a human or an external system. The base Formatter
| allows a formatting string to be specified. If none is supplied, the
| style-dependent default value, "%(message)s", "{message}", or
| "${message}", is used.
|
| The Formatter can be initialized with a format string which makes use of
| knowledge of the LogRecord attributes - e.g. the default value mentioned
| above makes use of the fact that the user's message and arguments are pre-
| formatted into a LogRecord's message attribute. Currently, the useful
| attributes in a LogRecord are described by:
|
| %(name)s Name of the logger (logging channel)
| %(levelno)s Numeric logging level for the message (DEBUG, INFO,
| WARNING, ERROR, CRITICAL)
| %(levelname)s Text logging level for the message ("DEBUG", "INFO",
| "WARNING", "ERROR", "CRITICAL")
| %(pathname)s Full pathname of the source file where the logging
| call was issued (if available)
| %(filename)s Filename portion of pathname
| %(module)s Module (name portion of filename)
| %(lineno)d Source line number where the logging call was issued
| (if available)
| %(funcName)s Function name
| %(created)f Time when the LogRecord was created (time.time()
| return value)
| %(asctime)s Textual time when the LogRecord was created
| %(msecs)d Millisecond portion of the creation time
| %(relativeCreated)d Time in milliseconds when the LogRecord was created,
| relative to the time the logging module was loaded
| (typically at application startup time)
| %(thread)d Thread ID (if available)
| %(threadName)s Thread name (if available)
| %(taskName)s Task name (if available)
| %(process)d Process ID (if available)
| %(message)s The result of record.getMessage(), computed just as
| the record is emitted
|
| Methods defined here:
|
| __init__(self, fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
| Initialize the formatter with specified format strings.
|
| Initialize the formatter either with the specified format string, or a
| default as described above. Allow for specialized date formatting with
| the optional datefmt argument. If datefmt is omitted, you get an
| ISO8601-like (or RFC 3339-like) format.
|
| Use a style parameter of '%', '{' or '$' to specify that you want to
| use one of %-formatting, :meth:`str.format` (``{}``) formatting or
| :class:`string.Template` formatting in your format string.
|
| .. versionchanged:: 3.2
| Added the ``style`` parameter.
|
| format(self, record)
| Format the specified record as text.
|
| The record's attribute dictionary is used as the operand to a
| string formatting operation which yields the returned string.
| Before formatting the dictionary, a couple of preparatory steps
| are carried out. The message attribute of the record is computed
| using LogRecord.getMessage(). If the formatting string uses the
| time (as determined by a call to usesTime(), formatTime() is
| called to format the event time. If there is exception information,
| it is formatted using formatException() and appended to the message.
|
| formatException(self, ei)
| Format and return the specified exception information as a string.
|
| This default implementation just uses
| traceback.print_exception()
|
| formatMessage(self, record)
|
| formatStack(self, stack_info)
| This method is provided as an extension point for specialized
| formatting of stack information.
|
| The input data is a string as returned from a call to
| :func:`traceback.print_stack`, but with the last trailing newline
| removed.
|
| The base implementation just returns the value passed in.
|
| formatTime(self, record, datefmt=None)
| Return the creation time of the specified LogRecord as formatted text.
|
| This method should be called from format() by a formatter which
| wants to make use of a formatted time. This method can be overridden
| in formatters to provide for any specific requirement, but the
| basic behaviour is as follows: if datefmt (a string) is specified,
| it is used with time.strftime() to format the creation time of the
| record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.
| The resulting string is returned. This function uses a user-configurable
| function to convert the creation time to a tuple. By default,
| time.localtime() is used; to change this for a particular formatter
| instance, set the 'converter' attribute to a function with the same
| signature as time.localtime() or time.gmtime(). To change it for all
| formatters, for example if you want all logging times to be shown in GMT,
| set the 'converter' attribute in the Formatter class.
|
| usesTime(self)
| Check if the format uses the creation time of the record.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| converter = localtime(...)
| localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
| tm_sec,tm_wday,tm_yday,tm_isdst)
|
| Convert seconds since the Epoch to a time tuple expressing local time.
| When 'seconds' is not passed in, convert the current time instead.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| default_msec_format = '%s,%03d'
|
| default_time_format = '%Y-%m-%d %H:%M:%S'
logging.GenericAlias
Python Library Documentation: class GenericAlias in module types class GenericAlias(builtins.object) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | Methods defined here: | | __call__(self, /, *args, **kwargs) | Call self as a function. | | __dir__(...) | Default dir() implementation. | | __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. | | __hash__(self, /) | Return hash(self). | | __instancecheck__(...) | Check if an object is an instance. | | __iter__(self, /) | Implement iter(self). | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __mro_entries__(...) | | __ne__(self, value, /) | Return self!=value. | | __or__(self, value, /) | Return self|value. | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __subclasscheck__(...) | Check if a class is a subclass. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __args__ | | __origin__ | | __parameters__ | Type variables in the GenericAlias. | | __typing_unpacked_tuple_args__ | | __unpacked__
logging.Handler
Python Library Documentation: class Handler in module logging class Handler(Filterer) | Handler(level=0) | | Handler instances dispatch logging events to specific destinations. | | The base handler class. Acts as a placeholder which defines the Handler | interface. Handlers can optionally use Formatter instances to format | records as desired. By default, no formatter is specified; in this case, | the 'raw' message as determined by record.message is logged. | | Method resolution order: | Handler | Filterer | builtins.object | | Methods defined here: | | __init__(self, level=0) | Initializes the instance - basically setting the formatter to None | and the filter list to empty. | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | emit(self, record) | Do whatever it takes to actually log the specified logging record. | | This version is intended to be implemented by subclasses and so | raises a NotImplementedError. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.INFO
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.LogRecord
Python Library Documentation: class LogRecord in module logging class LogRecord(builtins.object) | LogRecord(name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs) | | A LogRecord instance represents an event being logged. | | LogRecord instances are created every time something is logged. They | contain all the information pertinent to the event being logged. The | main information passed in is in msg and args, which are combined | using str(msg) % args to create the message field of the record. The | record also includes information such as when the record was created, | the source line where the logging call was made, and any exception | information to be logged. | | Methods defined here: | | __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs) | Initialize a logging record with interesting information. | | __repr__(self) | Return repr(self). | | getMessage(self) | Return the message for this LogRecord. | | Return the message for this LogRecord after merging any user-supplied | arguments with the message. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.Logger
Python Library Documentation: class Logger in module logging
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
logging.LoggerAdapter
Python Library Documentation: class LoggerAdapter in module logging class LoggerAdapter(builtins.object) | LoggerAdapter(logger, extra=None) | | An adapter for loggers which makes it easier to specify contextual | information in logging output. | | Methods defined here: | | __init__(self, logger, extra=None) | Initialize the adapter with a logger and a dict-like object which | provides contextual information. This constructor signature allows | easy stacking of LoggerAdapters, if so desired. | | You can effectively pass keyword arguments as shown in the | following example: | | adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2")) | | __repr__(self) | Return repr(self). | | critical(self, msg, *args, **kwargs) | Delegate a critical call to the underlying logger. | | debug(self, msg, *args, **kwargs) | Delegate a debug call to the underlying logger. | | error(self, msg, *args, **kwargs) | Delegate an error call to the underlying logger. | | exception(self, msg, *args, exc_info=True, **kwargs) | Delegate an exception call to the underlying logger. | | getEffectiveLevel(self) | Get the effective level for the underlying logger. | | hasHandlers(self) | See if the underlying logger has any handlers. | | info(self, msg, *args, **kwargs) | Delegate an info call to the underlying logger. | | isEnabledFor(self, level) | Is this logger enabled for level 'level'? | | log(self, level, msg, *args, **kwargs) | Delegate a log call to the underlying logger, after adding | contextual information from this adapter instance. | | process(self, msg, kwargs) | Process the logging message and keyword arguments passed in to | a logging call to insert contextual information. You can either | manipulate the message itself, the keyword args or both. Return | the message and kwargs modified (or not) to suit your needs. | | Normally, you'll only need to override this one method in a | LoggerAdapter subclass for your specific needs. | | setLevel(self, level) | Set the specified level on the underlying logger. | | warn(self, msg, *args, **kwargs) | | warning(self, msg, *args, **kwargs) | Delegate a warning call to the underlying logger. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Readonly properties defined here: | | name | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | manager
logging.Manager
Python Library Documentation: class Manager in module logging class Manager(builtins.object) | Manager(rootnode) | | There is [under normal circumstances] just one Manager instance, which | holds the hierarchy of loggers. | | Methods defined here: | | __init__(self, rootnode) | Initialize the manager with the root node of the logger hierarchy. | | getLogger(self, name) | Get a logger with the specified name (channel name), creating it | if it doesn't yet exist. This name is a dot-separated hierarchical | name, such as "a", "a.b", "a.b.c" or similar. | | If a PlaceHolder existed for the specified name [i.e. the logger | didn't exist but a child of it did], replace it with the created | logger and fix up the parent/child references which pointed to the | placeholder to now point to the logger. | | setLogRecordFactory(self, factory) | Set the factory to be used when instantiating a log record with this | Manager. | | setLoggerClass(self, klass) | Set the class to be used when instantiating a logger with this Manager. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | disable
logging.NOTSET
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.NullHandler
Python Library Documentation: class NullHandler in module logging class NullHandler(Handler) | NullHandler(level=0) | | This handler does nothing. It's intended to be used to avoid the | "No handlers could be found for logger XXX" one-off warning. This is | important for library code, which may contain code to log events. If a user | of the library does not configure logging, the one-off warning might be | produced; to avoid this, the library developer simply needs to instantiate | a NullHandler and add it to the top-level logger of the library module or | package. | | Method resolution order: | NullHandler | Handler | Filterer | builtins.object | | Methods defined here: | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | emit(self, record) | Stub. | | handle(self, record) | Stub. | | ---------------------------------------------------------------------- | Methods inherited from Handler: | | __init__(self, level=0) | Initializes the instance - basically setting the formatter to None | and the filter list to empty. | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.PercentStyle
Python Library Documentation: class PercentStyle in module logging
class PercentStyle(builtins.object)
| PercentStyle(fmt, *, defaults=None)
|
| Methods defined here:
|
| __init__(self, fmt, *, defaults=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| format(self, record)
|
| usesTime(self)
|
| validate(self)
| Validate the input format, ensure it matches the correct style
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| asctime_format = '%(asctime)s'
|
| asctime_search = '%(asctime)'
|
| default_format = '%(message)s'
|
| validation_pattern = re.compile('%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\...
logging.PlaceHolder
Python Library Documentation: class PlaceHolder in module logging class PlaceHolder(builtins.object) | PlaceHolder(alogger) | | PlaceHolder instances are used in the Manager logger hierarchy to take | the place of nodes for which no loggers have been defined. This class is | intended for internal use only and not as part of the public API. | | Methods defined here: | | __init__(self, alogger) | Initialize with the specified logger being a child of this placeholder. | | append(self, alogger) | Add the specified logger as a child of this placeholder. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.RootLogger
Python Library Documentation: class RootLogger in module logging
class RootLogger(Logger)
| RootLogger(level)
|
| A root logger is not that different to any other logger, except that
| it must have a logging level and there is only one instance of it in
| the hierarchy.
|
| Method resolution order:
| RootLogger
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, level)
| Initialize the logger with the name "root".
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Methods inherited from Logger:
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Logger:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
logging.StrFormatStyle
Python Library Documentation: class StrFormatStyle in module logging
class StrFormatStyle(PercentStyle)
| StrFormatStyle(fmt, *, defaults=None)
|
| Method resolution order:
| StrFormatStyle
| PercentStyle
| builtins.object
|
| Methods defined here:
|
| validate(self)
| Validate the input format, ensure it is the correct string formatting style
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| asctime_format = '{asctime}'
|
| asctime_search = '{asctime'
|
| default_format = '{message}'
|
| field_spec = re.compile('^(\\d+|\\w+)(\\.\\w+|\\[[^]]+\\])*$')
|
| fmt_spec = re.compile('^(.?[<>=^])?[+ -]?#?0?(\\d+|{\\w+})?...\.(\\d+|...
|
| ----------------------------------------------------------------------
| Methods inherited from PercentStyle:
|
| __init__(self, fmt, *, defaults=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| format(self, record)
|
| usesTime(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from PercentStyle:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from PercentStyle:
|
| validation_pattern = re.compile('%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\...
logging.StreamHandler
Python Library Documentation: class StreamHandler in module logging class StreamHandler(Handler) | StreamHandler(stream=None) | | A handler class which writes logging records, appropriately formatted, | to a stream. Note that this class does not close the stream, as | sys.stdout or sys.stderr may be used. | | Method resolution order: | StreamHandler | Handler | Filterer | builtins.object | | Methods defined here: | | __init__(self, stream=None) | Initialize the handler. | | If stream is not specified, sys.stderr is used. | | __repr__(self) | Return repr(self). | | emit(self, record) | Emit a record. | | If a formatter is specified, it is used to format the record. | The record is then written to the stream with a trailing newline. If | exception information is present, it is formatted using | traceback.print_exception and appended to the stream. If the stream | has an 'encoding' attribute, it is used to determine how to do the | output to the stream. | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from Handler: | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.StringTemplateStyle
Python Library Documentation: class StringTemplateStyle in module logging
class StringTemplateStyle(PercentStyle)
| StringTemplateStyle(*args, **kwargs)
|
| Method resolution order:
| StringTemplateStyle
| PercentStyle
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| usesTime(self)
|
| validate(self)
| Validate the input format, ensure it matches the correct style
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| asctime_format = '${asctime}'
|
| asctime_search = '${asctime}'
|
| default_format = '${message}'
|
| ----------------------------------------------------------------------
| Methods inherited from PercentStyle:
|
| format(self, record)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from PercentStyle:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from PercentStyle:
|
| validation_pattern = re.compile('%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\...
logging.Template
Python Library Documentation: class Template in module string
class Template(builtins.object)
| Template(template)
|
| A string class for supporting $-substitutions.
|
| Methods defined here:
|
| __init__(self, template)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_identifiers(self)
|
| is_valid(self)
|
| safe_substitute(self, mapping={}, /, **kws)
|
| substitute(self, mapping={}, /, **kws)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __init_subclass__()
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| braceidpattern = None
|
| delimiter = '$'
|
| flags = re.IGNORECASE
|
| idpattern = '(?a:[_a-z][_a-z0-9]*)'
|
| pattern = re.compile('\n \\$(?:\n ...identifie...
logging.WARN
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.WARNING
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.addLevelName
Python Library Documentation: function addLevelName in module logging
addLevelName(level, levelName)
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
logging.atexit
Python Library Documentation: built-in module atexit
NAME
atexit
DESCRIPTION
allow programmer to define multiple exit functions to be executed
upon normal program termination.
Two public functions, register and unregister, are defined.
FUNCTIONS
register(...)
register(func, *args, **kwargs) -> func
Register a function to be executed upon normal program termination
func - function to be called at exit
args - optional arguments to pass to func
kwargs - optional keyword arguments to pass to func
func is returned to facilitate usage as a decorator.
unregister(...)
unregister(func) -> None
Unregister an exit function which was previously registered using
atexit.register
func - function to be unregistered
FILE
(built-in)
logging.basicConfig
Python Library Documentation: function basicConfig in module logging
basicConfig(**kwargs)
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured, unless the keyword argument *force* is set to ``True``.
It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
style If a format string is specified, use this to specify the
type of format string (possible values '%', '{', '$', for
%-formatting, :meth:`str.format` and :class:`string.Template`
- defaults to '%').
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
handlers If specified, this should be an iterable of already created
handlers, which will be added to the root logger. Any handler
in the list which does not have a formatter assigned will be
assigned the formatter created in this function.
force If this keyword is specified as true, any existing handlers
attached to the root logger are removed and closed, before
carrying out the configuration as specified by the other
arguments.
encoding If specified together with a filename, this encoding is passed to
the created FileHandler, causing it to be used when the file is
opened.
errors If specified together with a filename, this value is passed to the
created FileHandler, causing it to be used when the file is
opened in text mode. If not specified, the default value is
`backslashreplace`.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
.. versionchanged:: 3.2
Added the ``style`` parameter.
.. versionchanged:: 3.3
Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
incompatible arguments (e.g. ``handlers`` specified together with
``filename``/``filemode``, or ``filename``/``filemode`` specified
together with ``stream``, or ``handlers`` specified together with
``stream``.
.. versionchanged:: 3.8
Added the ``force`` parameter.
.. versionchanged:: 3.9
Added the ``encoding`` and ``errors`` parameters.
logging.captureWarnings
Python Library Documentation: function captureWarnings in module logging
captureWarnings(capture)
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
logging.collections
Python Library Documentation: package collections
NAME
collections
MODULE REFERENCE
https://docs.python.org/3.12/library/collections.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
* namedtuple factory function for creating tuple subclasses with named fields
* deque list-like container with fast appends and pops on either end
* ChainMap dict-like class for creating a single view of multiple mappings
* Counter dict subclass for counting hashable objects
* OrderedDict dict subclass that remembers the order entries were added
* defaultdict dict subclass that calls a factory function to supply missing values
* UserDict wrapper around dictionary objects for easier dict subclassing
* UserList wrapper around list objects for easier list subclassing
* UserString wrapper around string objects for easier string subclassing
PACKAGE CONTENTS
abc
SUBMODULES
_collections_abc
CLASSES
builtins.dict(builtins.object)
Counter
OrderedDict
defaultdict
builtins.object
deque
collections.abc.MutableMapping(collections.abc.Mapping)
ChainMap
UserDict
collections.abc.MutableSequence(collections.abc.Sequence)
UserList
collections.abc.Sequence(collections.abc.Reversible, collections.abc.Collection)
UserString
class ChainMap(collections.abc.MutableMapping)
| 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
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| 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)
| D.get(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)
| 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
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| setdefault(self, key, default=None)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| D.update([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 F.items(): D[k] = v
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class Counter(builtins.dict)
| 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(c.elements())) # list elements with repetitions
| 'aaaaabbbbcccdde'
| >>> sum(c.values()) # 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
| >>> c.update(d) # add in the second counter
| >>> c['a'] # now there are nine 'a'
| 9
|
| >>> c.clear() # 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
| builtins.dict
| builtins.object
|
| 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(c.elements())
| ['A', 'A', 'B', 'B', 'C', 'C']
|
| Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
|
| >>> import math
| >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
| >>> math.prod(prime_factors.elements())
| 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 dict.update() 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')
| >>> c.subtract('witch') # subtract elements from another iterable
| >>> c.subtract(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 dict.update() but add counts instead of replacing them.
|
| Source can be an iterable, a dictionary, or another Counter instance.
|
| >>> c = Counter('which')
| >>> c.update('witch') # add elements from another iterable
| >>> d = Counter('watch')
| >>> c.update(d) # add elements from another counter
| >>> c['h'] # four 'h' in which, witch, and watch
| 4
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, v=None)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __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(...)
| D.clear() -> 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(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(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(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
class OrderedDict(builtins.dict)
| Dictionary that remembers insertion order
|
| Method resolution order:
| OrderedDict
| builtins.dict
| builtins.object
|
| 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(...)
| od.clear() -> None. Remove all items from od.
|
| copy(...)
| od.copy() -> a shallow copy of od
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> 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(...)
| od.pop(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(...)
| D.update([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(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, value=None)
| 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 builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __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 builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
class UserDict(collections.abc.MutableMapping)
| UserDict(dict=None, /, **kwargs)
|
| Method resolution order:
| UserDict
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __contains__(self, key)
| # Modify __contains__ and get() to work like dict
| # does 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)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, value=None)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| pop(self, key, default=<object object at 0x00000172058C81F0>)
| D.pop(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)
| D.popitem() -> (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)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| D.update([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 F.items(): D[k] = v
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class UserList(collections.abc.MutableSequence)
| UserList(initlist=None)
|
| A more or less complete user-defined wrapper around list objects.
|
| Method resolution order:
| UserList
| collections.abc.MutableSequence
| collections.abc.Sequence
| collections.abc.Reversible
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| 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)
| S.append(value) -- append value to the end of the sequence
|
| clear(self)
| S.clear() -> None -- remove all items from S
|
| copy(self)
|
| count(self, item)
| S.count(value) -> integer -- return number of occurrences of value
|
| extend(self, other)
| S.extend(iterable) -- extend sequence by appending elements from the iterable
|
| index(self, item, *args)
| S.index(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)
| S.insert(index, value) -- insert value before index
|
| pop(self, i=-1)
| S.pop([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)
| S.remove(value) -- remove first occurrence of value.
| Raise ValueError if the value is not present.
|
| reverse(self)
| S.reverse() -- reverse *IN PLACE*
|
| sort(self, /, *args, **kwds)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Sequence:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Reversible:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class UserString(collections.abc.Sequence)
| UserString(seq)
|
| Method resolution order:
| UserString
| collections.abc.Sequence
| collections.abc.Reversible
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| 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)
| S.count(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)
| S.index(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 str.translate().
|
| 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
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Sequence:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Reversible:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class defaultdict(builtins.dict)
| 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
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __copy__(...)
| D.copy() -> 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(...)
| D.copy() -> a shallow copy of D.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| default_factory
| Factory for default value called by __missing__().
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __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__(self, key, /)
| Return self[key].
|
| __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(...)
| D.clear() -> 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(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(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(...)
| D.update([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(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
class deque(builtins.object)
| 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.
|
| __contains__(self, key, /)
| Return bool(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(...)
| D.count(value) -- 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(...)
| D.index(value, [start, [stop]]) -- return first index of value.
| Raises ValueError if the value is not present.
|
| insert(...)
| D.insert(index, object) -- insert object before index
|
| pop(...)
| Remove and return the rightmost element.
|
| popleft(...)
| Remove and return the leftmost element.
|
| remove(...)
| D.remove(value) -- remove first occurrence of value.
|
| reverse(...)
| D.reverse() -- 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__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args or keywords
>>> p[0] + p[1] # indexable like a plain tuple
33
>>> x, y = p # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y # fields also accessible by name
33
>>> d = p._asdict() # convert to a dictionary
>>> d['x']
11
>>> Point(**d) # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
DATA
__all__ = ['ChainMap', 'Counter', 'OrderedDict', 'UserDict', 'UserList...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\collections\__init__.py
logging.config
Python Library Documentation: module logging.config in logging
NAME
logging.config
MODULE REFERENCE
https://docs.python.org/3.12/library/logging.config.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Configuration functions for the logging package for Python. The core package
is based on PEP 282 and comments thereto in comp.lang.python, and influenced
by Apache's log4j system.
Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
CLASSES
builtins.dict(builtins.object)
ConvertingDict(builtins.dict, ConvertingMixin)
builtins.list(builtins.object)
ConvertingList(builtins.list, ConvertingMixin)
builtins.object
BaseConfigurator
DictConfigurator
ConvertingMixin
ConvertingDict(builtins.dict, ConvertingMixin)
ConvertingList(builtins.list, ConvertingMixin)
ConvertingTuple(builtins.tuple, ConvertingMixin)
builtins.tuple(builtins.object)
ConvertingTuple(builtins.tuple, ConvertingMixin)
class BaseConfigurator(builtins.object)
| BaseConfigurator(config)
|
| The configurator base class which defines some useful defaults.
|
| Methods defined here:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
class ConvertingDict(builtins.dict, ConvertingMixin)
| A converting dictionary wrapper.
|
| Method resolution order:
| ConvertingDict
| builtins.dict
| ConvertingMixin
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, key)
| Return self[key].
|
| get(self, key, default=None)
| Return the value for key if key is in the dictionary, else default.
|
| pop(self, key, default=None)
| D.pop(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.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __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.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __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.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(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(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| 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(...)
| D.update([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(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from ConvertingMixin:
|
| convert(self, value)
|
| convert_with_key(self, key, value, replace=True)
class ConvertingList(builtins.list, ConvertingMixin)
| ConvertingList(iterable=(), /)
|
| A converting list wrapper.
|
| Method resolution order:
| ConvertingList
| builtins.list
| ConvertingMixin
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, key)
| Return self[index].
|
| pop(self, idx=-1)
| Remove and return item at index (default last).
|
| Raises IndexError if list is empty or index is out of range.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.list:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __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).
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the list.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(self, /)
| Return the size of the list in memory, in bytes.
|
| append(self, object, /)
| Append object to the end of the list.
|
| clear(self, /)
| Remove all items from list.
|
| copy(self, /)
| Return a shallow copy of the list.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| extend(self, iterable, /)
| Extend list by appending elements from the iterable.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| insert(self, index, object, /)
| Insert object before index.
|
| remove(self, value, /)
| Remove first occurrence of value.
|
| Raises ValueError if the value is not present.
|
| reverse(self, /)
| Reverse *IN PLACE*.
|
| sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
| order of two equal elements is maintained).
|
| If a key function is given, apply it once to each list item and sort them,
| ascending or descending, according to their function values.
|
| The reverse flag can be set to sort in descending order.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.list:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.list:
|
| __new__(*args, **kwargs) class method of builtins.list
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.list:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from ConvertingMixin:
|
| convert(self, value)
|
| convert_with_key(self, key, value, replace=True)
class ConvertingMixin(builtins.object)
| For ConvertingXXX's, this mixin class provides common functions
|
| Methods defined here:
|
| convert(self, value)
|
| convert_with_key(self, key, value, replace=True)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ConvertingTuple(builtins.tuple, ConvertingMixin)
| ConvertingTuple(iterable=(), /)
|
| A converting tuple wrapper.
|
| Method resolution order:
| ConvertingTuple
| builtins.tuple
| ConvertingMixin
| builtins.object
|
| Methods defined here:
|
| __getitem__(self, key)
| Return self[key].
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.tuple:
|
| __new__(*args, **kwargs) class method of builtins.tuple
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ConvertingMixin:
|
| convert(self, value)
|
| convert_with_key(self, key, value, replace=True)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ConvertingMixin:
|
| __weakref__
| list of weak references to the object
class DictConfigurator(BaseConfigurator)
| DictConfigurator(config)
|
| Configure logging using a dictionary-like object to describe the
| configuration.
|
| Method resolution order:
| DictConfigurator
| BaseConfigurator
| builtins.object
|
| Methods defined here:
|
| add_filters(self, filterer, filters)
| Add filters to a filterer from a list of names.
|
| add_handlers(self, logger, handlers)
| Add handlers to a logger from a list of names.
|
| common_logger_config(self, logger, config, incremental=False)
| Perform configuration which is common to root and non-root loggers.
|
| configure(self)
| Do the configuration.
|
| configure_filter(self, config)
| Configure a filter from a dictionary.
|
| configure_formatter(self, config)
| Configure a formatter from a dictionary.
|
| configure_handler(self, config)
| Configure a handler from a dictionary.
|
| configure_logger(self, name, config, incremental=False)
| Configure a non-root logger from a dictionary.
|
| configure_root(self, config, incremental=False)
| Configure a root logger from a dictionary.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseConfigurator:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods inherited from BaseConfigurator:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseConfigurator:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseConfigurator:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
dictConfigClass = class DictConfigurator(BaseConfigurator)
| dictConfigClass(config)
|
| Configure logging using a dictionary-like object to describe the
| configuration.
|
| Method resolution order:
| DictConfigurator
| BaseConfigurator
| builtins.object
|
| Methods defined here:
|
| add_filters(self, filterer, filters)
| Add filters to a filterer from a list of names.
|
| add_handlers(self, logger, handlers)
| Add handlers to a logger from a list of names.
|
| common_logger_config(self, logger, config, incremental=False)
| Perform configuration which is common to root and non-root loggers.
|
| configure(self)
| Do the configuration.
|
| configure_filter(self, config)
| Configure a filter from a dictionary.
|
| configure_formatter(self, config)
| Configure a formatter from a dictionary.
|
| configure_handler(self, config)
| Configure a handler from a dictionary.
|
| configure_logger(self, name, config, incremental=False)
| Configure a non-root logger from a dictionary.
|
| configure_root(self, config, incremental=False)
| Configure a root logger from a dictionary.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseConfigurator:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods inherited from BaseConfigurator:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseConfigurator:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseConfigurator:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
FUNCTIONS
dictConfig(config)
Configure logging using a dictionary.
fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Read the logging configuration from a ConfigParser-format file.
This can be called several times from an application, allowing an end user
the ability to select from various pre-canned configurations (if the
developer provides a mechanism to present the choices and load the chosen
configuration).
listen(port=9030, verify=None)
Start up a socket server on the specified port, and listen for new
configurations.
These will be sent as a file suitable for processing by fileConfig().
Returns a Thread object on which you can call start() to start the server,
and which you can join() when appropriate. To stop the server, call
stopListening().
Use the ``verify`` argument to verify any bytes received across the wire
from a client. If specified, it should be a callable which receives a
single argument - the bytes of configuration data received across the
network - and it should return either ``None``, to indicate that the
passed in bytes could not be verified and should be discarded, or a
byte string which is then passed to the configuration machinery as
normal. Note that you can return transformed bytes, e.g. by decrypting
the bytes passed in.
stopListening()
Stop the listening server which was created with a call to listen().
valid_ident(s)
DATA
DEFAULT_LOGGING_CONFIG_PORT = 9030
IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.IGNORECASE)
RESET_ERROR = 10054
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\logging\config.py
logging.critical
Python Library Documentation: function critical in module logging
critical(msg, *args, **kwargs)
Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.
logging.currentframe
Python Library Documentation: function <lambda> in module logging <lambda> lambda (...)
logging.debug
Python Library Documentation: function debug in module logging
debug(msg, *args, **kwargs)
Log a message with severity 'DEBUG' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
logging.disable
Python Library Documentation: function disable in module logging
disable(level=50)
Disable all logging calls of severity 'level' and below.
logging.error
Python Library Documentation: function error in module logging
error(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
logging.exception
Python Library Documentation: function exception in module logging
exception(msg, *args, exc_info=True, **kwargs)
Log a message with severity 'ERROR' on the root logger, with exception
information. If the logger has no handlers, basicConfig() is called to add
a console handler with a pre-defined format.
logging.fatal
Python Library Documentation: function fatal in module logging
fatal(msg, *args, **kwargs)
Don't use this function, use critical() instead.
logging.getHandlerByName
Python Library Documentation: function getHandlerByName in module logging
getHandlerByName(name)
Get a handler with the specified *name*, or None if there isn't one with
that name.
logging.getHandlerNames
Python Library Documentation: function getHandlerNames in module logging
getHandlerNames()
Return all known handler names as an immutable set.
logging.getLevelName
Python Library Documentation: function getLevelName in module logging
getLevelName(level)
Return the textual or numeric representation of logging level 'level'.
If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
INFO, DEBUG) then you get the corresponding string. If you have
associated levels with names using addLevelName then the name you have
associated with 'level' is returned.
If a numeric value corresponding to one of the defined levels is passed
in, the corresponding string representation is returned.
If a string representation of the level is passed in, the corresponding
numeric value is returned.
If no matching numeric or string value is passed in, the string
'Level %s' % level is returned.
logging.getLevelNamesMapping
Python Library Documentation: function getLevelNamesMapping in module logging getLevelNamesMapping()
logging.getLogRecordFactory
Python Library Documentation: function getLogRecordFactory in module logging
getLogRecordFactory()
Return the factory to be used when instantiating a log record.
logging.getLogger
Python Library Documentation: function getLogger in module logging
getLogger(name=None)
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
logging.getLoggerClass
Python Library Documentation: function getLoggerClass in module logging
getLoggerClass()
Return the class to be used when instantiating a logger.
logging.handlers
Python Library Documentation: module logging.handlers in logging
NAME
logging.handlers
MODULE REFERENCE
https://docs.python.org/3.12/library/logging.handlers.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python.
Copyright (C) 2001-2021 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away!
CLASSES
builtins.object
QueueListener
logging.FileHandler(logging.StreamHandler)
BaseRotatingHandler
RotatingFileHandler
TimedRotatingFileHandler
WatchedFileHandler
logging.Handler(logging.Filterer)
BufferingHandler
MemoryHandler
HTTPHandler
NTEventLogHandler
QueueHandler
SMTPHandler
SocketHandler
DatagramHandler
SysLogHandler
class BaseRotatingHandler(logging.FileHandler)
| BaseRotatingHandler(filename, mode, encoding=None, delay=False, errors=None)
|
| Base class for handlers that rotate log files at a certain point.
| Not meant to be instantiated directly. Instead, use RotatingFileHandler
| or TimedRotatingFileHandler.
|
| Method resolution order:
| BaseRotatingHandler
| logging.FileHandler
| logging.StreamHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode, encoding=None, delay=False, errors=None)
| Use the specified filename for streamed logging
|
| emit(self, record)
| Emit a record.
|
| Output the record to the file, catering for rollover as described
| in doRollover().
|
| rotate(self, source, dest)
| When rotating, rotate the current log.
|
| The default implementation calls the 'rotator' attribute of the
| handler, if it's callable, passing the source and dest arguments to
| it. If the attribute isn't callable (the default is None), the source
| is simply renamed to the destination.
|
| :param source: The source filename. This is normally the base
| filename, e.g. 'test.log'
| :param dest: The destination filename. This is normally
| what the source is rotated to, e.g. 'test.log.1'.
|
| rotation_filename(self, default_name)
| Modify the filename of a log file when rotating.
|
| This is provided so that a custom filename can be provided.
|
| The default implementation calls the 'namer' attribute of the
| handler, if it's callable, passing the default name to
| it. If the attribute isn't callable (the default is None), the name
| is returned unchanged.
|
| :param default_name: The default name for the log file.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| namer = None
|
| rotator = None
|
| ----------------------------------------------------------------------
| Methods inherited from logging.FileHandler:
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from logging.StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from logging.StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BufferingHandler(logging.Handler)
| BufferingHandler(capacity)
|
| A handler class which buffers logging records in memory. Whenever each
| record is added to the buffer, a check is made to see if the buffer should
| be flushed. If it should, then flush() is expected to do what's needed.
|
| Method resolution order:
| BufferingHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, capacity)
| Initialize the handler with the buffer size.
|
| close(self)
| Close the handler.
|
| This version just flushes and chains to the parent class' close().
|
| emit(self, record)
| Emit a record.
|
| Append the record. If shouldFlush() tells us to, call flush() to process
| the buffer.
|
| flush(self)
| Override to implement custom flushing behaviour.
|
| This version just zaps the buffer to empty.
|
| shouldFlush(self, record)
| Should the handler flush its buffer?
|
| Returns true if the buffer is up to capacity. This method can be
| overridden to implement custom flushing strategies.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class DatagramHandler(SocketHandler)
| DatagramHandler(host, port)
|
| A handler class which writes logging records, in pickle format, to
| a datagram socket. The pickle which is sent is that of the LogRecord's
| attribute dictionary (__dict__), so that the receiver does not need to
| have the logging module installed in order to process the logging event.
|
| To unpickle the record at the receiving end into a LogRecord, use the
| makeLogRecord function.
|
| Method resolution order:
| DatagramHandler
| SocketHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, host, port)
| Initializes the handler with a specific host address and port.
|
| makeSocket(self)
| The factory method of SocketHandler is here overridden to create
| a UDP socket (SOCK_DGRAM).
|
| send(self, s)
| Send a pickled string to a socket.
|
| This function no longer allows for partial sends which can happen
| when the network is busy - UDP does not guarantee delivery and
| can deliver packets out of sequence.
|
| ----------------------------------------------------------------------
| Methods inherited from SocketHandler:
|
| close(self)
| Closes the socket.
|
| createSocket(self)
| Try to create a socket, using an exponential backoff with
| a max retry time. Thanks to Robert Olson for the original patch
| (SF #815911) which has been slightly refactored.
|
| emit(self, record)
| Emit a record.
|
| Pickles the record and writes it to the socket in binary format.
| If there is an error with the socket, silently drop the packet.
| If there was a problem with the socket, re-establishes the
| socket.
|
| handleError(self, record)
| Handle an error during logging.
|
| An error has occurred during logging. Most likely cause -
| connection lost. Close the socket so that we can retry on the
| next event.
|
| makePickle(self, record)
| Pickles the record in binary format with a length prefix, and
| returns it ready for transmission across the socket.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPHandler(logging.Handler)
| HTTPHandler(host, url, method='GET', secure=False, credentials=None, context=None)
|
| A class which sends records to a web server, using either GET or
| POST semantics.
|
| Method resolution order:
| HTTPHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, host, url, method='GET', secure=False, credentials=None, context=None)
| Initialize the instance with the host, the request URL, and the method
| ("GET" or "POST")
|
| emit(self, record)
| Emit a record.
|
| Send the record to the web server as a percent-encoded dictionary
|
| getConnection(self, host, secure)
| get a HTTP[S]Connection.
|
| Override when a custom connection is required, for example if
| there is a proxy.
|
| mapLogRecord(self, record)
| Default implementation of mapping the log record into a dict
| that is sent as the CGI data. Overwrite in your class.
| Contributed by Franz Glasner.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class MemoryHandler(BufferingHandler)
| MemoryHandler(capacity, flushLevel=40, target=None, flushOnClose=True)
|
| A handler class which buffers logging records in memory, periodically
| flushing them to a target handler. Flushing occurs whenever the buffer
| is full, or when an event of a certain severity or greater is seen.
|
| Method resolution order:
| MemoryHandler
| BufferingHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, capacity, flushLevel=40, target=None, flushOnClose=True)
| Initialize the handler with the buffer size, the level at which
| flushing should occur and an optional target.
|
| Note that without a target being set either here or via setTarget(),
| a MemoryHandler is no use to anyone!
|
| The ``flushOnClose`` argument is ``True`` for backward compatibility
| reasons - the old behaviour is that when the handler is closed, the
| buffer is flushed, even if the flush level hasn't been exceeded nor the
| capacity exceeded. To prevent this, set ``flushOnClose`` to ``False``.
|
| close(self)
| Flush, if appropriately configured, set the target to None and lose the
| buffer.
|
| flush(self)
| For a MemoryHandler, flushing means just sending the buffered
| records to the target, if there is one. Override if you want
| different behaviour.
|
| The record buffer is only cleared if a target has been set.
|
| setTarget(self, target)
| Set the target handler for this handler.
|
| shouldFlush(self, record)
| Check for buffer full or a record at the flushLevel or higher.
|
| ----------------------------------------------------------------------
| Methods inherited from BufferingHandler:
|
| emit(self, record)
| Emit a record.
|
| Append the record. If shouldFlush() tells us to, call flush() to process
| the buffer.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class NTEventLogHandler(logging.Handler)
| NTEventLogHandler(appname, dllname=None, logtype='Application')
|
| A handler class which sends events to the NT Event Log. Adds a
| registry entry for the specified application name. If no dllname is
| provided, win32service.pyd (which contains some basic message
| placeholders) is used. Note that use of these placeholders will make
| your event logs big, as the entire message source is held in the log.
| If you want slimmer logs, you have to pass in the name of your own DLL
| which contains the message definitions you want to use in the event log.
|
| Method resolution order:
| NTEventLogHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, appname, dllname=None, logtype='Application')
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| close(self)
| Clean up this handler.
|
| You can remove the application name from the registry as a
| source of event log entries. However, if you do this, you will
| not be able to see the events as you intended in the Event Log
| Viewer - it needs to be able to access the registry to get the
| DLL name.
|
| emit(self, record)
| Emit a record.
|
| Determine the message ID, event category and event type. Then
| log the message in the NT event log.
|
| getEventCategory(self, record)
| Return the event category for the record.
|
| Override this if you want to specify your own categories. This version
| returns 0.
|
| getEventType(self, record)
| Return the event type for the record.
|
| Override this if you want to specify your own types. This version does
| a mapping using the handler's typemap attribute, which is set up in
| __init__() to a dictionary which contains mappings for DEBUG, INFO,
| WARNING, ERROR and CRITICAL. If you are using your own levels you will
| either need to override this method or place a suitable dictionary in
| the handler's typemap attribute.
|
| getMessageID(self, record)
| Return the message ID for the event record. If you are using your
| own messages, you could do this by having the msg passed to the
| logger being an ID rather than a formatting string. Then, in here,
| you could use a dictionary lookup to get the message ID. This
| version returns 1, which is the base message ID in win32service.pyd.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class QueueHandler(logging.Handler)
| QueueHandler(queue)
|
| This handler sends events to a queue. Typically, it would be used together
| with a multiprocessing Queue to centralise logging to file in one process
| (in a multi-process application), so as to avoid file write contention
| between processes.
|
| This code is new in Python 3.2, but this class can be copy pasted into
| user code for use with earlier Python versions.
|
| Method resolution order:
| QueueHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, queue)
| Initialise an instance, using the passed queue.
|
| emit(self, record)
| Emit a record.
|
| Writes the LogRecord to the queue, preparing it for pickling first.
|
| enqueue(self, record)
| Enqueue a record.
|
| The base implementation uses put_nowait. You may want to override
| this method if you want to use blocking, timeouts or custom queue
| implementations.
|
| prepare(self, record)
| Prepare a record for queuing. The object returned by this method is
| enqueued.
|
| The base implementation formats the record to merge the message and
| arguments, and removes unpickleable items from the record in-place.
| Specifically, it overwrites the record's `msg` and
| `message` attributes with the merged message (obtained by
| calling the handler's `format` method), and sets the `args`,
| `exc_info` and `exc_text` attributes to None.
|
| You might want to override this method if you want to convert
| the record to a dict or JSON string, or send a modified copy
| of the record while leaving the original intact.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class QueueListener(builtins.object)
| QueueListener(queue, *handlers, respect_handler_level=False)
|
| This class implements an internal threaded listener which watches for
| LogRecords being added to a queue, removes them and passes them to a
| list of handlers for processing.
|
| Methods defined here:
|
| __init__(self, queue, *handlers, respect_handler_level=False)
| Initialise an instance with the specified queue and
| handlers.
|
| dequeue(self, block)
| Dequeue a record and return it, optionally blocking.
|
| The base implementation uses get. You may want to override this method
| if you want to use timeouts or work with custom queue implementations.
|
| enqueue_sentinel(self)
| This is used to enqueue the sentinel record.
|
| The base implementation uses put_nowait. You may want to override this
| method if you want to use timeouts or work with custom queue
| implementations.
|
| handle(self, record)
| Handle a record.
|
| This just loops through the handlers offering them the record
| to handle.
|
| prepare(self, record)
| Prepare a record for handling.
|
| This method just returns the passed-in record. You may want to
| override this method if you need to do any custom marshalling or
| manipulation of the record before passing it to the handlers.
|
| start(self)
| Start the listener.
|
| This starts up a background thread to monitor the queue for
| LogRecords to process.
|
| stop(self)
| Stop the listener.
|
| This asks the thread to terminate, and then waits for it to do so.
| Note that if you don't call this before your application exits, there
| may be some records still left on the queue, which won't be processed.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RotatingFileHandler(BaseRotatingHandler)
| RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None)
|
| Handler for logging to a set of files, which switches from one file
| to the next when the current file reaches a certain size.
|
| Method resolution order:
| RotatingFileHandler
| BaseRotatingHandler
| logging.FileHandler
| logging.StreamHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None)
| Open the specified file and use it as the stream for logging.
|
| By default, the file grows indefinitely. You can specify particular
| values of maxBytes and backupCount to allow the file to rollover at
| a predetermined size.
|
| Rollover occurs whenever the current log file is nearly maxBytes in
| length. If backupCount is >= 1, the system will successively create
| new files with the same pathname as the base file, but with extensions
| ".1", ".2" etc. appended to it. For example, with a backupCount of 5
| and a base file name of "app.log", you would get "app.log",
| "app.log.1", "app.log.2", ... through to "app.log.5". The file being
| written to is always "app.log" - when it gets filled up, it is closed
| and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
| exist, then they are renamed to "app.log.2", "app.log.3" etc.
| respectively.
|
| If maxBytes is zero, rollover never occurs.
|
| doRollover(self)
| Do a rollover, as described in __init__().
|
| shouldRollover(self, record)
| Determine if rollover should occur.
|
| Basically, see if the supplied record would cause the file to exceed
| the size limit we have.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseRotatingHandler:
|
| emit(self, record)
| Emit a record.
|
| Output the record to the file, catering for rollover as described
| in doRollover().
|
| rotate(self, source, dest)
| When rotating, rotate the current log.
|
| The default implementation calls the 'rotator' attribute of the
| handler, if it's callable, passing the source and dest arguments to
| it. If the attribute isn't callable (the default is None), the source
| is simply renamed to the destination.
|
| :param source: The source filename. This is normally the base
| filename, e.g. 'test.log'
| :param dest: The destination filename. This is normally
| what the source is rotated to, e.g. 'test.log.1'.
|
| rotation_filename(self, default_name)
| Modify the filename of a log file when rotating.
|
| This is provided so that a custom filename can be provided.
|
| The default implementation calls the 'namer' attribute of the
| handler, if it's callable, passing the default name to
| it. If the attribute isn't callable (the default is None), the name
| is returned unchanged.
|
| :param default_name: The default name for the log file.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseRotatingHandler:
|
| namer = None
|
| rotator = None
|
| ----------------------------------------------------------------------
| Methods inherited from logging.FileHandler:
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from logging.StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from logging.StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SMTPHandler(logging.Handler)
| SMTPHandler(mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=5.0)
|
| A handler class which sends an SMTP email for each logging event.
|
| Method resolution order:
| SMTPHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=5.0)
| Initialize the handler.
|
| Initialize the instance with the from and to addresses and subject
| line of the email. To specify a non-standard SMTP port, use the
| (host, port) tuple format for the mailhost argument. To specify
| authentication credentials, supply a (username, password) tuple
| for the credentials argument. To specify the use of a secure
| protocol (TLS), pass in a tuple for the secure argument. This will
| only be used when authentication credentials are supplied. The tuple
| will be either an empty tuple, or a single-value tuple with the name
| of a keyfile, or a 2-value tuple with the names of the keyfile and
| certificate file. (This tuple is passed to the `starttls` method).
| A timeout in seconds can be specified for the SMTP connection (the
| default is one second).
|
| emit(self, record)
| Emit a record.
|
| Format the record and send it to the specified addressees.
|
| getSubject(self, record)
| Determine the subject for the email.
|
| If you want to specify a subject line which is record-dependent,
| override this method.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SocketHandler(logging.Handler)
| SocketHandler(host, port)
|
| A handler class which writes logging records, in pickle format, to
| a streaming socket. The socket is kept open across logging calls.
| If the peer resets it, an attempt is made to reconnect on the next call.
| The pickle which is sent is that of the LogRecord's attribute dictionary
| (__dict__), so that the receiver does not need to have the logging module
| installed in order to process the logging event.
|
| To unpickle the record at the receiving end into a LogRecord, use the
| makeLogRecord function.
|
| Method resolution order:
| SocketHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, host, port)
| Initializes the handler with a specific host address and port.
|
| When the attribute *closeOnError* is set to True - if a socket error
| occurs, the socket is silently closed and then reopened on the next
| logging call.
|
| close(self)
| Closes the socket.
|
| createSocket(self)
| Try to create a socket, using an exponential backoff with
| a max retry time. Thanks to Robert Olson for the original patch
| (SF #815911) which has been slightly refactored.
|
| emit(self, record)
| Emit a record.
|
| Pickles the record and writes it to the socket in binary format.
| If there is an error with the socket, silently drop the packet.
| If there was a problem with the socket, re-establishes the
| socket.
|
| handleError(self, record)
| Handle an error during logging.
|
| An error has occurred during logging. Most likely cause -
| connection lost. Close the socket so that we can retry on the
| next event.
|
| makePickle(self, record)
| Pickles the record in binary format with a length prefix, and
| returns it ready for transmission across the socket.
|
| makeSocket(self, timeout=1)
| A factory method which allows subclasses to define the precise
| type of socket they want.
|
| send(self, s)
| Send a pickled string to the socket.
|
| This function allows for partial sends which can happen when the
| network is busy.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SysLogHandler(logging.Handler)
| SysLogHandler(address=('localhost', 514), facility=1, socktype=None)
|
| A handler class which sends formatted logging records to a syslog
| server. Based on Sam Rushing's syslog module:
| http://www.nightmare.com/squirl/python-ext/misc/syslog.py
| Contributed by Nicolas Untz (after which minor refactoring changes
| have been made).
|
| Method resolution order:
| SysLogHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, address=('localhost', 514), facility=1, socktype=None)
| Initialize a handler.
|
| If address is specified as a string, a UNIX socket is used. To log to a
| local syslogd, "SysLogHandler(address="/dev/log")" can be used.
| If facility is not specified, LOG_USER is used. If socktype is
| specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific
| socket type will be used. For Unix sockets, you can also specify a
| socktype of None, in which case socket.SOCK_DGRAM will be used, falling
| back to socket.SOCK_STREAM.
|
| close(self)
| Closes the socket.
|
| createSocket(self)
| Try to create a socket and, if it's not a datagram socket, connect it
| to the other end. This method is called during handler initialization,
| but it's not regarded as an error if the other end isn't listening yet
| --- the method will be called again when emitting an event,
| if there is no socket at that point.
|
| emit(self, record)
| Emit a record.
|
| The record is formatted, and then sent to the syslog server. If
| exception information is present, it is NOT sent to the server.
|
| encodePriority(self, facility, priority)
| Encode the facility and priority. You can pass in strings or
| integers - if strings are passed, the facility_names and
| priority_names mapping dictionaries are used to convert them to
| integers.
|
| mapPriority(self, levelName)
| Map a logging level name to a key in the priority_names map.
| This is useful in two scenarios: when custom levels are being
| used, and in the case where you can't do a straightforward
| mapping by lowercasing the logging level name because of locale-
| specific issues (see SF #1524081).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| LOG_ALERT = 1
|
| LOG_AUTH = 4
|
| LOG_AUTHPRIV = 10
|
| LOG_CONSOLE = 14
|
| LOG_CRIT = 2
|
| LOG_CRON = 9
|
| LOG_DAEMON = 3
|
| LOG_DEBUG = 7
|
| LOG_EMERG = 0
|
| LOG_ERR = 3
|
| LOG_FTP = 11
|
| LOG_INFO = 6
|
| LOG_KERN = 0
|
| LOG_LOCAL0 = 16
|
| LOG_LOCAL1 = 17
|
| LOG_LOCAL2 = 18
|
| LOG_LOCAL3 = 19
|
| LOG_LOCAL4 = 20
|
| LOG_LOCAL5 = 21
|
| LOG_LOCAL6 = 22
|
| LOG_LOCAL7 = 23
|
| LOG_LPR = 6
|
| LOG_MAIL = 2
|
| LOG_NEWS = 7
|
| LOG_NOTICE = 5
|
| LOG_NTP = 12
|
| LOG_SECURITY = 13
|
| LOG_SOLCRON = 15
|
| LOG_SYSLOG = 5
|
| LOG_USER = 1
|
| LOG_UUCP = 8
|
| LOG_WARNING = 4
|
| append_nul = True
|
| facility_names = {'auth': 4, 'authpriv': 10, 'console': 14, 'cron': 9,...
|
| ident = ''
|
| priority_map = {'CRITICAL': 'critical', 'DEBUG': 'debug', 'ERROR': 'er...
|
| priority_names = {'alert': 1, 'crit': 2, 'critical': 2, 'debug': 7, 'e...
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class TimedRotatingFileHandler(BaseRotatingHandler)
| TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None, errors=None)
|
| Handler for logging to a file, rotating the log file at certain timed
| intervals.
|
| If backupCount is > 0, when rollover is done, no more than backupCount
| files are kept - the oldest ones are deleted.
|
| Method resolution order:
| TimedRotatingFileHandler
| BaseRotatingHandler
| logging.FileHandler
| logging.StreamHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None, errors=None)
| Use the specified filename for streamed logging
|
| computeRollover(self, currentTime)
| Work out the rollover time based on the specified time.
|
| doRollover(self)
| do a rollover; in this case, a date/time stamp is appended to the filename
| when the rollover happens. However, you want the file to be named for the
| start of the interval, not the current time. If there is a backup count,
| then we have to get a list of matching filenames, sort them and remove
| the one with the oldest suffix.
|
| getFilesToDelete(self)
| Determine the files to delete when rolling over.
|
| More specific than the earlier method, which just used glob.glob().
|
| shouldRollover(self, record)
| Determine if rollover should occur.
|
| record is not used, as we are just comparing times, but it is needed so
| the method signatures are the same
|
| ----------------------------------------------------------------------
| Methods inherited from BaseRotatingHandler:
|
| emit(self, record)
| Emit a record.
|
| Output the record to the file, catering for rollover as described
| in doRollover().
|
| rotate(self, source, dest)
| When rotating, rotate the current log.
|
| The default implementation calls the 'rotator' attribute of the
| handler, if it's callable, passing the source and dest arguments to
| it. If the attribute isn't callable (the default is None), the source
| is simply renamed to the destination.
|
| :param source: The source filename. This is normally the base
| filename, e.g. 'test.log'
| :param dest: The destination filename. This is normally
| what the source is rotated to, e.g. 'test.log.1'.
|
| rotation_filename(self, default_name)
| Modify the filename of a log file when rotating.
|
| This is provided so that a custom filename can be provided.
|
| The default implementation calls the 'namer' attribute of the
| handler, if it's callable, passing the default name to
| it. If the attribute isn't callable (the default is None), the name
| is returned unchanged.
|
| :param default_name: The default name for the log file.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseRotatingHandler:
|
| namer = None
|
| rotator = None
|
| ----------------------------------------------------------------------
| Methods inherited from logging.FileHandler:
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from logging.StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from logging.StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class WatchedFileHandler(logging.FileHandler)
| WatchedFileHandler(filename, mode='a', encoding=None, delay=False, errors=None)
|
| A handler for logging to a file, which watches the file
| to see if it has changed while in use. This can happen because of
| usage of programs such as newsyslog and logrotate which perform
| log file rotation. This handler, intended for use under Unix,
| watches the file to see if it has changed since the last emit.
| (A file has changed if its device or inode have changed.)
| If it has changed, the old file stream is closed, and the file
| opened to get a new stream.
|
| This handler is not appropriate for use under Windows, because
| under Windows open files cannot be moved or renamed - logging
| opens the files with exclusive locks - and so there is no need
| for such a handler. Furthermore, ST_INO is not supported under
| Windows; stat always returns zero for this value.
|
| This handler is based on a suggestion and patch by Chad J.
| Schroeder.
|
| Method resolution order:
| WatchedFileHandler
| logging.FileHandler
| logging.StreamHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode='a', encoding=None, delay=False, errors=None)
| Open the specified file and use it as the stream for logging.
|
| emit(self, record)
| Emit a record.
|
| If underlying file has changed, reopen the file before emitting the
| record to it.
|
| reopenIfNeeded(self)
| Reopen log file if needed.
|
| Checks if the underlying file has changed, and if it
| has, close the old stream and reopen the file to get the
| current stream.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.FileHandler:
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from logging.StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from logging.StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
DEFAULT_HTTP_LOGGING_PORT = 9022
DEFAULT_SOAP_LOGGING_PORT = 9023
DEFAULT_TCP_LOGGING_PORT = 9020
DEFAULT_UDP_LOGGING_PORT = 9021
ST_DEV = 2
ST_INO = 1
ST_MTIME = 8
SYSLOG_TCP_PORT = 514
SYSLOG_UDP_PORT = 514
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\logging\handlers.py
logging.info
Python Library Documentation: function info in module logging
info(msg, *args, **kwargs)
Log a message with severity 'INFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
logging.io
Python Library Documentation: module io
NAME
io
MODULE REFERENCE
https://docs.python.org/3.12/library/io.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.
BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.
data:
DEFAULT_BUFFER_SIZE
An int containing the default buffer size used by the module's buffered
I/O classes. open() uses the file's blksize (as obtained by os.stat) if
possible.
CLASSES
_io._BufferedIOBase(_io._IOBase)
_io.BufferedRWPair
_io.BufferedRandom
_io.BufferedReader
_io.BufferedWriter
_io.BytesIO
BufferedIOBase(_io._BufferedIOBase, IOBase)
_io._IOBase(builtins.object)
IOBase
BufferedIOBase(_io._BufferedIOBase, IOBase)
RawIOBase(_io._RawIOBase, IOBase)
TextIOBase(_io._TextIOBase, IOBase)
_io._RawIOBase(_io._IOBase)
_io.FileIO
RawIOBase(_io._RawIOBase, IOBase)
_io._TextIOBase(_io._IOBase)
_io.StringIO
_io.TextIOWrapper
TextIOBase(_io._TextIOBase, IOBase)
builtins.OSError(builtins.Exception)
builtins.BlockingIOError
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.ValueError(builtins.Exception)
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.object
_io.IncrementalNewlineDecoder
class BlockingIOError(OSError)
| I/O operation would block.
|
| Method resolution order:
| BlockingIOError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class BufferedIOBase(_io._BufferedIOBase, IOBase)
| Base class for buffered IO objects.
|
| The main difference with RawIOBase is that the read() method
| supports omitting the size argument, and does not have a default
| implementation that defers to readinto().
|
| In addition, read(), readinto() and write() may raise
| BlockingIOError if the underlying raw stream is in non-blocking
| mode and not ready; unlike their raw counterparts, they will never
| return None.
|
| A typical implementation should not inherit from a RawIOBase
| implementation, but wrap one.
|
| Method resolution order:
| BufferedIOBase
| _io._BufferedIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class BufferedRWPair(_BufferedIOBase)
| BufferedRWPair(reader, writer, buffer_size=8192, /)
|
| A buffered reader and writer object together.
|
| A buffered reader object and buffered writer object put together to
| form a sequential IO object that can read and write. This is typically
| used with a socket or two-way pipe.
|
| reader and writer are RawIOBase objects that are readable and
| writeable respectively. If the buffer_size is omitted it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRWPair
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(...)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| flush(...)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(...)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(...)
|
| read(...)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(...)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(...)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(...)
|
| readinto1(...)
|
| writable(...)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(...)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedRandom(_BufferedIOBase)
| BufferedRandom(raw, buffer_size=8192)
|
| A buffered interface to random access streams.
|
| The constructor creates a reader and writer for a seekable stream,
| raw, given in the first argument. If the buffer_size is omitted it
| defaults to DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRandom
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedReader(_BufferedIOBase)
| BufferedReader(raw, buffer_size=8192)
|
| Create a new buffered reader using the given readable raw IO object.
|
| Method resolution order:
| BufferedReader
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedWriter(_BufferedIOBase)
| BufferedWriter(raw, buffer_size=8192)
|
| A buffer for a writeable sequential RawIO object.
|
| The constructor creates a BufferedWriter for the given writeable raw
| stream. If the buffer_size is not given, it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedWriter
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BytesIO(_BufferedIOBase)
| BytesIO(initial_bytes=b'')
|
| Buffered I/O implementation using an in-memory bytes buffer.
|
| Method resolution order:
| BytesIO
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| close(self, /)
| Disable all I/O operations.
|
| flush(self, /)
| Does nothing.
|
| getbuffer(self, /)
| Get a read-write view over the contents of the BytesIO object.
|
| getvalue(self, /)
| Retrieve the entire contents of the BytesIO object.
|
| isatty(self, /)
| Always returns False.
|
| BytesIO objects are not connected to a TTY-like device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| read1(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative or omitted, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readinto(self, buffer, /)
| Read bytes into buffer.
|
| Returns number of bytes read (0 for EOF), or None if the object
| is set not to block and has no data to read.
|
| readline(self, size=-1, /)
| Next line from the file, as a bytes object.
|
| Retain newline. A non-negative size argument limits the maximum
| number of bytes to return (an incomplete line may be returned then).
| Return an empty bytes object at EOF.
|
| readlines(self, size=None, /)
| List of bytes objects, each a line from the file.
|
| Call readline() repeatedly and return a list of the lines so read.
| The optional size argument, if given, is an approximate bound on the
| total number of bytes in the lines returned.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to byte offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos may be negative;
| 2 End of stream - pos usually negative.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Current file position, an integer.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is unchanged. Returns the new size.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, b, /)
| Write bytes to file.
|
| Return the number of bytes written.
|
| writelines(self, lines, /)
| Write lines to the file.
|
| Note that newlines are not added. lines can be any iterable object
| producing bytes-like objects. This is equivalent to calling write() for
| each element.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed.
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class FileIO(_RawIOBase)
| FileIO(file, mode='r', closefd=True, opener=None)
|
| Open a file.
|
| The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
| writing, exclusive creation or appending. The file will be created if it
| doesn't exist when opened for writing or appending; it will be truncated
| when opened for writing. A FileExistsError will be raised if it already
| exists when opened for creating. Opening a file for creating implies
| writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
| to allow simultaneous reading and writing. A custom opener can be used by
| passing a callable as *opener*. The underlying file descriptor for the file
| object is then obtained by calling opener with (*name*, *flags*).
| *opener* must return an open file descriptor (passing os.open as *opener*
| results in functionality similar to passing None).
|
| Method resolution order:
| FileIO
| _RawIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Close the file.
|
| A closed file cannot be used for further I/O operations. close() may be
| called more than once without error.
|
| fileno(self, /)
| Return the underlying file descriptor (an integer).
|
| isatty(self, /)
| True if the file is connected to a TTY device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as bytes.
|
| Only makes one system call, so less data may be returned than requested.
| In non-blocking mode, returns None if no data is available.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| True if file was opened in a read mode.
|
| readall(self, /)
| Read all data from the file, returned as bytes.
|
| In non-blocking mode, returns as much as is immediately available,
| or None if no data is available. Return an empty bytes object at EOF.
|
| readinto(self, buffer, /)
| Same as RawIOBase.readinto().
|
| seek(self, pos, whence=0, /)
| Move to new file position and return the file position.
|
| Argument offset is a byte count. Optional argument whence defaults to
| SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
| are SEEK_CUR or 1 (move relative to current position, positive or negative),
| and SEEK_END or 2 (move relative to end of file, usually negative, although
| many platforms allow seeking beyond the end of a file).
|
| Note that not all file objects are seekable.
|
| seekable(self, /)
| True if file supports random-access.
|
| tell(self, /)
| Current file position.
|
| Can raise OSError for non seekable files.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes and return the truncated size.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is changed to the value of size.
|
| writable(self, /)
| True if file was opened in a write mode.
|
| write(self, b, /)
| Write buffer b to file, return number of bytes written.
|
| Only makes one system call, so not all of the data may be written.
| The number of bytes actually written is returned. In non-blocking mode,
| returns None if the write would block.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed
|
| closefd
| True if the file descriptor will be closed by close().
|
| mode
| String giving the file mode
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class IOBase(_io._IOBase)
| The abstract base class for all I/O classes.
|
| This class provides dummy implementations for many methods that
| derived classes can override selectively; the default implementations
| represent a file that cannot be read, written or seeked.
|
| Even though IOBase does not declare read, readinto, or write because
| their signatures will vary, implementations and clients should
| consider those methods part of the interface. Also, implementations
| may raise UnsupportedOperation when operations they do not support are
| called.
|
| The basic type used for binary data read from or written to a file is
| bytes. Other bytes-like objects are accepted as method arguments too.
| In some cases (such as readinto), a writable object is required. Text
| I/O classes work with str data.
|
| Note that calling any method (except additional calls to close(),
| which are ignored) on a closed stream should raise a ValueError.
|
| IOBase (and its subclasses) support the iterator protocol, meaning
| that an IOBase object can be iterated over yielding the lines in a
| stream.
|
| IOBase also supports the :keyword:`with` statement. In this example,
| fp is closed after the suite of the with statement is complete:
|
| with open('spam.txt', 'r') as fp:
| fp.write('Spam and eggs!')
|
| Method resolution order:
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class IncrementalNewlineDecoder(builtins.object)
| IncrementalNewlineDecoder(decoder, translate, errors='strict')
|
| Codec used when reading a file in universal newlines mode.
|
| It wraps another incremental decoder, translating \r\n and \r into \n.
| It also records the types of newlines encountered. When used with
| translate=False, it ensures that the newline sequence is returned in
| one piece. When used with decoder=None, it expects unicode strings as
| decode input and translates newlines without first invoking an external
| decoder.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, /, input, final=False)
|
| getstate(self, /)
|
| reset(self, /)
|
| setstate(self, state, /)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| newlines
class RawIOBase(_io._RawIOBase, IOBase)
| Base class for raw binary I/O.
|
| Method resolution order:
| RawIOBase
| _io._RawIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._RawIOBase:
|
| read(self, size=-1, /)
|
| readall(self, /)
| Read until EOF, using multiple read() call.
|
| readinto(...)
|
| write(...)
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class StringIO(_TextIOBase)
| StringIO(initial_value='', newline='\n')
|
| Text I/O implementation using an in-memory buffer.
|
| The initial_value argument sets the value of object. The newline
| argument is like the one of TextIOWrapper's constructor.
|
| Method resolution order:
| StringIO
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| close(self, /)
| Close the IO object.
|
| Attempting any further operation after the object is closed
| will raise a ValueError.
|
| This method has no effect if the file is already closed.
|
| getvalue(self, /)
| Retrieve the entire contents of the object.
|
| read(self, size=-1, /)
| Read at most size characters, returned as a string.
|
| If the argument is negative or omitted, read until EOF
| is reached. Return an empty string at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Returns an empty string if EOF is hit immediately.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to character offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos must be 0;
| 2 End of stream - pos must be 0.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Tell the current file position.
|
| truncate(self, pos=None, /)
| Truncate size to pos.
|
| The pos argument defaults to the current file position, as
| returned by tell(). The current file position is unchanged.
| Returns the new absolute position.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, s, /)
| Write string to file.
|
| Returns the number of characters written, which is always equal to
| the length of the string.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| line_buffering
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class TextIOBase(_io._TextIOBase, IOBase)
| Base class for text I/O.
|
| This class provides a character and line based interface to stream
| I/O. There is no readinto method because Python's character strings
| are immutable.
|
| Method resolution order:
| TextIOBase
| _io._TextIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| write(self, s, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class TextIOWrapper(_TextIOBase)
| TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False)
|
| Character and line based layer over a BufferedIOBase object, buffer.
|
| encoding gives the name of the encoding that the stream will be
| decoded or encoded with. It defaults to locale.getencoding().
|
| errors determines the strictness of encoding and decoding (see
| help(codecs.Codec) or the documentation for codecs.register) and
| defaults to "strict".
|
| newline controls how line endings are handled. It can be None, '',
| '\n', '\r', and '\r\n'. It works as follows:
|
| * On input, if newline is None, universal newlines mode is
| enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
| these are translated into '\n' before being returned to the
| caller. If it is '', universal newline mode is enabled, but line
| endings are returned to the caller untranslated. If it has any of
| the other legal values, input lines are only terminated by the given
| string, and the line ending is returned to the caller untranslated.
|
| * On output, if newline is None, any '\n' characters written are
| translated to the system default line separator, os.linesep. If
| newline is '' or '\n', no translation takes place. If newline is any
| of the other legal values, any '\n' characters written are translated
| to the given string.
|
| If line_buffering is True, a call to flush is implied when a call to
| write contains a newline character.
|
| Method resolution order:
| TextIOWrapper
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None)
| Reconfigure the text stream with new parameters.
|
| This also does an implicit stream flush.
|
| seek(self, cookie, whence=0, /)
| Set the stream position, and return the new stream position.
|
| cookie
| Zero or an opaque number returned by tell().
| whence
| The relative position to seek from.
|
| Four operations are supported, given by the following argument
| combinations:
|
| - seek(0, SEEK_SET): Rewind to the start of the stream.
| - seek(cookie, SEEK_SET): Restore a previous position;
| 'cookie' must be a number returned by tell().
| - seek(0, SEEK_END): Fast-forward to the end of the stream.
| - seek(0, SEEK_CUR): Leave the current stream position unchanged.
|
| Any other argument combinations are invalid,
| and may raise exceptions.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return the stream position as an opaque number.
|
| The return value of tell() can be given as input to seek(), to restore a
| previous stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, text, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| buffer
|
| closed
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| line_buffering
|
| name
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| write_through
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class UnsupportedOperation(builtins.OSError, builtins.ValueError)
| Method resolution order:
| UnsupportedOperation
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
dependent: locale.getencoding() is called to get the current locale encoding.
(For reading and writing raw bytes use binary mode and leave encoding
unspecified.) The available modes are:
========= ===============================================================
Character Meaning
--------- ---------------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
'a' open for writing, appending to the end of the file if it exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
========= ===============================================================
The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
line buffering (only usable in text mode), and an integer > 1 to indicate
the size of a fixed-size chunk buffer. When no buffering argument is
given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
is chosen using a heuristic trying to determine the underlying device's
"block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
On many systems, the buffer will typically be 4096 or 8192 bytes long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
* On input, if newline is None, universal newlines mode is
enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
these are translated into '\n' before being returned to the
caller. If it is '', universal newline mode is enabled, but line
endings are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
and must be True in that case.
A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
are performed. When open() is used to open a file in a text mode ('w',
'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
open_code(path)
Opens the provided file with the intent to import the contents.
This may perform extra validation beyond open(), but is otherwise interchangeable
with calling open(path, 'rb').
text_encoding(encoding, stacklevel=2, /)
A helper function to choose the text encoding.
When encoding is not None, this function returns it.
Otherwise, this function returns the default text encoding
(i.e. "locale" or "utf-8" depends on UTF-8 mode).
This function emits an EncodingWarning if encoding is None and
sys.flags.warn_default_encoding is true.
This can be used in APIs with an encoding=None parameter.
However, please consider using encoding="utf-8" for new APIs.
DATA
DEFAULT_BUFFER_SIZE = 8192
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
__all__ = ['BlockingIOError', 'open', 'open_code', 'IOBase', 'RawIOBas...
AUTHOR
Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\io.py
logging.lastResort
Python Library Documentation: _StderrHandler in module logging object class _StderrHandler(StreamHandler) | _StderrHandler(level=0) | | This class is like a StreamHandler using sys.stderr, but always uses | whatever sys.stderr is currently set to rather than the value of | sys.stderr at handler construction time. | | Method resolution order: | _StderrHandler | StreamHandler | Handler | Filterer | builtins.object | | Methods defined here: | | __init__(self, level=0) | Initialize the handler. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | stream | | ---------------------------------------------------------------------- | Methods inherited from StreamHandler: | | __repr__(self) | Return repr(self). | | emit(self, record) | Emit a record. | | If a formatter is specified, it is used to format the record. | The record is then written to the stream with a trailing newline. If | exception information is present, it is formatted using | traceback.print_exception and appended to the stream. If the stream | has an 'encoding' attribute, it is used to determine how to do the | output to the stream. | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from Handler: | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.log
Python Library Documentation: function log in module logging
log(level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level' on the root logger. If
the logger has no handlers, call basicConfig() to add a console handler
with a pre-defined format.
logging.logAsyncioTasks
Python Library Documentation: bool object class bool(int) | bool(x) -> bool | | Returns True when the argument x is true, False otherwise. | The builtins True and False are the only two instances of the class bool. | The class bool is a subclass of the class int, and cannot be subclassed. | | Method resolution order: | bool | int | object | | Methods defined here: | | __and__(self, value, /) | Return self&value. | | __invert__(self, /) | ~self | | __or__(self, value, /) | Return self|value. | | __rand__(self, value, /) | Return value&self. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __rxor__(self, value, /) | Return value^self. | | __xor__(self, value, /) | Return self^value. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __format__(self, format_spec, /) | Convert to a string according to format_spec. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number
logging.logMultiprocessing
Python Library Documentation: bool object class bool(int) | bool(x) -> bool | | Returns True when the argument x is true, False otherwise. | The builtins True and False are the only two instances of the class bool. | The class bool is a subclass of the class int, and cannot be subclassed. | | Method resolution order: | bool | int | object | | Methods defined here: | | __and__(self, value, /) | Return self&value. | | __invert__(self, /) | ~self | | __or__(self, value, /) | Return self|value. | | __rand__(self, value, /) | Return value&self. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __rxor__(self, value, /) | Return value^self. | | __xor__(self, value, /) | Return self^value. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __format__(self, format_spec, /) | Convert to a string according to format_spec. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number
logging.logProcesses
Python Library Documentation: bool object class bool(int) | bool(x) -> bool | | Returns True when the argument x is true, False otherwise. | The builtins True and False are the only two instances of the class bool. | The class bool is a subclass of the class int, and cannot be subclassed. | | Method resolution order: | bool | int | object | | Methods defined here: | | __and__(self, value, /) | Return self&value. | | __invert__(self, /) | ~self | | __or__(self, value, /) | Return self|value. | | __rand__(self, value, /) | Return value&self. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __rxor__(self, value, /) | Return value^self. | | __xor__(self, value, /) | Return self^value. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __format__(self, format_spec, /) | Convert to a string according to format_spec. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number
logging.logThreads
Python Library Documentation: bool object class bool(int) | bool(x) -> bool | | Returns True when the argument x is true, False otherwise. | The builtins True and False are the only two instances of the class bool. | The class bool is a subclass of the class int, and cannot be subclassed. | | Method resolution order: | bool | int | object | | Methods defined here: | | __and__(self, value, /) | Return self&value. | | __invert__(self, /) | ~self | | __or__(self, value, /) | Return self|value. | | __rand__(self, value, /) | Return value&self. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __rxor__(self, value, /) | Return value^self. | | __xor__(self, value, /) | Return self^value. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __format__(self, format_spec, /) | Convert to a string according to format_spec. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number
logging.makeLogRecord
Python Library Documentation: function makeLogRecord in module logging
makeLogRecord(dict)
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
logging.os
Python Library Documentation: module os
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
https://docs.python.org/3.12/library/os.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This exports:
- all functions from posix or nt, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix' or 'nt'
- os.curdir is a string representing the current directory (always '.')
- os.pardir is a string representing the parent directory (always '..')
- os.sep is the (or a most common) pathname separator ('/' or '\\')
- os.extsep is the extension separator (always '.')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- os.defpath is the default search path for executables
- os.devnull 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 os.path
(e.g., split and join).
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.object
nt.DirEntry
builtins.tuple(builtins.object)
nt.times_result
nt.uname_result
stat_result
statvfs_result
terminal_size
class DirEntry(builtins.object)
| 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_junction(self, /)
| Return True if the entry is a junction; 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__(...)
| 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 os.path.join(scandir_path, entry.name)
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class stat_result(builtins.tuple)
| 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 os.stat for more information.
|
| Method resolution order:
| stat_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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_birthtime
| time of creation
|
| st_birthtime_ns
| time of creation in nanoseconds
|
| st_ctime
| time of last change
|
| st_ctime_ns
| time of last change in nanoseconds
|
| st_dev
| device
|
| st_file_attributes
| Windows file attribute bits
|
| 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_reparse_tag
| Windows reparse tag
|
| 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 = 20
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 3
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class statvfs_result(builtins.tuple)
| 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 os.statvfs for more information.
|
| Method resolution order:
| statvfs_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class terminal_size(builtins.tuple)
| terminal_size(iterable=(), /)
|
| A tuple of (columns, lines) for holding terminal window size
|
| Method resolution order:
| terminal_size
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class times_result(builtins.tuple)
| times_result(iterable=(), /)
|
| times_result: Result from os.times().
|
| 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 os.times for more information.
|
| Method resolution order:
| times_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class uname_result(builtins.tuple)
| uname_result(iterable=(), /)
|
| uname_result: Result from os.uname().
|
| 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 os.uname for more information.
|
| Method resolution order:
| uname_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
_exit(status)
Exit to the system with specified status, without normal exit processing.
abort()
Abort the interpreter immediately.
This function 'dumps core' or otherwise fails in the hardest way possible
on the hosting operating system. This function never returns.
access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
Use the real uid/gid to test for access to a path.
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 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.
chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
Change the access permissions of a file.
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.
Be careful when using number literals for *mode*. The conventional UNIX notation for
numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in
Python.
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.
It is an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
dir_fd and follow_symlinks may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
close(fd)
Close a file descriptor.
closerange(fd_low, fd_high, /)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
cpu_count()
Return the number of CPUs in the system; return None if indeterminable.
This number is not equivalent to the number of CPUs the current process can
use. The number of usable CPUs can be obtained with
``len(os.sched_getaffinity(0))``
device_encoding(fd)
Return a string describing the encoding of a terminal's file descriptor.
The file descriptor must be attached to a terminal.
If the device is not a terminal, return None.
dup(fd, /)
Return a duplicate of a file descriptor.
dup2(fd, fd2, inheritable=True)
Duplicate file descriptor.
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)
Execute the executable file with argument list args and
environment env, replacing the current process.
execlp(file, *args)
execlp(file, *args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
execlpe(file, *args)
execlpe(file, *args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the current
process.
execv(path, argv, /)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
execve(path, argv, env)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
execvp(file, args)
execvp(file, args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
args may be a list or tuple of strings.
execvpe(file, args, env)
execvpe(file, args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the
current process.
args may be a list or tuple of strings.
fdopen(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)
fsdecode(filename)
Decode filename (an os.PathLike, 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 os.PathLike, 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.
If the object is str or bytes, then allow it to pass through as-is. If the
object defines __fspath__(), then return the result of that method. All other
types raise a TypeError.
fstat(fd)
Perform a stat system call on the given file descriptor.
Like stat(), but for an open file descriptor.
Equivalent to os.stat(fd).
fsync(fd)
Force write of fd to disk.
ftruncate(fd, length, /)
Truncate a file, specified by file descriptor, to a specific length.
get_blocking(fd, /)
Get the blocking mode of the file descriptor.
Return False if the O_NONBLOCK flag is set, True if the flag is cleared.
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.
*env* must be an environment variable dict or None. If *env* is None,
os.environ will be used.
get_handle_inheritable(handle, /)
Get the close-on-exe flag of the specified file descriptor.
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.
If the file descriptor is not connected to a terminal, an OSError
is thrown.
This function will only be defined if an implementation is
available for this system.
shutil.get_terminal_size is the high-level function which should
normally be used, os.get_terminal_size is the low-level implementation.
getcwd()
Return a unicode string representing the current working directory.
getcwdb()
Return a bytes string representing the current working directory.
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.
getlogin()
Return the actual login name.
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).
isatty(fd, /)
Return True if the fd is connected to a terminal.
Return True if the file descriptor is an open file descriptor
connected to the slave end of a terminal.
kill(pid, signal, /)
Kill a process with a signal.
link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
Create a hard link to a file.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
If follow_symlinks is False, and the last element of src is a symbolic
link, link will create a link to the symbolic link itself instead of the
file the link points to.
src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your
platform. If they are unavailable, using them will raise a
NotImplementedError.
listdir(path=None)
Return a list containing the names of the files in the directory.
path can be specified as either str, bytes, or a path-like object. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.
On some platforms, path may also be specified as an open file descriptor;\
the file descriptor must refer to a directory.
If this functionality is unavailable, using it raises NotImplementedError.
The list is in arbitrary order. It does not include the special
entries '.' and '..' even if they are present in the directory.
listdrives()
Return a list containing the names of drives in the system.
A drive name typically looks like 'C:\\'.
listmounts(volume)
Return a list containing mount points for a particular volume.
'volume' should be a GUID path as returned from os.listvolumes.
listvolumes()
Return a list containing the volumes in the system.
Volumes are typically represented as a GUID path.
lseek(fd, position, whence, /)
Set the position of a file descriptor. Return the new position.
fd
An open file descriptor, as returned by os.open().
position
Position, interpreted relative to 'whence'.
whence
The relative position to seek from. Valid values are:
- SEEK_SET: seek from the start of the file.
- SEEK_CUR: seek from the current file position.
- SEEK_END: seek from the end of the file.
The return value is the number of bytes relative to the beginning of the file.
lstat(path, *, dir_fd=None)
Perform a stat system call on the given path, without following symbolic links.
Like stat(), but do not follow symbolic links.
Equivalent to stat(path, follow_symlinks=False).
makedirs(name, mode=511, exist_ok=False)
makedirs(name [, mode=0o777][, exist_ok=False])
Super-mkdir; create a leaf directory and all intermediate ones. Works like
mkdir, except that any intermediate path segment (not just the rightmost)
will be created if it does not exist. If the target directory already
exists, raise an OSError if exist_ok is False. Otherwise no exception is
raised. This is recursive.
mkdir(path, mode=511, *, dir_fd=None)
Create a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
The mode argument is ignored on Windows. Where it is used, the current umask
value is first masked out.
open(path, flags, mode=511, *, dir_fd=None)
Open a file for low level IO. Returns a file descriptor (integer).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
pipe()
Create a pipe.
Returns a tuple of two file descriptors:
(read_fd, write_fd)
popen(cmd, mode='r', buffering=-1)
putenv(name, value, /)
Change or add an environment variable.
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.
If dir_fd is 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.
dir_fd may not be implemented on your platform. If it is unavailable,
using it will raise a NotImplementedError.
remove(path, *, dir_fd=None)
Remove a file (same as unlink()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
removedirs(name)
removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.
rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
renames(old, new)
renames(old, new)
Super-rename; create directories as necessary and delete any left
empty. Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first. After the rename, directories corresponding to rightmost
path segments of the old name will be pruned until either the
whole path is consumed or a nonempty directory is found.
Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory, overwriting the destination.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
rmdir(path, *, dir_fd=None)
Remove a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
scandir(path=None)
Return an iterator of DirEntry objects for given path.
path can be specified as either str, bytes, or a path-like object. If path
is bytes, the names of yielded DirEntry objects will also be bytes; in
all other circumstances they will be str.
If path is None, uses the path='.'.
set_blocking(fd, blocking, /)
Set the blocking mode of the specified file descriptor.
Set the O_NONBLOCK flag if blocking is False,
clear the O_NONBLOCK flag otherwise.
set_handle_inheritable(handle, inheritable, /)
Set the inheritable flag of the specified handle.
set_inheritable(fd, inheritable, /)
Set the inheritable flag of the specified file descriptor.
spawnl(mode, file, *args)
spawnl(mode, file, *args) -> integer
Execute file 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.
spawnle(mode, file, *args)
spawnle(mode, file, *args, env) -> integer
Execute file 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.
spawnv(mode, path, argv, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
spawnve(mode, path, argv, env, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
startfile(...)
Start a file with its associated application.
When "operation" is not specified or "open", this acts like
double-clicking the file in Explorer, or giving the file name as an
argument to the DOS "start" command: the file is opened with whatever
application (if any) its extension is associated.
When another "operation" is given, it specifies what should be done with
the file. A typical operation is "print".
"arguments" is passed to the application, but should be omitted if the
file is a document.
"cwd" is the working directory for the operation. If "filepath" is
relative, it will be resolved against this directory. This argument
should usually be an absolute path.
"show_cmd" can be used to override the recommended visibility option.
See the Windows ShellExecute documentation for values.
startfile returns as soon as the associated application is launched.
There is no option to wait for the application to close, and no way
to retrieve the application's exit status.
The filepath is relative to the current directory. If you want to use
an absolute path, make sure the first character is not a slash ("/");
the underlying Win32 ShellExecute function doesn't work if it is.
stat(path, *, dir_fd=None, follow_symlinks=True)
Perform a stat system call on the given path.
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.
dir_fd and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
It's an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
strerror(code, /)
Translate an error code to a message string.
symlink(src, dst, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to src named dst.
target_is_directory is required on Windows if the target is to be
interpreted as a directory. (On Windows, symlink requires
Windows 6.0 or greater, and raises a NotImplementedError otherwise.)
target_is_directory is ignored on non-Windows platforms.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
system(command)
Execute the command in a subshell.
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.
umask(mask, /)
Set the current numeric umask and return the previous umask.
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
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.
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.
If times is not None, it must be a tuple (atime, mtime);
atime and mtime should be expressed as float seconds since the epoch.
If ns is specified, it must be a tuple (atime_ns, mtime_ns);
atime_ns and mtime_ns should be expressed as integer nanoseconds
since the epoch.
If times is None and ns is unspecified, utime uses the current time.
Specifying tuples for both times and ns is an error.
If dir_fd is 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.
If follow_symlinks is False, and the last element of the path is a symbolic
link, utime will modify the symbolic link itself instead of the file the
link points to.
It is an error to use dir_fd or follow_symlinks when specifying path
as an open file descriptor.
dir_fd and follow_symlinks may not be available on your platform.
If they are unavailable, using them will raise a NotImplementedError.
waitpid(pid, options, /)
Wait for completion of a given process.
Returns a tuple of information regarding the process:
(pid, status << 8)
The options argument is ignored on Windows.
waitstatus_to_exitcode(status)
Convert a wait status to an exit code.
On Unix:
* If WIFEXITED(status) is true, return WEXITSTATUS(status).
* If WIFSIGNALED(status) is true, return -WTERMSIG(status).
* Otherwise, raise a ValueError.
On Windows, return status shifted right by 8 bits.
On Unix, if the process is being traced or if waitpid() was called with
WUNTRACED option, the caller must first check if WIFSTOPPED(status) is true.
This function must not be called if WIFSTOPPED(status) is true.
walk(top, topdown=True, onerror=None, followlinks=False)
Directory tree generator.
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (including symlinks to directories,
and excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).
If optional arg 'topdown' is true or not specified, the triple for a
directory is generated before the triples for any of its subdirectories
(directories are generated top down). If topdown is false, the triple
for a directory is generated after the triples for all of its
subdirectories (directories are generated bottom up).
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 os.walk(), 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.
By default errors from the os.scandir() call are ignored. If
optional arg 'onerror' is specified, it should be a function; it
will be called with one argument, an OSError instance. It can
report the error to continue with the walk, or raise the exception
to abort the walk. Note that the filename is available as the
filename attribute of the exception object.
By default, os.walk does not follow symbolic links to subdirectories on
systems that support them. In order to get this functionality, set the
optional argument 'followlinks' to true.
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 os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print(root, "consumes ")
print(sum(getsize(join(root, name)) for name in files), end=" ")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
write(fd, data, /)
Write a bytes object to a file descriptor.
DATA
EX_OK = 0
F_OK = 0
O_APPEND = 8
O_BINARY = 32768
O_CREAT = 256
O_EXCL = 1024
O_NOINHERIT = 128
O_RANDOM = 16
O_RDONLY = 0
O_RDWR = 2
O_SEQUENTIAL = 32
O_SHORT_LIVED = 4096
O_TEMPORARY = 64
O_TEXT = 16384
O_TRUNC = 512
O_WRONLY = 1
P_DETACH = 4
P_NOWAIT = 1
P_NOWAITO = 3
P_OVERLAY = 2
P_WAIT = 0
R_OK = 4
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
TMP_MAX = 2147483647
W_OK = 2
X_OK = 1
__all__ = ['altsep', 'curdir', 'pardir', 'sep', 'pathsep', 'linesep', ...
altsep = '/'
curdir = '.'
defpath = r'.;C:\bin'
devnull = 'nul'
environ = environ({'ALLUSERSPROFILE': 'C:\\ProgramData', '...undled\\l...
extsep = '.'
linesep = '\r\n'
name = 'nt'
pardir = '..'
pathsep = ';'
sep = r'\'
supports_bytes_environ = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\os.py
logging.raiseExceptions
Python Library Documentation: bool object class bool(int) | bool(x) -> bool | | Returns True when the argument x is true, False otherwise. | The builtins True and False are the only two instances of the class bool. | The class bool is a subclass of the class int, and cannot be subclassed. | | Method resolution order: | bool | int | object | | Methods defined here: | | __and__(self, value, /) | Return self&value. | | __invert__(self, /) | ~self | | __or__(self, value, /) | Return self|value. | | __rand__(self, value, /) | Return value&self. | | __repr__(self, /) | Return repr(self). | | __ror__(self, value, /) | Return value|self. | | __rxor__(self, value, /) | Return value^self. | | __xor__(self, value, /) | Return self^value. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from int: | | __abs__(self, /) | abs(self) | | __add__(self, value, /) | Return self+value. | | __bool__(self, /) | True if self else False | | __ceil__(...) | Ceiling of an Integral returns itself. | | __divmod__(self, value, /) | Return divmod(self, value). | | __eq__(self, value, /) | Return self==value. | | __float__(self, /) | float(self) | | __floor__(...) | Flooring an Integral returns itself. | | __floordiv__(self, value, /) | Return self//value. | | __format__(self, format_spec, /) | Convert to a string according to format_spec. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __index__(self, /) | Return self converted to an integer, if self is suitable for use as an index into a list. | | __int__(self, /) | int(self) | | __le__(self, value, /) | Return self<=value. | | __lshift__(self, value, /) | Return self<<value. | | __lt__(self, value, /) | Return self<value. | | __mod__(self, value, /) | Return self%value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __neg__(self, /) | -self | | __pos__(self, /) | +self | | __pow__(self, value, mod=None, /) | Return pow(self, value, mod). | | __radd__(self, value, /) | Return value+self. | | __rdivmod__(self, value, /) | Return divmod(value, self). | | __rfloordiv__(self, value, /) | Return value//self. | | __rlshift__(self, value, /) | Return value<<self. | | __rmod__(self, value, /) | Return value%self. | | __rmul__(self, value, /) | Return value*self. | | __round__(...) | Rounding an Integral returns itself. | | Rounding with an ndigits argument also returns an integer. | | __rpow__(self, value, mod=None, /) | Return pow(value, self, mod). | | __rrshift__(self, value, /) | Return value>>self. | | __rshift__(self, value, /) | Return self>>value. | | __rsub__(self, value, /) | Return value-self. | | __rtruediv__(self, value, /) | Return value/self. | | __sizeof__(self, /) | Returns size in memory, in bytes. | | __sub__(self, value, /) | Return self-value. | | __truediv__(self, value, /) | Return self/value. | | __trunc__(...) | Truncating an Integral returns itself. | | as_integer_ratio(self, /) | Return a pair of integers, whose ratio is equal to the original int. | | The ratio is in lowest terms and has a positive denominator. | | >>> (10).as_integer_ratio() | (10, 1) | >>> (-10).as_integer_ratio() | (-10, 1) | >>> (0).as_integer_ratio() | (0, 1) | | bit_count(self, /) | Number of ones in the binary representation of the absolute value of self. | | Also known as the population count. | | >>> bin(13) | '0b1101' | >>> (13).bit_count() | 3 | | bit_length(self, /) | Number of bits necessary to represent self in binary. | | >>> bin(37) | '0b100101' | >>> (37).bit_length() | 6 | | conjugate(...) | Returns self, the complex conjugate of any int. | | is_integer(self, /) | Returns True. Exists for duck type compatibility with float.is_integer. | | to_bytes(self, /, length=1, byteorder='big', *, signed=False) | Return an array of bytes representing an integer. | | length | Length of bytes object to use. An OverflowError is raised if the | integer is not representable with the given number of bytes. Default | is length 1. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Determines whether two's complement is used to represent the integer. | If signed is False and a negative integer is given, an OverflowError | is raised. | | ---------------------------------------------------------------------- | Class methods inherited from int: | | from_bytes(bytes, byteorder='big', *, signed=False) | Return the integer represented by the given array of bytes. | | bytes | Holds the array of bytes to convert. The argument must either | support the buffer protocol or be an iterable object producing bytes. | Bytes and bytearray are examples of built-in objects that support the | buffer protocol. | byteorder | The byte order used to represent the integer. If byteorder is 'big', | the most significant byte is at the beginning of the byte array. If | byteorder is 'little', the most significant byte is at the end of the | byte array. To request the native byte order of the host system, use | `sys.byteorder' as the byte order value. Default is to use 'big'. | signed | Indicates whether two's complement is used to represent the integer. | | ---------------------------------------------------------------------- | Data descriptors inherited from int: | | denominator | the denominator of a rational number in lowest terms | | imag | the imaginary part of a complex number | | numerator | the numerator of a rational number in lowest terms | | real | the real part of a complex number
logging.re
Python Library Documentation: package re
NAME
re - Support for regular expressions (RE).
MODULE REFERENCE
https://docs.python.org/3.12/library/re.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?aiLmsux) The letters set the corresponding flags defined below.
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
The special sequences consist of "\\" and a character from the list
below. If the ordinary character is not on the list, then the
resulting RE will match the second character.
\number Matches the contents of the group of the same number.
\A Matches only at the start of the string.
\Z Matches only at the end of the string.
\b Matches the empty string, but only at the start or end of a word.
\B Matches the empty string, but not at the start or end of a word.
\d Matches any decimal digit; equivalent to the set [0-9] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode digits.
\D Matches any non-digit character; equivalent to [^\d].
\s Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode whitespace characters.
\S Matches any non-whitespace character; equivalent to [^\s].
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the
range of Unicode alphanumeric characters (letters plus digits
plus underscore).
With LOCALE, it will match the set [0-9_] plus characters defined
as letters for the current locale.
\W Matches the complement of \w.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern to the beginning of a string.
fullmatch Match a regular expression pattern to all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string.
subn Same as sub, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a Match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics in a string.
Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
A ASCII For string patterns, make \w, \W, \b, \B, \d, \D
match the corresponding ASCII character categories
(rather than the whole Unicode categories, which is the
default).
For bytes patterns, this flag is the only available
behaviour and needn't be specified.
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE For compatibility only. Ignored for string patterns (it
is the default), and forbidden for bytes patterns.
This module also defines an exception 'error'.
PACKAGE CONTENTS
_casefix
_compiler
_constants
_parser
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
Match
Pattern
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
RegexFlag
class Match(builtins.object)
| The result of re.match() and re.search().
| Match objects always have a boolean value of True.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __getitem__(self, key, /)
| Return self[key].
|
| __repr__(self, /)
| Return repr(self).
|
| end(self, group=0, /)
| Return index of the end of the substring matched by group.
|
| expand(self, /, template)
| Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
|
| group(...)
| group([group1, ...]) -> str or tuple.
| Return subgroup(s) of the match by indices or names.
| For 0 returns the entire match.
|
| groupdict(self, /, default=None)
| Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
|
| default
| Is used for groups that did not participate in the match.
|
| groups(self, /, default=None)
| Return a tuple containing all the subgroups of the match, from 1.
|
| default
| Is used for groups that did not participate in the match.
|
| span(self, group=0, /)
| For match object m, return the 2-tuple (m.start(group), m.end(group)).
|
| start(self, group=0, /)
| Return index of the start of the substring matched by group.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| endpos
| The index into the string beyond which the RE engine will not go.
|
| lastgroup
| The name of the last matched capturing group.
|
| lastindex
| The integer index of the last matched capturing group.
|
| pos
| The index into the string at which the RE engine started looking for a match.
|
| re
| The regular expression object.
|
| regs
|
| string
| The string passed to match() or search().
class Pattern(builtins.object)
| Compiled regular expression object.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| findall(self, /, string, pos=0, endpos=9223372036854775807)
| Return a list of all non-overlapping matches of pattern in string.
|
| finditer(self, /, string, pos=0, endpos=9223372036854775807)
| Return an iterator over all non-overlapping matches for the RE pattern in string.
|
| For each match, the iterator returns a match object.
|
| fullmatch(self, /, string, pos=0, endpos=9223372036854775807)
| Matches against all of the string.
|
| match(self, /, string, pos=0, endpos=9223372036854775807)
| Matches zero or more characters at the beginning of the string.
|
| scanner(self, /, string, pos=0, endpos=9223372036854775807)
|
| search(self, /, string, pos=0, endpos=9223372036854775807)
| Scan through string looking for a match, and return a corresponding match object instance.
|
| Return None if no position in the string matches.
|
| split(self, /, string, maxsplit=0)
| Split string by the occurrences of pattern.
|
| sub(self, /, repl, string, count=0)
| Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
|
| subn(self, /, repl, string, count=0)
| Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| flags
| The regex matching flags.
|
| groupindex
| A dictionary mapping group names to group numbers.
|
| groups
| The number of capturing groups in the pattern.
|
| pattern
| The pattern string from which the RE object was compiled.
class RegexFlag(enum.IntFlag)
| RegexFlag(*values)
|
| An enumeration.
|
| Method resolution order:
| RegexFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __repr__ = global_flag_repr(self) from enum
| use module.flag_name instead of class.flag_name
|
| the module is the last module in case of a multi-module name
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __str__(self, /) from builtins.object
| Return str(self).
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII = re.ASCII
|
| DEBUG = re.DEBUG
|
| DOTALL = re.DOTALL
|
| IGNORECASE = re.IGNORECASE
|
| LOCALE = re.LOCALE
|
| MULTILINE = re.MULTILINE
|
| TEMPLATE = re.TEMPLATE
|
| UNICODE = re.UNICODE
|
| VERBOSE = re.VERBOSE
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class error(builtins.Exception)
| error(msg, pattern=None, pos=None)
|
| Exception raised for invalid regular expressions.
|
| Attributes:
|
| msg: The unformatted error message
| pattern: The regular expression pattern
| pos: The index in the pattern where compilation failed (may be None)
| lineno: The line corresponding to pos (may be None)
| colno: The column corresponding to pos (may be None)
|
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg, pattern=None, pos=None) from re._constants.error
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
compile(pattern, flags=0)
Compile a regular expression pattern, returning a Pattern object.
escape(pattern)
Escape special characters in a string.
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a Match object.
Empty matches are included in the result.
fullmatch(pattern, string, flags=0)
Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found.
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a Match object, or None if no match was found.
purge()
Clear the regular expression caches
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning
a Match object, or None if no match was found.
split(pattern, string, maxsplit=0, flags=0)
Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. If
capturing parentheses are used in pattern, then the text of all
groups in the pattern are also returned as part of the resulting
list. If maxsplit is nonzero, at most maxsplit splits occur,
and the remainder of the string is returned as the final element
of the list.
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used.
subn(pattern, repl, string, count=0, flags=0)
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl. number is the number of
substitutions that were made. repl can be either a string or a
callable; if a string, backslash escapes in it are processed.
If it is a callable, it's passed the Match object and must
return a replacement string to be used.
template(pattern, flags=0)
Compile a template pattern, returning a Pattern object, deprecated
DATA
A = re.ASCII
ASCII = re.ASCII
DOTALL = re.DOTALL
I = re.IGNORECASE
IGNORECASE = re.IGNORECASE
L = re.LOCALE
LOCALE = re.LOCALE
M = re.MULTILINE
MULTILINE = re.MULTILINE
NOFLAG = re.NOFLAG
S = re.DOTALL
U = re.UNICODE
UNICODE = re.UNICODE
VERBOSE = re.VERBOSE
X = re.VERBOSE
__all__ = ['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'fi...
VERSION
2.2.1
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\re\__init__.py
logging.root
Python Library Documentation: RootLogger in module logging object
class RootLogger(Logger)
| RootLogger(level)
|
| A root logger is not that different to any other logger, except that
| it must have a logging level and there is only one instance of it in
| the hierarchy.
|
| Method resolution order:
| RootLogger
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, level)
| Initialize the logger with the name "root".
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Methods inherited from Logger:
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Logger:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
logging.setLogRecordFactory
Python Library Documentation: function setLogRecordFactory in module logging
setLogRecordFactory(factory)
Set the factory to be used when instantiating a log record.
:param factory: A callable which will be called to instantiate
a log record.
logging.setLoggerClass
Python Library Documentation: function setLoggerClass in module logging
setLoggerClass(klass)
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
logging.shutdown
Python Library Documentation: function shutdown in module logging
shutdown(handlerList=[<weakref at 0x00000172065F6700; to '_StderrHandler' at 0x00000172065F2630>])
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
logging.sys
Python Library Documentation: built-in module sys
NAME
sys
MODULE REFERENCE
https://docs.python.org/3.12/library/sys.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
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:
argv -- command line arguments; argv[0] is the script pathname if known
path -- module search path; path[0] is the script directory, else ''
modules -- dictionary of loaded modules
displayhook -- called to show results in an interactive session
excepthook -- called to handle any uncaught exception other than SystemExit
To customize printing in an interactive session or to install a custom
top-level exception handler, assign other functions to replace these.
stdin -- standard input file object; used by input()
stdout -- standard output file object; used by print()
stderr -- standard error object; used for error messages
By assigning other file objects (or objects that behave like files)
to these, it is possible to redirect all of the interpreter's I/O.
last_exc - the last uncaught exception
Only available in an interactive session after a
traceback has been printed.
last_type -- type of last uncaught exception
last_value -- value of last uncaught exception
last_traceback -- traceback of last uncaught exception
These three are the (deprecated) legacy representation of last_exc.
Static objects:
builtin_module_names -- tuple of module names built into this interpreter
copyright -- copyright notice pertaining to this interpreter
exec_prefix -- prefix used to find the machine-specific Python library
executable -- absolute path of the executable binary of the Python interpreter
float_info -- a named tuple with information about the float implementation.
float_repr_style -- string indicating the style of repr() output for floats
hash_info -- a named tuple with information about the hash algorithm.
hexversion -- version information encoded as a single integer
implementation -- Python implementation information.
int_info -- a named tuple with information about the int implementation.
maxsize -- the largest supported length of containers.
maxunicode -- the value of the largest Unicode code point
platform -- platform identifier
prefix -- prefix used to find the Python library
thread_info -- a named tuple with information about the thread implementation.
version -- the version of this interpreter as a string
version_info -- version information as a named tuple
dllhandle -- [Windows only] integer handle of the Python DLL
winver -- [Windows only] version number of the Python DLL
_enablelegacywindowsfsencoding -- [Windows only]
__stdin__ -- the original stdin; don't touch!
__stdout__ -- the original stdout; don't touch!
__stderr__ -- the original stderr; don't touch!
__displayhook__ -- the original displayhook; don't touch!
__excepthook__ -- the original excepthook; don't touch!
Functions:
displayhook() -- print an object to the screen, and save it in builtins._
excepthook() -- print an exception and its traceback to sys.stderr
exception() -- return the current thread's active exception
exc_info() -- return information about the current thread's active exception
exit() -- exit the interpreter by raising SystemExit
getdlopenflags() -- returns flags to be used for dlopen() calls
getprofile() -- get the global profiling function
getrefcount() -- return the reference count for an object (plus one :-)
getrecursionlimit() -- return the max recursion depth for the interpreter
getsizeof() -- return the size of an object in bytes
gettrace() -- get the global debug tracing function
setdlopenflags() -- set the flags to be used for dlopen() calls
setprofile() -- set the global profiling function
setrecursionlimit() -- set the max recursion depth for the interpreter
settrace() -- set the global debug tracing function
SUBMODULES
monitoring
FUNCTIONS
__breakpointhook__ = breakpointhook(...)
breakpointhook(*args, **kws)
This hook function is called by built-in breakpoint().
__displayhook__ = displayhook(object, /)
Print an object to sys.stdout and also save it in builtins._
__excepthook__ = excepthook(exctype, value, traceback, /)
Handle an exception by displaying it with a traceback on sys.stderr.
__unraisablehook__ = unraisablehook(unraisable, /)
Handle an unraisable exception.
The unraisable argument has the following attributes:
* exc_type: Exception type.
* exc_value: Exception value, can be None.
* exc_traceback: Exception traceback, can be None.
* err_msg: Error message, can be None.
* object: Object causing the exception, can be None.
activate_stack_trampoline(backend, /)
Activate stack profiler trampoline *backend*.
addaudithook(hook)
Adds a new audit hook callback.
audit(...)
audit(event, *args)
Passes the event to any audit hooks that are attached.
breakpointhook(...)
breakpointhook(*args, **kws)
This hook function is called by built-in breakpoint().
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.
deactivate_stack_trampoline()
Deactivate the current stack profiler trampoline backend.
If no stack profiler is activated, this function has no effect.
displayhook(object, /)
Print an object to sys.stdout and also save it in builtins._
exc_info()
Return current exception information: (type, value, traceback).
Return information about the most recent exception caught by an except
clause in the current stack frame or in an older stack frame.
excepthook(exctype, value, traceback, /)
Handle an exception by displaying it with a traceback on sys.stderr.
exception()
Return the current exception.
Return the most recent exception caught by an except clause
in the current stack frame or in an older stack frame, or None
if no such exception exists.
exit(status=None, /)
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is an integer, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
get_asyncgen_hooks()
Return the installed asynchronous generators hooks.
This returns a namedtuple of the form (firstiter, finalizer).
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.
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 sys.setprofile.
See the profiler chapter in the library manual.
getrecursionlimit()
Return the current value of the recursion limit.
The recursion limit is the maximum depth of the Python interpreter
stack. This limit prevents infinite recursion from causing an overflow
of the C stack and crashing Python.
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
Return the size of object in bytes.
getswitchinterval()
Return the current thread switch interval; see sys.setswitchinterval().
gettrace()
Return the global debug tracing function set with sys.settrace.
See the debugger chapter in the library manual.
getunicodeinternedsize()
Return the number of elements of the unicode interned dictionary
getwindowsversion()
Return info about the running version of Windows as a named tuple.
The members are named: major, minor, build, platform, service_pack,
service_pack_major, service_pack_minor, suite_mask, product_type and
platform_version. For backward compatibility, only the first 5 items
are available by indexing. All elements are numbers, except
service_pack and platform_type which are strings, and platform_version
which is a 3-tuple. Platform is always 2. Product_type may be 1 for a
workstation, 2 for a domain controller, 3 for a server.
Platform_version is a 3-tuple containing a version number that is
intended for identifying the OS rather than feature detection.
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.
is_stack_trampoline_active()
Return *True* if a stack profiler trampoline is active.
set_asyncgen_hooks(...)
set_asyncgen_hooks([firstiter] [, finalizer])
Set a finalizer for async generators objects.
set_coroutine_origin_tracking_depth(depth)
Enable or disable origin tracking for coroutine objects in this thread.
Coroutine objects will track 'depth' frames of traceback information
about where they came from, available in their cr_origin attribute.
Set a depth of 0 to disable.
set_int_max_str_digits(maxdigits)
Set the maximum string digits limit for non-binary int<->str conversions.
setprofile(...)
setprofile(function)
Set the profiling function. It will be called on each function call
and return. See the profiler chapter in the library manual.
setrecursionlimit(limit, /)
Set the maximum depth of the Python interpreter stack to n.
This limit prevents infinite recursion from causing an overflow of the C
stack and crashing Python. The highest possible limit is platform-
dependent.
setswitchinterval(interval, /)
Set the ideal thread switching delay inside the Python interpreter.
The actual frequency of switching threads can be lower if the
interpreter executes long sequences of uninterruptible code
(this is implementation-specific and workload-dependent).
The parameter must represent the desired switching delay in seconds
A typical value is 0.005 (5 milliseconds).
settrace(...)
settrace(function)
Set the global debug tracing function. It will be called on each
function call. See the debugger chapter in the library manual.
unraisablehook(unraisable, /)
Handle an unraisable exception.
The unraisable argument has the following attributes:
* exc_type: Exception type.
* exc_value: Exception value, can be None.
* exc_traceback: Exception traceback, can be None.
* err_msg: Error message, can be None.
* object: Object causing the exception, can be None.
DATA
__stderr__ = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='cp1...
__stdin__ = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8...
__stdout__ = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1...
api_version = 1013
argv = [r'f:\JoeyCodes\PyDocs\py_docs.py', '--worker', 'logging', r'F:...
base_exec_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Pyth...
base_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312...
builtin_module_names = ('_abc', '_ast', '_bisect', '_blake2', '_codecs...
byteorder = 'little'
copyright = 'Copyright (c) 2001-2023 Python Software Foundati...ematis...
dllhandle = 140727031824384
dont_write_bytecode = False
exec_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312...
executable = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312\...
flags = sys.flags(debug=0, inspect=0, interactive=0, opt...ding=0, saf...
float_info = sys.float_info(max=1.7976931348623157e+308, max_...epsilo...
float_repr_style = 'short'
hash_info = sys.hash_info(width=64, modulus=2305843009213693...iphash1...
hexversion = 51119856
implementation = namespace(name='cpython', cache_tag='cpython-312...as...
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 = {'__future__': <module '__future__' from 'C:\\Users\\Youse\\...
orig_argv = [r'C:\Users\Youse\AppData\Local\Programs\Python\Python312\...
path = [r'f:\JoeyCodes\PyDocs', r'C:\Users\Youse\AppData\Local\Program...
path_hooks = [<class 'zipimport.zipimporter'>, <function FileFinder.pa...
path_importer_cache = {r'C:\Users\Youse\AppData\Local\Programs\Python\...
platform = 'win32'
platlibdir = 'DLLs'
prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312'
pycache_prefix = None
stderr = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='cp1252'...
stdin = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>
stdlib_module_names = frozenset({'__future__', '_abc', '_aix_support',...
stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'...
thread_info = sys.thread_info(name='nt', lock=None, version=None)
version = '3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v...
version_info = sys.version_info(major=3, minor=12, micro=6, releaselev...
warnoptions = []
winver = '3.12'
FILE
(built-in)
logging.threading
Python Library Documentation: module threading
NAME
threading - Thread module emulating a subset of Java's threading model.
MODULE REFERENCE
https://docs.python.org/3.12/library/threading.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.Exception(builtins.BaseException)
builtins.RuntimeError
BrokenBarrierError
builtins.object
_thread._local
Barrier
Condition
Event
Semaphore
BoundedSemaphore
Thread
Timer
builtins.tuple(builtins.object)
_thread._ExceptHookArgs
class Barrier(builtins.object)
| Barrier(parties, action=None, timeout=None)
|
| Implements a Barrier.
|
| Useful for synchronizing a fixed number of threads at known synchronization
| points. Threads block on 'wait()' and are simultaneously awoken once they
| have all made that call.
|
| Methods defined here:
|
| __init__(self, parties, action=None, timeout=None)
| Create a barrier, initialised to 'parties' threads.
|
| 'action' is a callable which, when supplied, will be called by one of
| the threads after they have all entered the barrier and just prior to
| releasing them all. If a 'timeout' is provided, it is used as the
| default for all subsequent 'wait()' calls.
|
| __repr__(self)
| Return repr(self).
|
| abort(self)
| Place the barrier into a 'broken' state.
|
| Useful in case of error. Any currently waiting threads and threads
| attempting to 'wait()' will have BrokenBarrierError raised.
|
| reset(self)
| Reset the barrier to the initial state.
|
| Any threads currently waiting will get the BrokenBarrier exception
| raised.
|
| wait(self, timeout=None)
| Wait for the barrier.
|
| When the specified number of threads have started waiting, they are all
| simultaneously awoken. If an 'action' was provided for the barrier, one
| of the threads will have executed that callback prior to returning.
| Returns an individual index number from 0 to 'parties-1'.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| broken
| Return True if the barrier is in a broken state.
|
| n_waiting
| Return the number of threads currently waiting at the barrier.
|
| parties
| Return the number of threads required to trip the barrier.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BoundedSemaphore(Semaphore)
| BoundedSemaphore(value=1)
|
| Implements a bounded semaphore.
|
| A bounded semaphore checks to make sure its current value doesn't exceed its
| initial value. If it does, ValueError is raised. In most situations
| semaphores are used to guard resources with limited capacity.
|
| If the semaphore is released too many times it's a sign of a bug. If not
| given, value defaults to 1.
|
| Like regular semaphores, bounded semaphores manage a counter representing
| the number of release() calls minus the number of acquire() calls, plus an
| initial value. The acquire() method blocks if necessary until it can return
| without making the counter negative. If not given, value defaults to 1.
|
| Method resolution order:
| BoundedSemaphore
| Semaphore
| builtins.object
|
| Methods defined here:
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| If the number of releases exceeds the number of acquires,
| raise a ValueError.
|
| ----------------------------------------------------------------------
| Methods inherited from Semaphore:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Semaphore:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BrokenBarrierError(builtins.RuntimeError)
| # exception raised by the Barrier class
|
| Method resolution order:
| BrokenBarrierError
| builtins.RuntimeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.RuntimeError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.RuntimeError:
|
| __new__(*args, **kwargs) class method of builtins.RuntimeError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Condition(builtins.object)
| Condition(lock=None)
|
| Class that implements a condition variable.
|
| A condition variable allows one or more threads to wait until they are
| notified by another thread.
|
| If the lock argument is given and not None, it must be a Lock or RLock
| object, and it is used as the underlying lock. Otherwise, a new RLock object
| is created and used as the underlying lock.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __init__(self, lock=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| notify(self, n=1)
| Wake up one or more threads waiting on this condition, if any.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method wakes up at most n of the threads waiting for the condition
| variable; it is a no-op if no threads are waiting.
|
| notifyAll(self)
| Wake up all threads waiting on this condition.
|
| This method is deprecated, use notify_all() instead.
|
| notify_all(self)
| Wake up all threads waiting on this condition.
|
| If the calling thread has not acquired the lock when this method
| is called, a RuntimeError is raised.
|
| wait(self, timeout=None)
| Wait until notified or until a timeout occurs.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method releases the underlying lock, and then blocks until it is
| awakened by a notify() or notify_all() call for the same condition
| variable in another thread, or until the optional timeout occurs. Once
| awakened or timed out, it re-acquires the lock and returns.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| When the underlying lock is an RLock, it is not released using its
| release() method, since this may not actually unlock the lock when it
| was acquired multiple times recursively. Instead, an internal interface
| of the RLock class is used, which really unlocks it even when it has
| been recursively acquired several times. Another internal interface is
| then used to restore the recursion level when the lock is reacquired.
|
| wait_for(self, predicate, timeout=None)
| Wait until a condition evaluates to True.
|
| predicate should be a callable which result will be interpreted as a
| boolean value. A timeout may be provided giving the maximum time to
| wait.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Event(builtins.object)
| Class implementing event objects.
|
| Events manage a flag that can be set to true with the set() method and reset
| to false with the clear() method. The wait() method blocks until the flag is
| true. The flag is initially false.
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| clear(self)
| Reset the internal flag to false.
|
| Subsequently, threads calling wait() will block until set() is called to
| set the internal flag to true again.
|
| isSet(self)
| Return true if and only if the internal flag is true.
|
| This method is deprecated, use is_set() instead.
|
| is_set(self)
| Return true if and only if the internal flag is true.
|
| set(self)
| Set the internal flag to true.
|
| All threads waiting for it to become true are awakened. Threads
| that call wait() once the flag is true will not block at all.
|
| wait(self, timeout=None)
| Block until the internal flag is true.
|
| If the internal flag is true on entry, return immediately. Otherwise,
| block until another thread calls set() to set the flag to true, or until
| the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| This method returns the internal flag on exit, so it will always return
| True except if a timeout is given and the operation times out.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
ExceptHookArgs = class _ExceptHookArgs(builtins.tuple)
| ExceptHookArgs(iterable=(), /)
|
| ExceptHookArgs
|
| Type used to pass arguments to threading.excepthook.
|
| Method resolution order:
| _ExceptHookArgs
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| exc_traceback
| Exception traceback
|
| exc_type
| Exception type
|
| exc_value
| Exception value
|
| thread
| Thread
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('exc_type', 'exc_value', 'exc_traceback', 'thread')
|
| n_fields = 4
|
| n_sequence_fields = 4
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class Semaphore(builtins.object)
| Semaphore(value=1)
|
| This class implements semaphore objects.
|
| Semaphores manage a counter representing the number of release() calls minus
| the number of acquire() calls, plus an initial value. The acquire() method
| blocks if necessary until it can return without making the counter
| negative. If not given, value defaults to 1.
|
| Methods defined here:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Thread(builtins.object)
| Thread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
|
| A class that represents a thread of control.
|
| This class can be safely subclassed in a limited fashion. There are two ways
| to specify the activity: by passing a callable object to the constructor, or
| by overriding the run() method in a subclass.
|
| Methods defined here:
|
| __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
ThreadError = class RuntimeError(Exception)
| Unspecified run-time error.
|
| Method resolution order:
| RuntimeError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| NotImplementedError
| RecursionError
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Timer(Thread)
| Timer(interval, function, args=None, kwargs=None)
|
| Call a function after a specified number of seconds:
|
| t = Timer(30.0, f, args=None, kwargs=None)
| t.start()
| t.cancel() # stop the timer's action if it's still waiting
|
| Method resolution order:
| Timer
| Thread
| builtins.object
|
| Methods defined here:
|
| __init__(self, interval, function, args=None, kwargs=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| cancel(self)
| Stop the timer if it hasn't finished yet.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| ----------------------------------------------------------------------
| Methods inherited from Thread:
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Thread:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Thread:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
local = class _local(builtins.object)
| Thread-local data
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
FUNCTIONS
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
Create a new lock object. See help(type(threading.Lock())) for
information about locks.
RLock(*args, **kwargs)
Factory function that returns a new reentrant lock.
A reentrant lock must be released by the thread that acquired it. Once a
thread has acquired a reentrant lock, the same thread may acquire it again
without blocking; the thread must release it once for each time it has
acquired it.
__excepthook__ = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
active_count()
Return the number of Thread objects currently alive.
The returned count is equal to the length of the list returned by
enumerate().
current_thread()
Return the current Thread object, corresponding to the caller's thread of control.
If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned.
enumerate()
Return a list of all Thread objects currently alive.
The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.
excepthook = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
get_ident(...)
get_ident() -> integer
Return a non-zero integer that uniquely identifies the current thread
amongst other threads that exist simultaneously.
This may be used to identify per-thread resources.
Even though on some platforms threads identities may appear to be
allocated consecutive numbers starting at 1, this behavior should not
be relied upon, and the number should be seen purely as a magic cookie.
A thread's identity may be reused for another thread after it exits.
get_native_id(...)
get_native_id() -> integer
Return a non-negative integer identifying the thread as reported
by the OS (kernel). This may be used to uniquely identify a
particular thread within a system.
getprofile()
Get the profiler function as set by threading.setprofile().
gettrace()
Get the trace function as set by threading.settrace().
main_thread()
Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started.
setprofile(func)
Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
setprofile_all_threads(func)
Set a profile function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
settrace(func)
Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
settrace_all_threads(func)
Set a trace function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
stack_size(...)
stack_size([size]) -> size
Return the thread stack size used when creating new threads. The
optional size argument specifies the stack size (in bytes) to be used
for subsequently created threads, and must be 0 (use platform or
configured default) or a positive integer value of at least 32,768 (32k).
If changing the thread stack size is unsupported, a ThreadError
exception is raised. If the specified size is invalid, a ValueError
exception is raised, and the stack size is unmodified. 32k bytes
currently the minimum supported stack size value to guarantee
sufficient stack space for the interpreter itself.
Note that some platforms may have particular restrictions on values for
the stack size, such as requiring a minimum stack size larger than 32 KiB or
requiring allocation in multiples of the system memory page size
- platform documentation should be referred to for more information
(4 KiB pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).
DATA
TIMEOUT_MAX = 4294967.0
__all__ = ['get_ident', 'active_count', 'Condition', 'current_thread',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\threading.py
logging.time
Python Library Documentation: built-in module time
NAME
time - This module provides various functions to manipulate time values.
DESCRIPTION
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating-point number (to represent fractions of seconds).
The epoch is the point where the time starts, the return value of time.gmtime(0).
It is January 1, 1970, 00:00:00 (UTC) on all platforms.
The other representation is a tuple of 9 integers giving local time.
The tuple items are:
year (including century, e.g. 1998)
month (1-12)
day (1-31)
hours (0-23)
minutes (0-59)
seconds (0-59)
weekday (0-6, Monday is 0)
Julian day (day in the year, 1-366)
DST (Daylight Savings Time) flag (-1, 0 or 1)
If the DST flag is 0, the time is given in the regular time zone;
if it is 1, the time is given in the DST time zone;
if it is -1, mktime() should guess based on the date and time.
CLASSES
builtins.tuple(builtins.object)
struct_time
class struct_time(builtins.tuple)
| struct_time(iterable=(), /)
|
| The time value as returned by gmtime(), localtime(), and strptime(), and
| accepted by asctime(), mktime() and strftime(). May be considered as a
| sequence of 9 integers.
|
| Note that several fields' values are not the same as those defined by
| the C language standard for struct tm. For example, the value of the
| field tm_year is the actual year, not year - 1900. See individual
| fields' descriptions for details.
|
| Method resolution order:
| struct_time
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| tm_gmtoff
| offset from UTC in seconds
|
| tm_hour
| hours, range [0, 23]
|
| tm_isdst
| 1 if summer time is in effect, 0 if not, and -1 if unknown
|
| tm_mday
| day of month, range [1, 31]
|
| tm_min
| minutes, range [0, 59]
|
| tm_mon
| month of year, range [1, 12]
|
| tm_sec
| seconds, range [0, 61])
|
| tm_wday
| day of week, range [0, 6], Monday is 0
|
| tm_yday
| day of year, range [1, 366]
|
| tm_year
| year, for example, 1993
|
| tm_zone
| abbreviation of timezone name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',...
|
| n_fields = 11
|
| n_sequence_fields = 9
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
asctime(...)
asctime([tuple]) -> string
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.
When the time tuple is not present, current time as returned by localtime()
is used.
ctime(...)
ctime(seconds) -> string
Convert a time in seconds since the Epoch to a string in local time.
This is equivalent to asctime(localtime(seconds)). When the time tuple is
not present, current time as returned by localtime() is used.
get_clock_info(...)
get_clock_info(name: str) -> dict
Get information of the specified clock.
gmtime(...)
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
tm_sec, tm_wday, tm_yday, tm_isdst)
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.
GMT). When 'seconds' is not passed in, convert the current time instead.
If the platform supports the tm_gmtoff and tm_zone, they are available as
attributes only.
localtime(...)
localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
tm_sec,tm_wday,tm_yday,tm_isdst)
Convert seconds since the Epoch to a time tuple expressing local time.
When 'seconds' is not passed in, convert the current time instead.
mktime(...)
mktime(tuple) -> floating-point number
Convert a time tuple in local time to seconds since the Epoch.
Note that mktime(gmtime(0)) will not generally return zero for most
time zones; instead the returned value will either be equal to that
of the timezone or altzone attributes on the time module.
monotonic(...)
monotonic() -> float
Monotonic clock, cannot go backward.
monotonic_ns(...)
monotonic_ns() -> int
Monotonic clock, cannot go backward, as nanoseconds.
perf_counter(...)
perf_counter() -> float
Performance counter for benchmarking.
perf_counter_ns(...)
perf_counter_ns() -> int
Performance counter for benchmarking as nanoseconds.
process_time(...)
process_time() -> float
Process time for profiling: sum of the kernel and user-space CPU time.
process_time_ns(...)
process_time() -> int
Process time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
sleep(...)
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating-point number for subsecond precision.
strftime(...)
strftime(format[, tuple]) -> string
Convert a time tuple to a string according to a format specification.
See the library reference manual for formatting codes. When the time tuple
is not present, current time as returned by localtime() is used.
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
strptime(...)
strptime(string, format) -> struct_time
Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as
strftime()).
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
thread_time(...)
thread_time() -> float
Thread time for profiling: sum of the kernel and user-space CPU time.
thread_time_ns(...)
thread_time() -> int
Thread time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
time(...)
time() -> floating-point number
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.
time_ns(...)
time_ns() -> int
Return the current time in nanoseconds since the Epoch.
DATA
altzone = -10800
daylight = 1
timezone = -7200
tzname = ('Egypt Standard Time', 'Egypt Daylight Time')
FILE
(built-in)
logging.traceback
Python Library Documentation: module traceback
NAME
traceback - Extract, format and print information about Python stack traces.
MODULE REFERENCE
https://docs.python.org/3.12/library/traceback.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.list(builtins.object)
StackSummary
builtins.object
FrameSummary
TracebackException
class FrameSummary(builtins.object)
| FrameSummary(filename, lineno, name, *, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None)
|
| Information about a single frame from a traceback.
|
| - :attr:`filename` The filename for the frame.
| - :attr:`lineno` The line within filename for the frame that was
| active when the frame was captured.
| - :attr:`name` The name of the function or method that was executing
| when the frame was captured.
| - :attr:`line` The text from the linecache module for the
| of code that was running when the frame was captured.
| - :attr:`locals` Either None if locals were not supplied, or a dict
| mapping the name to the repr() of the variable.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __getitem__(self, pos)
|
| __init__(self, filename, lineno, name, *, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None)
| Construct a FrameSummary.
|
| :param lookup_line: If True, `linecache` is consulted for the source
| code line. Otherwise, the line will be looked up when first needed.
| :param locals: If supplied the frame locals, which will be captured as
| object representations.
| :param line: If provided, use this instead of looking up the line in
| the linecache.
|
| __iter__(self)
|
| __len__(self)
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| line
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| colno
|
| end_colno
|
| end_lineno
|
| filename
|
| lineno
|
| locals
|
| name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
class StackSummary(builtins.list)
| StackSummary(iterable=(), /)
|
| A list of FrameSummary objects, representing a stack of frames.
|
| Method resolution order:
| StackSummary
| builtins.list
| builtins.object
|
| Methods defined here:
|
| format(self)
| Format the stack ready for printing.
|
| Returns a list of strings ready for printing. Each string in the
| resulting list corresponds to a single frame from the stack.
| Each string ends in a newline; the strings may contain internal
| newlines as well, for those items with source text lines.
|
| For long sequences of the same frame and line, the first few
| repetitions are shown, followed by a summary line stating the exact
| number of further repetitions.
|
| format_frame_summary(self, frame_summary)
| Format the lines for a single FrameSummary.
|
| Returns a string representing one frame involved in the stack. This
| gets called for every frame to be printed in the stack summary.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False)
| Create a StackSummary from a traceback or stack object.
|
| :param frame_gen: A generator that yields (frame, lineno) tuples
| whose summaries are to be included in the stack.
| :param limit: None to include all frames or the number of frames to
| include.
| :param lookup_lines: If True, lookup lines for each frame immediately,
| otherwise lookup is deferred until the frame is rendered.
| :param capture_locals: If True, the local variables from each frame will
| be captured as object representations into the FrameSummary.
|
| from_list(a_list)
| Create a StackSummary object from a supplied list of
| FrameSummary objects or old-style list of tuples.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.list:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __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, index, /)
| Return self[index].
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the list.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(self, /)
| Return the size of the list in memory, in bytes.
|
| append(self, object, /)
| Append object to the end of the list.
|
| clear(self, /)
| Remove all items from list.
|
| copy(self, /)
| Return a shallow copy of the list.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| extend(self, iterable, /)
| Extend list by appending elements from the iterable.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| insert(self, index, object, /)
| Insert object before index.
|
| pop(self, index=-1, /)
| Remove and return item at index (default last).
|
| Raises IndexError if list is empty or index is out of range.
|
| remove(self, value, /)
| Remove first occurrence of value.
|
| Raises ValueError if the value is not present.
|
| reverse(self, /)
| Reverse *IN PLACE*.
|
| sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
| order of two equal elements is maintained).
|
| If a key function is given, apply it once to each list item and sort them,
| ascending or descending, according to their function values.
|
| The reverse flag can be set to sort in descending order.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.list:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.list:
|
| __new__(*args, **kwargs) class method of builtins.list
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.list:
|
| __hash__ = None
class TracebackException(builtins.object)
| TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10, _seen=None)
|
| An exception ready for rendering.
|
| The traceback module captures enough attributes from the original exception
| to this intermediary form to ensure that no references are held, while
| still being able to fully print or format it.
|
| max_group_width and max_group_depth control the formatting of exception
| groups. The depth refers to the nesting level of the group, and the width
| refers to the size of a single exception group's exceptions array. The
| formatted output is truncated when either limit is exceeded.
|
| Use `from_exception` to create TracebackException instances from exception
| objects, or the constructor to create TracebackException instances from
| individual components.
|
| - :attr:`__cause__` A TracebackException of the original *__cause__*.
| - :attr:`__context__` A TracebackException of the original *__context__*.
| - :attr:`exceptions` For exception groups - a list of TracebackException
| instances for the nested *exceptions*. ``None`` for other exceptions.
| - :attr:`__suppress_context__` The *__suppress_context__* value from the
| original exception.
| - :attr:`stack` A `StackSummary` representing the traceback.
| - :attr:`exc_type` The class of the original traceback.
| - :attr:`filename` For syntax errors - the filename where the error
| occurred.
| - :attr:`lineno` For syntax errors - the linenumber where the error
| occurred.
| - :attr:`end_lineno` For syntax errors - the end linenumber where the error
| occurred. Can be `None` if not present.
| - :attr:`text` For syntax errors - the text where the error
| occurred.
| - :attr:`offset` For syntax errors - the offset into the text where the
| error occurred.
| - :attr:`end_offset` For syntax errors - the end offset into the text where
| the error occurred. Can be `None` if not present.
| - :attr:`msg` For syntax errors - the compiler error message.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10, _seen=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| format(self, *, chain=True, _ctx=None)
| Format the exception.
|
| If chain is not *True*, *__cause__* and *__context__* will not be formatted.
|
| The return value is a generator of strings, each ending in a newline and
| some containing internal newlines. `print_exception` is a wrapper around
| this method which just prints the lines to a file.
|
| The message indicating which exception occurred is always the last
| string in the output.
|
| format_exception_only(self)
| Format the exception part of the traceback.
|
| The return value is a generator of strings, each ending in a newline.
|
| Generator yields the exception message.
| For :exc:`SyntaxError` exceptions, it
| also yields (before the exception message)
| several lines that (when printed)
| display detailed information about where the syntax error occurred.
| Following the message, generator also yields
| all the exception's ``__notes__``.
|
| print(self, *, file=None, chain=True)
| Print the result of self.format(chain=chain) to 'file'.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_exception(exc, *args, **kwargs)
| Create a TracebackException from an exception.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
FUNCTIONS
clear_frames(tb)
Clear all references to local variables in the frames of a traceback.
extract_stack(f=None, limit=None)
Extract the raw traceback from the current stack frame.
The return value has the same format as for extract_tb(). The
optional 'f' and 'limit' arguments have the same meaning as for
print_stack(). Each item in the list is a quadruple (filename,
line number, function name, text), and the entries are in order
from oldest to newest stack frame.
extract_tb(tb, limit=None)
Return a StackSummary object representing a list of
pre-processed entries from traceback.
This is useful for alternate formatting of stack traces. If
'limit' is omitted or None, all entries are extracted. A
pre-processed stack trace entry is a FrameSummary object
containing attributes filename, lineno, name, and line
representing the information that is usually printed for a stack
trace. The line is a string with leading and trailing
whitespace stripped; if the source is not available it is None.
format_exc(limit=None, chain=True)
Like print_exc() but return a string.
format_exception(exc, /, value=<implicit>, tb=<implicit>, limit=None, chain=True)
Format a stack trace and the exception information.
The arguments have the same meaning as the corresponding arguments
to print_exception(). The return value is a list of strings, each
ending in a newline and some containing internal newlines. When
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
format_exception_only(exc, /, value=<implicit>)
Format the exception part of a traceback.
The return value is a list of strings, each ending in a newline.
The list contains the exception's message, which is
normally a single string; however, for :exc:`SyntaxError` exceptions, it
contains several lines that (when printed) display detailed information
about where the syntax error occurred. Following the message, the list
contains the exception's ``__notes__``.
format_list(extracted_list)
Format a list of tuples or FrameSummary objects for printing.
Given a list of tuples or FrameSummary objects as returned by
extract_tb() or extract_stack(), return a list of strings ready
for printing.
Each string in the resulting list corresponds to the item with the
same index in the argument list. Each string ends in a newline;
the strings may contain internal newlines as well, for those items
whose source text line is not None.
format_stack(f=None, limit=None)
Shorthand for 'format_list(extract_stack(f, limit))'.
format_tb(tb, limit=None)
A shorthand for 'format_list(extract_tb(tb, limit))'.
print_exc(limit=None, file=None, chain=True)
Shorthand for 'print_exception(sys.exception(), limit, file, chain)'.
print_exception(exc, /, value=<implicit>, tb=<implicit>, limit=None, file=None, chain=True)
Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
This differs from print_tb() in the following ways: (1) if
traceback is not None, it prints a header "Traceback (most recent
call last):"; (2) it prints the exception type and value after the
stack trace; (3) if type is SyntaxError and value has the
appropriate format, it prints the line where the syntax error
occurred with a caret on the next line indicating the approximate
position of the error.
print_last(limit=None, file=None, chain=True)
This is a shorthand for 'print_exception(sys.last_exc, limit, file, chain)'.
print_stack(f=None, limit=None, file=None)
Print a stack trace from its invocation point.
The optional 'f' argument can be used to specify an alternate
stack frame at which to start. The optional 'limit' and 'file'
arguments have the same meaning as for print_exception().
print_tb(tb, limit=None, file=None)
Print up to 'limit' stack trace entries from the traceback 'tb'.
If 'limit' is omitted or None, all entries are printed. If 'file'
is omitted or None, the output goes to sys.stderr; otherwise
'file' should be an open file or file-like object with a write()
method.
walk_stack(f)
Walk a stack yielding the frame and line number for each frame.
This will follow f.f_back from the given frame. If no frame is given, the
current stack is used. Usually used with StackSummary.extract.
walk_tb(tb)
Walk a traceback yielding the frame and line number for each frame.
This will follow tb.tb_next (and thus is in the opposite order to
walk_stack). Usually used with StackSummary.extract.
DATA
__all__ = ['extract_stack', 'extract_tb', 'format_exception', 'format_...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\traceback.py
logging.warn
Python Library Documentation: function warn in module logging warn(msg, *args, **kwargs)
logging.warning
Python Library Documentation: function warning in module logging
warning(msg, *args, **kwargs)
Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
logging.warnings
Python Library Documentation: module warnings
NAME
warnings - Python part of the warnings subsystem.
MODULE REFERENCE
https://docs.python.org/3.12/library/warnings.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.object
catch_warnings
class catch_warnings(builtins.object)
| catch_warnings(*, record=False, module=None, action=None, category=<class 'Warning'>, lineno=0, append=False)
|
| A context manager that copies and restores the warnings filter upon
| exiting the context.
|
| The 'record' argument specifies whether warnings should be captured by a
| custom implementation of warnings.showwarning() and be appended to a list
| returned by the context manager. Otherwise None is returned by the context
| manager. The objects appended to the list are arguments whose attributes
| mirror the arguments to showwarning().
|
| The 'module' argument is to specify an alternative module to the module
| named 'warnings' and imported under that name. This argument is only useful
| when testing the warnings module itself.
|
| If the 'action' argument is not None, the remaining arguments are passed
| to warnings.simplefilter() as if it were called immediately on entering the
| context.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *exc_info)
|
| __init__(self, *, record=False, module=None, action=None, category=<class 'Warning'>, lineno=0, append=False)
| Specify whether to record warnings and if an alternative module
| should be used other than sys.modules['warnings'].
|
| For compatibility with Python 3.0, please consider all arguments to be
| keyword-only.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
filterwarnings(action, message='', category=<class 'Warning'>, module='', lineno=0, append=False)
Insert an entry into the list of warnings filters (at the front).
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'message' -- a regex that the warning message must match
'category' -- a class that the warning must be a subclass of
'module' -- a regex that the module name must match
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
formatwarning(message, category, filename, lineno, line=None)
Function to format a warning the standard way.
resetwarnings()
Clear the list of warning filters, so that no filters are active.
showwarning(message, category, filename, lineno, file=None, line=None)
Hook to write a warning to a file; replace if you like.
simplefilter(action, category=<class 'Warning'>, lineno=0, append=False)
Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a class that the warning must be a subclass of
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
warn_explicit(...)
Issue a warning, or maybe ignore it or raise an exception.
DATA
__all__ = ['warn', 'warn_explicit', 'showwarning', 'formatwarning', 'f...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\warnings.py
logging.weakref
Python Library Documentation: module weakref
NAME
weakref - Weak reference support for Python.
MODULE REFERENCE
https://docs.python.org/3.12/library/weakref.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module is an implementation of PEP 205:
https://peps.python.org/pep-0205/
CLASSES
builtins.object
_weakrefset.WeakSet
CallableProxyType
ProxyType
ReferenceType
WeakMethod
finalize
collections.abc.MutableMapping(collections.abc.Mapping)
WeakKeyDictionary
WeakValueDictionary
class CallableProxyType(builtins.object)
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floordiv__(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, /)
| Return self+=value.
|
| __iand__(self, value, /)
| Return self&=value.
|
| __ifloordiv__(self, value, /)
| Return self//=value.
|
| __ilshift__(self, value, /)
| Return self<<=value.
|
| __imatmul__(self, value, /)
| Return self@=value.
|
| __imod__(self, value, /)
| Return self%=value.
|
| __imul__(self, value, /)
| Return self*=value.
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __ior__(self, value, /)
| Return self|=value.
|
| __ipow__(self, value, /)
| Return self**=value.
|
| __irshift__(self, value, /)
| Return self>>=value.
|
| __isub__(self, value, /)
| Return self-=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __itruediv__(self, value, /)
| Return self/=value.
|
| __ixor__(self, value, /)
| Return self^=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __matmul__(self, value, /)
| Return self@value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __next__(self, /)
| Implement next(self).
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmatmul__(self, value, /)
| Return value@self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __str__(self, /)
| Return str(self).
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __xor__(self, value, /)
| Return self^value.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
class ProxyType(builtins.object)
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __bytes__(...)
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floordiv__(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, /)
| Return self+=value.
|
| __iand__(self, value, /)
| Return self&=value.
|
| __ifloordiv__(self, value, /)
| Return self//=value.
|
| __ilshift__(self, value, /)
| Return self<<=value.
|
| __imatmul__(self, value, /)
| Return self@=value.
|
| __imod__(self, value, /)
| Return self%=value.
|
| __imul__(self, value, /)
| Return self*=value.
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __ior__(self, value, /)
| Return self|=value.
|
| __ipow__(self, value, /)
| Return self**=value.
|
| __irshift__(self, value, /)
| Return self>>=value.
|
| __isub__(self, value, /)
| Return self-=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __itruediv__(self, value, /)
| Return self/=value.
|
| __ixor__(self, value, /)
| Return self^=value.
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __matmul__(self, value, /)
| Return self@value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __next__(self, /)
| Implement next(self).
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmatmul__(self, value, /)
| Return value@self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __str__(self, /)
| Return str(self).
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __xor__(self, value, /)
| Return self^value.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
class ReferenceType(builtins.object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __callback__
class WeakKeyDictionary(collections.abc.MutableMapping)
| WeakKeyDictionary(dict=None)
|
| Mapping class that references keys weakly.
|
| Entries in the dictionary will be discarded when there is no
| longer a strong reference to the key. This can be used to
| associate additional data with an object owned by other parts of
| an application without adding attributes to those objects. This
| can be especially useful with objects that override attribute
| accesses.
|
| Method resolution order:
| WeakKeyDictionary
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __contains__(self, key)
|
| __copy__ = copy(self)
|
| __deepcopy__(self, memo)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, dict=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other)
|
| __iter__ = keys(self)
|
| __len__(self)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, value)
|
| copy(self)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| keyrefs(self)
| Return a list of weak references to the keys.
|
| The references are not guaranteed to be 'live' at the time
| they are used, so the result of calling the references needs
| to be checked before being used. This can be used to avoid
| creating references that will cause the garbage collector to
| keep the keys around longer than needed.
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(self, key, *args)
| D.pop(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)
| D.popitem() -> (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)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, dict=None, /, **kwargs)
| D.update([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 F.items(): D[k] = v
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class WeakMethod(ReferenceType)
| WeakMethod(meth, callback=None)
|
| A custom `weakref.ref` subclass which simulates a weak reference to
| a bound method, working around the lifetime problem of bound methods.
|
| Method resolution order:
| WeakMethod
| ReferenceType
| builtins.object
|
| Methods defined here:
|
| __call__(self)
| Call self as a function.
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self, /) from ReferenceType
| Return hash(self).
|
| __ne__(self, other)
| Return self!=value.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, meth, callback=None)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from ReferenceType:
|
| __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.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Class methods inherited from ReferenceType:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ReferenceType:
|
| __callback__
class WeakSet(builtins.object)
| WeakSet(data=None)
|
| Methods defined here:
|
| __and__ = intersection(self, other)
|
| __contains__(self, item)
|
| __eq__(self, other)
| Return self==value.
|
| __ge__ = issuperset(self, other)
|
| __gt__(self, other)
| Return self>value.
|
| __iand__(self, other)
|
| __init__(self, data=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other)
|
| __isub__(self, other)
|
| __iter__(self)
|
| __ixor__(self, other)
|
| __le__ = issubset(self, other)
|
| __len__(self)
|
| __lt__(self, other)
| Return self<value.
|
| __or__ = union(self, other)
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| __sub__ = difference(self, other)
|
| __xor__ = symmetric_difference(self, other)
|
| add(self, item)
|
| clear(self)
|
| copy(self)
|
| difference(self, other)
|
| difference_update(self, other)
|
| discard(self, item)
|
| intersection(self, other)
|
| intersection_update(self, other)
|
| isdisjoint(self, other)
|
| issubset(self, other)
|
| issuperset(self, other)
|
| pop(self)
|
| remove(self, item)
|
| symmetric_difference(self, other)
|
| symmetric_difference_update(self, other)
|
| union(self, other)
|
| update(self, other)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
class WeakValueDictionary(collections.abc.MutableMapping)
| WeakValueDictionary(other=(), /, **kw)
|
| Mapping class that references values weakly.
|
| Entries in the dictionary will be discarded when no strong
| reference to the value exists anymore
|
| Method resolution order:
| WeakValueDictionary
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __contains__(self, key)
|
| __copy__ = copy(self)
|
| __deepcopy__(self, memo)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, other=(), /, **kw)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other)
|
| __iter__ = keys(self)
|
| __len__(self)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, value)
|
| copy(self)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| itervaluerefs(self)
| Return an iterator that yields the weak references to the values.
|
| The references are not guaranteed to be 'live' at the time
| they are used, so the result of calling the references needs
| to be checked before being used. This can be used to avoid
| creating references that will cause the garbage collector to
| keep the values around longer than needed.
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(self, key, *args)
| D.pop(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)
| D.popitem() -> (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)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, other=None, /, **kwargs)
| D.update([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 F.items(): D[k] = v
|
| valuerefs(self)
| Return a list of weak references to the values.
|
| The references are not guaranteed to be 'live' at the time
| they are used, so the result of calling the references needs
| to be checked before being used. This can be used to avoid
| creating references that will cause the garbage collector to
| keep the values around longer than needed.
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__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 collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
class finalize(builtins.object)
| finalize(obj, func, /, *args, **kwargs)
|
| Class for finalization of weakrefable objects
|
| finalize(obj, func, *args, **kwargs) returns a callable finalizer
| object which will be called when obj is garbage collected. The
| first time the finalizer is called it evaluates func(*arg, **kwargs)
| and returns the result. After this the finalizer is dead, and
| calling it just returns None.
|
| When the program exits any remaining finalizers for which the
| atexit attribute is true will be run in reverse order of creation.
| By default atexit is true.
|
| Methods defined here:
|
| __call__(self, _=None)
| If alive then mark as dead and return func(*args, **kwargs);
| otherwise return None
|
| __init__(self, obj, func, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| detach(self)
| If alive then mark as dead and return (obj, func, args, kwargs);
| otherwise return None
|
| peek(self)
| If alive then return (obj, func, args, kwargs);
| otherwise return None
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| alive
| Whether finalizer is alive
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| atexit
| Whether finalizer should be called at exit
ref = class ReferenceType(builtins.object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __callback__
FUNCTIONS
getweakrefcount(object, /)
Return the number of weak references to 'object'.
getweakrefs(object, /)
Return a list of all weak reference objects pointing to 'object'.
proxy(object, callback=None, /)
Create a proxy object that weakly references 'object'.
'callback', if given, is called with a reference to the
proxy when 'object' is about to be finalized.
DATA
ProxyTypes = (<class 'weakref.ProxyType'>, <class 'weakref.CallablePro...
__all__ = ['ref', 'proxy', 'getweakrefcount', 'getweakrefs', 'WeakKeyD...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\weakref.py
logging.handlers.BaseRotatingHandler
Python Library Documentation: class BaseRotatingHandler in module logging.handlers class BaseRotatingHandler(logging.FileHandler) | BaseRotatingHandler(filename, mode, encoding=None, delay=False, errors=None) | | Base class for handlers that rotate log files at a certain point. | Not meant to be instantiated directly. Instead, use RotatingFileHandler | or TimedRotatingFileHandler. | | Method resolution order: | BaseRotatingHandler | logging.FileHandler | logging.StreamHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, filename, mode, encoding=None, delay=False, errors=None) | Use the specified filename for streamed logging | | emit(self, record) | Emit a record. | | Output the record to the file, catering for rollover as described | in doRollover(). | | rotate(self, source, dest) | When rotating, rotate the current log. | | The default implementation calls the 'rotator' attribute of the | handler, if it's callable, passing the source and dest arguments to | it. If the attribute isn't callable (the default is None), the source | is simply renamed to the destination. | | :param source: The source filename. This is normally the base | filename, e.g. 'test.log' | :param dest: The destination filename. This is normally | what the source is rotated to, e.g. 'test.log.1'. | | rotation_filename(self, default_name) | Modify the filename of a log file when rotating. | | This is provided so that a custom filename can be provided. | | The default implementation calls the 'namer' attribute of the | handler, if it's callable, passing the default name to | it. If the attribute isn't callable (the default is None), the name | is returned unchanged. | | :param default_name: The default name for the log file. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | namer = None | | rotator = None | | ---------------------------------------------------------------------- | Methods inherited from logging.FileHandler: | | __repr__(self) | Return repr(self). | | close(self) | Closes the stream. | | ---------------------------------------------------------------------- | Methods inherited from logging.StreamHandler: | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from logging.StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from logging.StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.BufferingHandler
Python Library Documentation: class BufferingHandler in module logging.handlers class BufferingHandler(logging.Handler) | BufferingHandler(capacity) | | A handler class which buffers logging records in memory. Whenever each | record is added to the buffer, a check is made to see if the buffer should | be flushed. If it should, then flush() is expected to do what's needed. | | Method resolution order: | BufferingHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, capacity) | Initialize the handler with the buffer size. | | close(self) | Close the handler. | | This version just flushes and chains to the parent class' close(). | | emit(self, record) | Emit a record. | | Append the record. If shouldFlush() tells us to, call flush() to process | the buffer. | | flush(self) | Override to implement custom flushing behaviour. | | This version just zaps the buffer to empty. | | shouldFlush(self, record) | Should the handler flush its buffer? | | Returns true if the buffer is up to capacity. This method can be | overridden to implement custom flushing strategies. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.DEFAULT_HTTP_LOGGING_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.DEFAULT_SOAP_LOGGING_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.DEFAULT_TCP_LOGGING_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.DEFAULT_UDP_LOGGING_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.DatagramHandler
Python Library Documentation: class DatagramHandler in module logging.handlers class DatagramHandler(SocketHandler) | DatagramHandler(host, port) | | A handler class which writes logging records, in pickle format, to | a datagram socket. The pickle which is sent is that of the LogRecord's | attribute dictionary (__dict__), so that the receiver does not need to | have the logging module installed in order to process the logging event. | | To unpickle the record at the receiving end into a LogRecord, use the | makeLogRecord function. | | Method resolution order: | DatagramHandler | SocketHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, host, port) | Initializes the handler with a specific host address and port. | | makeSocket(self) | The factory method of SocketHandler is here overridden to create | a UDP socket (SOCK_DGRAM). | | send(self, s) | Send a pickled string to a socket. | | This function no longer allows for partial sends which can happen | when the network is busy - UDP does not guarantee delivery and | can deliver packets out of sequence. | | ---------------------------------------------------------------------- | Methods inherited from SocketHandler: | | close(self) | Closes the socket. | | createSocket(self) | Try to create a socket, using an exponential backoff with | a max retry time. Thanks to Robert Olson for the original patch | (SF #815911) which has been slightly refactored. | | emit(self, record) | Emit a record. | | Pickles the record and writes it to the socket in binary format. | If there is an error with the socket, silently drop the packet. | If there was a problem with the socket, re-establishes the | socket. | | handleError(self, record) | Handle an error during logging. | | An error has occurred during logging. Most likely cause - | connection lost. Close the socket so that we can retry on the | next event. | | makePickle(self, record) | Pickles the record in binary format with a length prefix, and | returns it ready for transmission across the socket. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.HTTPHandler
Python Library Documentation: class HTTPHandler in module logging.handlers
class HTTPHandler(logging.Handler)
| HTTPHandler(host, url, method='GET', secure=False, credentials=None, context=None)
|
| A class which sends records to a web server, using either GET or
| POST semantics.
|
| Method resolution order:
| HTTPHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, host, url, method='GET', secure=False, credentials=None, context=None)
| Initialize the instance with the host, the request URL, and the method
| ("GET" or "POST")
|
| emit(self, record)
| Emit a record.
|
| Send the record to the web server as a percent-encoded dictionary
|
| getConnection(self, host, secure)
| get a HTTP[S]Connection.
|
| Override when a custom connection is required, for example if
| there is a proxy.
|
| mapLogRecord(self, record)
| Default implementation of mapping the log record into a dict
| that is sent as the CGI data. Overwrite in your class.
| Contributed by Franz Glasner.
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
logging.handlers.MemoryHandler
Python Library Documentation: class MemoryHandler in module logging.handlers class MemoryHandler(BufferingHandler) | MemoryHandler(capacity, flushLevel=40, target=None, flushOnClose=True) | | A handler class which buffers logging records in memory, periodically | flushing them to a target handler. Flushing occurs whenever the buffer | is full, or when an event of a certain severity or greater is seen. | | Method resolution order: | MemoryHandler | BufferingHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, capacity, flushLevel=40, target=None, flushOnClose=True) | Initialize the handler with the buffer size, the level at which | flushing should occur and an optional target. | | Note that without a target being set either here or via setTarget(), | a MemoryHandler is no use to anyone! | | The ``flushOnClose`` argument is ``True`` for backward compatibility | reasons - the old behaviour is that when the handler is closed, the | buffer is flushed, even if the flush level hasn't been exceeded nor the | capacity exceeded. To prevent this, set ``flushOnClose`` to ``False``. | | close(self) | Flush, if appropriately configured, set the target to None and lose the | buffer. | | flush(self) | For a MemoryHandler, flushing means just sending the buffered | records to the target, if there is one. Override if you want | different behaviour. | | The record buffer is only cleared if a target has been set. | | setTarget(self, target) | Set the target handler for this handler. | | shouldFlush(self, record) | Check for buffer full or a record at the flushLevel or higher. | | ---------------------------------------------------------------------- | Methods inherited from BufferingHandler: | | emit(self, record) | Emit a record. | | Append the record. If shouldFlush() tells us to, call flush() to process | the buffer. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.NTEventLogHandler
Python Library Documentation: class NTEventLogHandler in module logging.handlers class NTEventLogHandler(logging.Handler) | NTEventLogHandler(appname, dllname=None, logtype='Application') | | A handler class which sends events to the NT Event Log. Adds a | registry entry for the specified application name. If no dllname is | provided, win32service.pyd (which contains some basic message | placeholders) is used. Note that use of these placeholders will make | your event logs big, as the entire message source is held in the log. | If you want slimmer logs, you have to pass in the name of your own DLL | which contains the message definitions you want to use in the event log. | | Method resolution order: | NTEventLogHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, appname, dllname=None, logtype='Application') | Initializes the instance - basically setting the formatter to None | and the filter list to empty. | | close(self) | Clean up this handler. | | You can remove the application name from the registry as a | source of event log entries. However, if you do this, you will | not be able to see the events as you intended in the Event Log | Viewer - it needs to be able to access the registry to get the | DLL name. | | emit(self, record) | Emit a record. | | Determine the message ID, event category and event type. Then | log the message in the NT event log. | | getEventCategory(self, record) | Return the event category for the record. | | Override this if you want to specify your own categories. This version | returns 0. | | getEventType(self, record) | Return the event type for the record. | | Override this if you want to specify your own types. This version does | a mapping using the handler's typemap attribute, which is set up in | __init__() to a dictionary which contains mappings for DEBUG, INFO, | WARNING, ERROR and CRITICAL. If you are using your own levels you will | either need to override this method or place a suitable dictionary in | the handler's typemap attribute. | | getMessageID(self, record) | Return the message ID for the event record. If you are using your | own messages, you could do this by having the msg passed to the | logger being an ID rather than a formatting string. Then, in here, | you could use a dictionary lookup to get the message ID. This | version returns 1, which is the base message ID in win32service.pyd. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.QueueHandler
Python Library Documentation: class QueueHandler in module logging.handlers class QueueHandler(logging.Handler) | QueueHandler(queue) | | This handler sends events to a queue. Typically, it would be used together | with a multiprocessing Queue to centralise logging to file in one process | (in a multi-process application), so as to avoid file write contention | between processes. | | This code is new in Python 3.2, but this class can be copy pasted into | user code for use with earlier Python versions. | | Method resolution order: | QueueHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, queue) | Initialise an instance, using the passed queue. | | emit(self, record) | Emit a record. | | Writes the LogRecord to the queue, preparing it for pickling first. | | enqueue(self, record) | Enqueue a record. | | The base implementation uses put_nowait. You may want to override | this method if you want to use blocking, timeouts or custom queue | implementations. | | prepare(self, record) | Prepare a record for queuing. The object returned by this method is | enqueued. | | The base implementation formats the record to merge the message and | arguments, and removes unpickleable items from the record in-place. | Specifically, it overwrites the record's `msg` and | `message` attributes with the merged message (obtained by | calling the handler's `format` method), and sets the `args`, | `exc_info` and `exc_text` attributes to None. | | You might want to override this method if you want to convert | the record to a dict or JSON string, or send a modified copy | of the record while leaving the original intact. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.QueueListener
Python Library Documentation: class QueueListener in module logging.handlers class QueueListener(builtins.object) | QueueListener(queue, *handlers, respect_handler_level=False) | | This class implements an internal threaded listener which watches for | LogRecords being added to a queue, removes them and passes them to a | list of handlers for processing. | | Methods defined here: | | __init__(self, queue, *handlers, respect_handler_level=False) | Initialise an instance with the specified queue and | handlers. | | dequeue(self, block) | Dequeue a record and return it, optionally blocking. | | The base implementation uses get. You may want to override this method | if you want to use timeouts or work with custom queue implementations. | | enqueue_sentinel(self) | This is used to enqueue the sentinel record. | | The base implementation uses put_nowait. You may want to override this | method if you want to use timeouts or work with custom queue | implementations. | | handle(self, record) | Handle a record. | | This just loops through the handlers offering them the record | to handle. | | prepare(self, record) | Prepare a record for handling. | | This method just returns the passed-in record. You may want to | override this method if you need to do any custom marshalling or | manipulation of the record before passing it to the handlers. | | start(self) | Start the listener. | | This starts up a background thread to monitor the queue for | LogRecords to process. | | stop(self) | Stop the listener. | | This asks the thread to terminate, and then waits for it to do so. | Note that if you don't call this before your application exits, there | may be some records still left on the queue, which won't be processed. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.RotatingFileHandler
Python Library Documentation: class RotatingFileHandler in module logging.handlers class RotatingFileHandler(BaseRotatingHandler) | RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None) | | Handler for logging to a set of files, which switches from one file | to the next when the current file reaches a certain size. | | Method resolution order: | RotatingFileHandler | BaseRotatingHandler | logging.FileHandler | logging.StreamHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False, errors=None) | Open the specified file and use it as the stream for logging. | | By default, the file grows indefinitely. You can specify particular | values of maxBytes and backupCount to allow the file to rollover at | a predetermined size. | | Rollover occurs whenever the current log file is nearly maxBytes in | length. If backupCount is >= 1, the system will successively create | new files with the same pathname as the base file, but with extensions | ".1", ".2" etc. appended to it. For example, with a backupCount of 5 | and a base file name of "app.log", you would get "app.log", | "app.log.1", "app.log.2", ... through to "app.log.5". The file being | written to is always "app.log" - when it gets filled up, it is closed | and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc. | exist, then they are renamed to "app.log.2", "app.log.3" etc. | respectively. | | If maxBytes is zero, rollover never occurs. | | doRollover(self) | Do a rollover, as described in __init__(). | | shouldRollover(self, record) | Determine if rollover should occur. | | Basically, see if the supplied record would cause the file to exceed | the size limit we have. | | ---------------------------------------------------------------------- | Methods inherited from BaseRotatingHandler: | | emit(self, record) | Emit a record. | | Output the record to the file, catering for rollover as described | in doRollover(). | | rotate(self, source, dest) | When rotating, rotate the current log. | | The default implementation calls the 'rotator' attribute of the | handler, if it's callable, passing the source and dest arguments to | it. If the attribute isn't callable (the default is None), the source | is simply renamed to the destination. | | :param source: The source filename. This is normally the base | filename, e.g. 'test.log' | :param dest: The destination filename. This is normally | what the source is rotated to, e.g. 'test.log.1'. | | rotation_filename(self, default_name) | Modify the filename of a log file when rotating. | | This is provided so that a custom filename can be provided. | | The default implementation calls the 'namer' attribute of the | handler, if it's callable, passing the default name to | it. If the attribute isn't callable (the default is None), the name | is returned unchanged. | | :param default_name: The default name for the log file. | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseRotatingHandler: | | namer = None | | rotator = None | | ---------------------------------------------------------------------- | Methods inherited from logging.FileHandler: | | __repr__(self) | Return repr(self). | | close(self) | Closes the stream. | | ---------------------------------------------------------------------- | Methods inherited from logging.StreamHandler: | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from logging.StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from logging.StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.SMTPHandler
Python Library Documentation: class SMTPHandler in module logging.handlers class SMTPHandler(logging.Handler) | SMTPHandler(mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=5.0) | | A handler class which sends an SMTP email for each logging event. | | Method resolution order: | SMTPHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=5.0) | Initialize the handler. | | Initialize the instance with the from and to addresses and subject | line of the email. To specify a non-standard SMTP port, use the | (host, port) tuple format for the mailhost argument. To specify | authentication credentials, supply a (username, password) tuple | for the credentials argument. To specify the use of a secure | protocol (TLS), pass in a tuple for the secure argument. This will | only be used when authentication credentials are supplied. The tuple | will be either an empty tuple, or a single-value tuple with the name | of a keyfile, or a 2-value tuple with the names of the keyfile and | certificate file. (This tuple is passed to the `starttls` method). | A timeout in seconds can be specified for the SMTP connection (the | default is one second). | | emit(self, record) | Emit a record. | | Format the record and send it to the specified addressees. | | getSubject(self, record) | Determine the subject for the email. | | If you want to specify a subject line which is record-dependent, | override this method. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.ST_DEV
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.ST_INO
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.ST_MTIME
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.SYSLOG_TCP_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.SYSLOG_UDP_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.handlers.SocketHandler
Python Library Documentation: class SocketHandler in module logging.handlers class SocketHandler(logging.Handler) | SocketHandler(host, port) | | A handler class which writes logging records, in pickle format, to | a streaming socket. The socket is kept open across logging calls. | If the peer resets it, an attempt is made to reconnect on the next call. | The pickle which is sent is that of the LogRecord's attribute dictionary | (__dict__), so that the receiver does not need to have the logging module | installed in order to process the logging event. | | To unpickle the record at the receiving end into a LogRecord, use the | makeLogRecord function. | | Method resolution order: | SocketHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, host, port) | Initializes the handler with a specific host address and port. | | When the attribute *closeOnError* is set to True - if a socket error | occurs, the socket is silently closed and then reopened on the next | logging call. | | close(self) | Closes the socket. | | createSocket(self) | Try to create a socket, using an exponential backoff with | a max retry time. Thanks to Robert Olson for the original patch | (SF #815911) which has been slightly refactored. | | emit(self, record) | Emit a record. | | Pickles the record and writes it to the socket in binary format. | If there is an error with the socket, silently drop the packet. | If there was a problem with the socket, re-establishes the | socket. | | handleError(self, record) | Handle an error during logging. | | An error has occurred during logging. Most likely cause - | connection lost. Close the socket so that we can retry on the | next event. | | makePickle(self, record) | Pickles the record in binary format with a length prefix, and | returns it ready for transmission across the socket. | | makeSocket(self, timeout=1) | A factory method which allows subclasses to define the precise | type of socket they want. | | send(self, s) | Send a pickled string to the socket. | | This function allows for partial sends which can happen when the | network is busy. | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.SysLogHandler
Python Library Documentation: class SysLogHandler in module logging.handlers
class SysLogHandler(logging.Handler)
| SysLogHandler(address=('localhost', 514), facility=1, socktype=None)
|
| A handler class which sends formatted logging records to a syslog
| server. Based on Sam Rushing's syslog module:
| http://www.nightmare.com/squirl/python-ext/misc/syslog.py
| Contributed by Nicolas Untz (after which minor refactoring changes
| have been made).
|
| Method resolution order:
| SysLogHandler
| logging.Handler
| logging.Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, address=('localhost', 514), facility=1, socktype=None)
| Initialize a handler.
|
| If address is specified as a string, a UNIX socket is used. To log to a
| local syslogd, "SysLogHandler(address="/dev/log")" can be used.
| If facility is not specified, LOG_USER is used. If socktype is
| specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific
| socket type will be used. For Unix sockets, you can also specify a
| socktype of None, in which case socket.SOCK_DGRAM will be used, falling
| back to socket.SOCK_STREAM.
|
| close(self)
| Closes the socket.
|
| createSocket(self)
| Try to create a socket and, if it's not a datagram socket, connect it
| to the other end. This method is called during handler initialization,
| but it's not regarded as an error if the other end isn't listening yet
| --- the method will be called again when emitting an event,
| if there is no socket at that point.
|
| emit(self, record)
| Emit a record.
|
| The record is formatted, and then sent to the syslog server. If
| exception information is present, it is NOT sent to the server.
|
| encodePriority(self, facility, priority)
| Encode the facility and priority. You can pass in strings or
| integers - if strings are passed, the facility_names and
| priority_names mapping dictionaries are used to convert them to
| integers.
|
| mapPriority(self, levelName)
| Map a logging level name to a key in the priority_names map.
| This is useful in two scenarios: when custom levels are being
| used, and in the case where you can't do a straightforward
| mapping by lowercasing the logging level name because of locale-
| specific issues (see SF #1524081).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| LOG_ALERT = 1
|
| LOG_AUTH = 4
|
| LOG_AUTHPRIV = 10
|
| LOG_CONSOLE = 14
|
| LOG_CRIT = 2
|
| LOG_CRON = 9
|
| LOG_DAEMON = 3
|
| LOG_DEBUG = 7
|
| LOG_EMERG = 0
|
| LOG_ERR = 3
|
| LOG_FTP = 11
|
| LOG_INFO = 6
|
| LOG_KERN = 0
|
| LOG_LOCAL0 = 16
|
| LOG_LOCAL1 = 17
|
| LOG_LOCAL2 = 18
|
| LOG_LOCAL3 = 19
|
| LOG_LOCAL4 = 20
|
| LOG_LOCAL5 = 21
|
| LOG_LOCAL6 = 22
|
| LOG_LOCAL7 = 23
|
| LOG_LPR = 6
|
| LOG_MAIL = 2
|
| LOG_NEWS = 7
|
| LOG_NOTICE = 5
|
| LOG_NTP = 12
|
| LOG_SECURITY = 13
|
| LOG_SOLCRON = 15
|
| LOG_SYSLOG = 5
|
| LOG_USER = 1
|
| LOG_UUCP = 8
|
| LOG_WARNING = 4
|
| append_nul = True
|
| facility_names = {'auth': 4, 'authpriv': 10, 'console': 14, 'cron': 9,...
|
| ident = ''
|
| priority_map = {'CRITICAL': 'critical', 'DEBUG': 'debug', 'ERROR': 'er...
|
| priority_names = {'alert': 1, 'crit': 2, 'critical': 2, 'debug': 7, 'e...
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Handler:
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from logging.Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from logging.Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
logging.handlers.TimedRotatingFileHandler
Python Library Documentation: class TimedRotatingFileHandler in module logging.handlers class TimedRotatingFileHandler(BaseRotatingHandler) | TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None, errors=None) | | Handler for logging to a file, rotating the log file at certain timed | intervals. | | If backupCount is > 0, when rollover is done, no more than backupCount | files are kept - the oldest ones are deleted. | | Method resolution order: | TimedRotatingFileHandler | BaseRotatingHandler | logging.FileHandler | logging.StreamHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None, errors=None) | Use the specified filename for streamed logging | | computeRollover(self, currentTime) | Work out the rollover time based on the specified time. | | doRollover(self) | do a rollover; in this case, a date/time stamp is appended to the filename | when the rollover happens. However, you want the file to be named for the | start of the interval, not the current time. If there is a backup count, | then we have to get a list of matching filenames, sort them and remove | the one with the oldest suffix. | | getFilesToDelete(self) | Determine the files to delete when rolling over. | | More specific than the earlier method, which just used glob.glob(). | | shouldRollover(self, record) | Determine if rollover should occur. | | record is not used, as we are just comparing times, but it is needed so | the method signatures are the same | | ---------------------------------------------------------------------- | Methods inherited from BaseRotatingHandler: | | emit(self, record) | Emit a record. | | Output the record to the file, catering for rollover as described | in doRollover(). | | rotate(self, source, dest) | When rotating, rotate the current log. | | The default implementation calls the 'rotator' attribute of the | handler, if it's callable, passing the source and dest arguments to | it. If the attribute isn't callable (the default is None), the source | is simply renamed to the destination. | | :param source: The source filename. This is normally the base | filename, e.g. 'test.log' | :param dest: The destination filename. This is normally | what the source is rotated to, e.g. 'test.log.1'. | | rotation_filename(self, default_name) | Modify the filename of a log file when rotating. | | This is provided so that a custom filename can be provided. | | The default implementation calls the 'namer' attribute of the | handler, if it's callable, passing the default name to | it. If the attribute isn't callable (the default is None), the name | is returned unchanged. | | :param default_name: The default name for the log file. | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseRotatingHandler: | | namer = None | | rotator = None | | ---------------------------------------------------------------------- | Methods inherited from logging.FileHandler: | | __repr__(self) | Return repr(self). | | close(self) | Closes the stream. | | ---------------------------------------------------------------------- | Methods inherited from logging.StreamHandler: | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from logging.StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from logging.StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.WatchedFileHandler
Python Library Documentation: class WatchedFileHandler in module logging.handlers class WatchedFileHandler(logging.FileHandler) | WatchedFileHandler(filename, mode='a', encoding=None, delay=False, errors=None) | | A handler for logging to a file, which watches the file | to see if it has changed while in use. This can happen because of | usage of programs such as newsyslog and logrotate which perform | log file rotation. This handler, intended for use under Unix, | watches the file to see if it has changed since the last emit. | (A file has changed if its device or inode have changed.) | If it has changed, the old file stream is closed, and the file | opened to get a new stream. | | This handler is not appropriate for use under Windows, because | under Windows open files cannot be moved or renamed - logging | opens the files with exclusive locks - and so there is no need | for such a handler. Furthermore, ST_INO is not supported under | Windows; stat always returns zero for this value. | | This handler is based on a suggestion and patch by Chad J. | Schroeder. | | Method resolution order: | WatchedFileHandler | logging.FileHandler | logging.StreamHandler | logging.Handler | logging.Filterer | builtins.object | | Methods defined here: | | __init__(self, filename, mode='a', encoding=None, delay=False, errors=None) | Open the specified file and use it as the stream for logging. | | emit(self, record) | Emit a record. | | If underlying file has changed, reopen the file before emitting the | record to it. | | reopenIfNeeded(self) | Reopen log file if needed. | | Checks if the underlying file has changed, and if it | has, close the old stream and reopen the file to get the | current stream. | | ---------------------------------------------------------------------- | Methods inherited from logging.FileHandler: | | __repr__(self) | Return repr(self). | | close(self) | Closes the stream. | | ---------------------------------------------------------------------- | Methods inherited from logging.StreamHandler: | | flush(self) | Flushes the stream. | | setStream(self, stream) | Sets the StreamHandler's stream to the specified value, | if it is different. | | Returns the old stream, if the stream was changed, or None | if it wasn't. | | ---------------------------------------------------------------------- | Class methods inherited from logging.StreamHandler: | | __class_getitem__ = GenericAlias(...) | Represent a PEP 585 generic type | | E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,). | | ---------------------------------------------------------------------- | Data and other attributes inherited from logging.StreamHandler: | | terminator = '\n' | | ---------------------------------------------------------------------- | Methods inherited from logging.Handler: | | acquire(self) | Acquire the I/O thread lock. | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handle(self, record) | Conditionally emit the specified logging record. | | Emission depends on filters which may have been added to the handler. | Wrap the actual emission of the record with acquisition/release of | the I/O thread lock. | | Returns an instance of the log record that was emitted | if it passed all filters, otherwise a false value is returned. | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from logging.Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from logging.Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.handlers.copy
Python Library Documentation: module copy
NAME
copy - Generic (shallow and deep) copying operations.
MODULE REFERENCE
https://docs.python.org/3.12/library/copy.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Interface summary:
import copy
x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y
For module specific errors, copy.Error is raised.
The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).
- A shallow copy constructs a new compound object and then (to the
extent possible) inserts *the same objects* into it that the
original contains.
- A deep copy constructs a new compound object and then, recursively,
inserts *copies* into it of the objects found in the original.
Two problems often exist with deep copy operations that don't exist
with shallow copy operations:
a) recursive objects (compound objects that, directly or indirectly,
contain a reference to themselves) may cause a recursive loop
b) because deep copy copies *everything* it may copy too much, e.g.
administrative data structures that should be shared even between
copies
Python's deep copy operation avoids these problems by:
a) keeping a table of objects already copied during the current
copying pass
b) letting user-defined classes override the copying operation or the
set of components copied
This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor any
similar types.
Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called __getinitargs__(),
__getstate__() and __setstate__(). See the documentation for module
"pickle" for information on these methods.
CLASSES
builtins.Exception(builtins.BaseException)
Error
class Error(builtins.Exception)
| Method resolution order:
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
copy(x)
Shallow copy operation on arbitrary Python objects.
See the module's __doc__ string for more info.
deepcopy(x, memo=None, _nil=[])
Deep copy operation on arbitrary Python objects.
See the module's __doc__ string for more info.
DATA
__all__ = ['Error', 'copy', 'deepcopy']
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\copy.py
logging.handlers.io
Python Library Documentation: module io
NAME
io
MODULE REFERENCE
https://docs.python.org/3.12/library/io.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.
BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.
data:
DEFAULT_BUFFER_SIZE
An int containing the default buffer size used by the module's buffered
I/O classes. open() uses the file's blksize (as obtained by os.stat) if
possible.
CLASSES
_io._BufferedIOBase(_io._IOBase)
_io.BufferedRWPair
_io.BufferedRandom
_io.BufferedReader
_io.BufferedWriter
_io.BytesIO
BufferedIOBase(_io._BufferedIOBase, IOBase)
_io._IOBase(builtins.object)
IOBase
BufferedIOBase(_io._BufferedIOBase, IOBase)
RawIOBase(_io._RawIOBase, IOBase)
TextIOBase(_io._TextIOBase, IOBase)
_io._RawIOBase(_io._IOBase)
_io.FileIO
RawIOBase(_io._RawIOBase, IOBase)
_io._TextIOBase(_io._IOBase)
_io.StringIO
_io.TextIOWrapper
TextIOBase(_io._TextIOBase, IOBase)
builtins.OSError(builtins.Exception)
builtins.BlockingIOError
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.ValueError(builtins.Exception)
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.object
_io.IncrementalNewlineDecoder
class BlockingIOError(OSError)
| I/O operation would block.
|
| Method resolution order:
| BlockingIOError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class BufferedIOBase(_io._BufferedIOBase, IOBase)
| Base class for buffered IO objects.
|
| The main difference with RawIOBase is that the read() method
| supports omitting the size argument, and does not have a default
| implementation that defers to readinto().
|
| In addition, read(), readinto() and write() may raise
| BlockingIOError if the underlying raw stream is in non-blocking
| mode and not ready; unlike their raw counterparts, they will never
| return None.
|
| A typical implementation should not inherit from a RawIOBase
| implementation, but wrap one.
|
| Method resolution order:
| BufferedIOBase
| _io._BufferedIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class BufferedRWPair(_BufferedIOBase)
| BufferedRWPair(reader, writer, buffer_size=8192, /)
|
| A buffered reader and writer object together.
|
| A buffered reader object and buffered writer object put together to
| form a sequential IO object that can read and write. This is typically
| used with a socket or two-way pipe.
|
| reader and writer are RawIOBase objects that are readable and
| writeable respectively. If the buffer_size is omitted it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRWPair
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(...)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| flush(...)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(...)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(...)
|
| read(...)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(...)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(...)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(...)
|
| readinto1(...)
|
| writable(...)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(...)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedRandom(_BufferedIOBase)
| BufferedRandom(raw, buffer_size=8192)
|
| A buffered interface to random access streams.
|
| The constructor creates a reader and writer for a seekable stream,
| raw, given in the first argument. If the buffer_size is omitted it
| defaults to DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRandom
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedReader(_BufferedIOBase)
| BufferedReader(raw, buffer_size=8192)
|
| Create a new buffered reader using the given readable raw IO object.
|
| Method resolution order:
| BufferedReader
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedWriter(_BufferedIOBase)
| BufferedWriter(raw, buffer_size=8192)
|
| A buffer for a writeable sequential RawIO object.
|
| The constructor creates a BufferedWriter for the given writeable raw
| stream. If the buffer_size is not given, it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedWriter
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BytesIO(_BufferedIOBase)
| BytesIO(initial_bytes=b'')
|
| Buffered I/O implementation using an in-memory bytes buffer.
|
| Method resolution order:
| BytesIO
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| close(self, /)
| Disable all I/O operations.
|
| flush(self, /)
| Does nothing.
|
| getbuffer(self, /)
| Get a read-write view over the contents of the BytesIO object.
|
| getvalue(self, /)
| Retrieve the entire contents of the BytesIO object.
|
| isatty(self, /)
| Always returns False.
|
| BytesIO objects are not connected to a TTY-like device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| read1(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative or omitted, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readinto(self, buffer, /)
| Read bytes into buffer.
|
| Returns number of bytes read (0 for EOF), or None if the object
| is set not to block and has no data to read.
|
| readline(self, size=-1, /)
| Next line from the file, as a bytes object.
|
| Retain newline. A non-negative size argument limits the maximum
| number of bytes to return (an incomplete line may be returned then).
| Return an empty bytes object at EOF.
|
| readlines(self, size=None, /)
| List of bytes objects, each a line from the file.
|
| Call readline() repeatedly and return a list of the lines so read.
| The optional size argument, if given, is an approximate bound on the
| total number of bytes in the lines returned.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to byte offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos may be negative;
| 2 End of stream - pos usually negative.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Current file position, an integer.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is unchanged. Returns the new size.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, b, /)
| Write bytes to file.
|
| Return the number of bytes written.
|
| writelines(self, lines, /)
| Write lines to the file.
|
| Note that newlines are not added. lines can be any iterable object
| producing bytes-like objects. This is equivalent to calling write() for
| each element.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed.
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class FileIO(_RawIOBase)
| FileIO(file, mode='r', closefd=True, opener=None)
|
| Open a file.
|
| The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
| writing, exclusive creation or appending. The file will be created if it
| doesn't exist when opened for writing or appending; it will be truncated
| when opened for writing. A FileExistsError will be raised if it already
| exists when opened for creating. Opening a file for creating implies
| writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
| to allow simultaneous reading and writing. A custom opener can be used by
| passing a callable as *opener*. The underlying file descriptor for the file
| object is then obtained by calling opener with (*name*, *flags*).
| *opener* must return an open file descriptor (passing os.open as *opener*
| results in functionality similar to passing None).
|
| Method resolution order:
| FileIO
| _RawIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Close the file.
|
| A closed file cannot be used for further I/O operations. close() may be
| called more than once without error.
|
| fileno(self, /)
| Return the underlying file descriptor (an integer).
|
| isatty(self, /)
| True if the file is connected to a TTY device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as bytes.
|
| Only makes one system call, so less data may be returned than requested.
| In non-blocking mode, returns None if no data is available.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| True if file was opened in a read mode.
|
| readall(self, /)
| Read all data from the file, returned as bytes.
|
| In non-blocking mode, returns as much as is immediately available,
| or None if no data is available. Return an empty bytes object at EOF.
|
| readinto(self, buffer, /)
| Same as RawIOBase.readinto().
|
| seek(self, pos, whence=0, /)
| Move to new file position and return the file position.
|
| Argument offset is a byte count. Optional argument whence defaults to
| SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
| are SEEK_CUR or 1 (move relative to current position, positive or negative),
| and SEEK_END or 2 (move relative to end of file, usually negative, although
| many platforms allow seeking beyond the end of a file).
|
| Note that not all file objects are seekable.
|
| seekable(self, /)
| True if file supports random-access.
|
| tell(self, /)
| Current file position.
|
| Can raise OSError for non seekable files.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes and return the truncated size.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is changed to the value of size.
|
| writable(self, /)
| True if file was opened in a write mode.
|
| write(self, b, /)
| Write buffer b to file, return number of bytes written.
|
| Only makes one system call, so not all of the data may be written.
| The number of bytes actually written is returned. In non-blocking mode,
| returns None if the write would block.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed
|
| closefd
| True if the file descriptor will be closed by close().
|
| mode
| String giving the file mode
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class IOBase(_io._IOBase)
| The abstract base class for all I/O classes.
|
| This class provides dummy implementations for many methods that
| derived classes can override selectively; the default implementations
| represent a file that cannot be read, written or seeked.
|
| Even though IOBase does not declare read, readinto, or write because
| their signatures will vary, implementations and clients should
| consider those methods part of the interface. Also, implementations
| may raise UnsupportedOperation when operations they do not support are
| called.
|
| The basic type used for binary data read from or written to a file is
| bytes. Other bytes-like objects are accepted as method arguments too.
| In some cases (such as readinto), a writable object is required. Text
| I/O classes work with str data.
|
| Note that calling any method (except additional calls to close(),
| which are ignored) on a closed stream should raise a ValueError.
|
| IOBase (and its subclasses) support the iterator protocol, meaning
| that an IOBase object can be iterated over yielding the lines in a
| stream.
|
| IOBase also supports the :keyword:`with` statement. In this example,
| fp is closed after the suite of the with statement is complete:
|
| with open('spam.txt', 'r') as fp:
| fp.write('Spam and eggs!')
|
| Method resolution order:
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class IncrementalNewlineDecoder(builtins.object)
| IncrementalNewlineDecoder(decoder, translate, errors='strict')
|
| Codec used when reading a file in universal newlines mode.
|
| It wraps another incremental decoder, translating \r\n and \r into \n.
| It also records the types of newlines encountered. When used with
| translate=False, it ensures that the newline sequence is returned in
| one piece. When used with decoder=None, it expects unicode strings as
| decode input and translates newlines without first invoking an external
| decoder.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, /, input, final=False)
|
| getstate(self, /)
|
| reset(self, /)
|
| setstate(self, state, /)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| newlines
class RawIOBase(_io._RawIOBase, IOBase)
| Base class for raw binary I/O.
|
| Method resolution order:
| RawIOBase
| _io._RawIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._RawIOBase:
|
| read(self, size=-1, /)
|
| readall(self, /)
| Read until EOF, using multiple read() call.
|
| readinto(...)
|
| write(...)
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class StringIO(_TextIOBase)
| StringIO(initial_value='', newline='\n')
|
| Text I/O implementation using an in-memory buffer.
|
| The initial_value argument sets the value of object. The newline
| argument is like the one of TextIOWrapper's constructor.
|
| Method resolution order:
| StringIO
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| close(self, /)
| Close the IO object.
|
| Attempting any further operation after the object is closed
| will raise a ValueError.
|
| This method has no effect if the file is already closed.
|
| getvalue(self, /)
| Retrieve the entire contents of the object.
|
| read(self, size=-1, /)
| Read at most size characters, returned as a string.
|
| If the argument is negative or omitted, read until EOF
| is reached. Return an empty string at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Returns an empty string if EOF is hit immediately.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to character offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos must be 0;
| 2 End of stream - pos must be 0.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Tell the current file position.
|
| truncate(self, pos=None, /)
| Truncate size to pos.
|
| The pos argument defaults to the current file position, as
| returned by tell(). The current file position is unchanged.
| Returns the new absolute position.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, s, /)
| Write string to file.
|
| Returns the number of characters written, which is always equal to
| the length of the string.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| line_buffering
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class TextIOBase(_io._TextIOBase, IOBase)
| Base class for text I/O.
|
| This class provides a character and line based interface to stream
| I/O. There is no readinto method because Python's character strings
| are immutable.
|
| Method resolution order:
| TextIOBase
| _io._TextIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| write(self, s, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class TextIOWrapper(_TextIOBase)
| TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False)
|
| Character and line based layer over a BufferedIOBase object, buffer.
|
| encoding gives the name of the encoding that the stream will be
| decoded or encoded with. It defaults to locale.getencoding().
|
| errors determines the strictness of encoding and decoding (see
| help(codecs.Codec) or the documentation for codecs.register) and
| defaults to "strict".
|
| newline controls how line endings are handled. It can be None, '',
| '\n', '\r', and '\r\n'. It works as follows:
|
| * On input, if newline is None, universal newlines mode is
| enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
| these are translated into '\n' before being returned to the
| caller. If it is '', universal newline mode is enabled, but line
| endings are returned to the caller untranslated. If it has any of
| the other legal values, input lines are only terminated by the given
| string, and the line ending is returned to the caller untranslated.
|
| * On output, if newline is None, any '\n' characters written are
| translated to the system default line separator, os.linesep. If
| newline is '' or '\n', no translation takes place. If newline is any
| of the other legal values, any '\n' characters written are translated
| to the given string.
|
| If line_buffering is True, a call to flush is implied when a call to
| write contains a newline character.
|
| Method resolution order:
| TextIOWrapper
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None)
| Reconfigure the text stream with new parameters.
|
| This also does an implicit stream flush.
|
| seek(self, cookie, whence=0, /)
| Set the stream position, and return the new stream position.
|
| cookie
| Zero or an opaque number returned by tell().
| whence
| The relative position to seek from.
|
| Four operations are supported, given by the following argument
| combinations:
|
| - seek(0, SEEK_SET): Rewind to the start of the stream.
| - seek(cookie, SEEK_SET): Restore a previous position;
| 'cookie' must be a number returned by tell().
| - seek(0, SEEK_END): Fast-forward to the end of the stream.
| - seek(0, SEEK_CUR): Leave the current stream position unchanged.
|
| Any other argument combinations are invalid,
| and may raise exceptions.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return the stream position as an opaque number.
|
| The return value of tell() can be given as input to seek(), to restore a
| previous stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, text, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| buffer
|
| closed
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| line_buffering
|
| name
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| write_through
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class UnsupportedOperation(builtins.OSError, builtins.ValueError)
| Method resolution order:
| UnsupportedOperation
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
dependent: locale.getencoding() is called to get the current locale encoding.
(For reading and writing raw bytes use binary mode and leave encoding
unspecified.) The available modes are:
========= ===============================================================
Character Meaning
--------- ---------------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
'a' open for writing, appending to the end of the file if it exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
========= ===============================================================
The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
line buffering (only usable in text mode), and an integer > 1 to indicate
the size of a fixed-size chunk buffer. When no buffering argument is
given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
is chosen using a heuristic trying to determine the underlying device's
"block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
On many systems, the buffer will typically be 4096 or 8192 bytes long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
* On input, if newline is None, universal newlines mode is
enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
these are translated into '\n' before being returned to the
caller. If it is '', universal newline mode is enabled, but line
endings are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
and must be True in that case.
A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
are performed. When open() is used to open a file in a text mode ('w',
'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
open_code(path)
Opens the provided file with the intent to import the contents.
This may perform extra validation beyond open(), but is otherwise interchangeable
with calling open(path, 'rb').
text_encoding(encoding, stacklevel=2, /)
A helper function to choose the text encoding.
When encoding is not None, this function returns it.
Otherwise, this function returns the default text encoding
(i.e. "locale" or "utf-8" depends on UTF-8 mode).
This function emits an EncodingWarning if encoding is None and
sys.flags.warn_default_encoding is true.
This can be used in APIs with an encoding=None parameter.
However, please consider using encoding="utf-8" for new APIs.
DATA
DEFAULT_BUFFER_SIZE = 8192
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
__all__ = ['BlockingIOError', 'open', 'open_code', 'IOBase', 'RawIOBas...
AUTHOR
Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\io.py
logging.handlers.logging
Python Library Documentation: package logging
NAME
logging
MODULE REFERENCE
https://docs.python.org/3.12/library/logging.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
PACKAGE CONTENTS
config
handlers
CLASSES
builtins.object
BufferingFormatter
Filter
Formatter
LogRecord
LoggerAdapter
Filterer(builtins.object)
Handler
NullHandler
StreamHandler
FileHandler
Logger
class BufferingFormatter(builtins.object)
| BufferingFormatter(linefmt=None)
|
| A formatter suitable for formatting a number of records.
|
| Methods defined here:
|
| __init__(self, linefmt=None)
| Optionally specify a formatter which will be used to format each
| individual record.
|
| format(self, records)
| Format the specified records and return the result as a string.
|
| formatFooter(self, records)
| Return the footer string for the specified records.
|
| formatHeader(self, records)
| Return the header string for the specified records.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class FileHandler(StreamHandler)
| FileHandler(filename, mode='a', encoding=None, delay=False, errors=None)
|
| A handler class which writes formatted logging records to disk files.
|
| Method resolution order:
| FileHandler
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode='a', encoding=None, delay=False, errors=None)
| Open the specified file and use it as the stream for logging.
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| emit(self, record)
| Emit a record.
|
| If the stream was not opened because 'delay' was specified in the
| constructor, open it before calling the superclass's emit.
|
| If stream is not open, current mode is 'w' and `_closed=True`, record
| will not be emitted (see Issue #42378).
|
| ----------------------------------------------------------------------
| Methods inherited from StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Filter(builtins.object)
| Filter(name='')
|
| Filter instances are used to perform arbitrary filtering of LogRecords.
|
| Loggers and Handlers can optionally use Filter instances to filter
| records as desired. The base filter class only allows events which are
| below a certain point in the logger hierarchy. For example, a filter
| initialized with "A.B" will allow events logged by loggers "A.B",
| "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
| initialized with the empty string, all events are passed.
|
| Methods defined here:
|
| __init__(self, name='')
| Initialize a filter.
|
| Initialize with the name of the logger which, together with its
| children, will have its events allowed through the filter. If no
| name is specified, allow every event.
|
| filter(self, record)
| Determine if the specified record is to be logged.
|
| Returns True if the record should be logged, or False otherwise.
| If deemed appropriate, the record may be modified in-place.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Formatter(builtins.object)
| Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
|
| Formatter instances are used to convert a LogRecord to text.
|
| Formatters need to know how a LogRecord is constructed. They are
| responsible for converting a LogRecord to (usually) a string which can
| be interpreted by either a human or an external system. The base Formatter
| allows a formatting string to be specified. If none is supplied, the
| style-dependent default value, "%(message)s", "{message}", or
| "${message}", is used.
|
| The Formatter can be initialized with a format string which makes use of
| knowledge of the LogRecord attributes - e.g. the default value mentioned
| above makes use of the fact that the user's message and arguments are pre-
| formatted into a LogRecord's message attribute. Currently, the useful
| attributes in a LogRecord are described by:
|
| %(name)s Name of the logger (logging channel)
| %(levelno)s Numeric logging level for the message (DEBUG, INFO,
| WARNING, ERROR, CRITICAL)
| %(levelname)s Text logging level for the message ("DEBUG", "INFO",
| "WARNING", "ERROR", "CRITICAL")
| %(pathname)s Full pathname of the source file where the logging
| call was issued (if available)
| %(filename)s Filename portion of pathname
| %(module)s Module (name portion of filename)
| %(lineno)d Source line number where the logging call was issued
| (if available)
| %(funcName)s Function name
| %(created)f Time when the LogRecord was created (time.time()
| return value)
| %(asctime)s Textual time when the LogRecord was created
| %(msecs)d Millisecond portion of the creation time
| %(relativeCreated)d Time in milliseconds when the LogRecord was created,
| relative to the time the logging module was loaded
| (typically at application startup time)
| %(thread)d Thread ID (if available)
| %(threadName)s Thread name (if available)
| %(taskName)s Task name (if available)
| %(process)d Process ID (if available)
| %(message)s The result of record.getMessage(), computed just as
| the record is emitted
|
| Methods defined here:
|
| __init__(self, fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
| Initialize the formatter with specified format strings.
|
| Initialize the formatter either with the specified format string, or a
| default as described above. Allow for specialized date formatting with
| the optional datefmt argument. If datefmt is omitted, you get an
| ISO8601-like (or RFC 3339-like) format.
|
| Use a style parameter of '%', '{' or '$' to specify that you want to
| use one of %-formatting, :meth:`str.format` (``{}``) formatting or
| :class:`string.Template` formatting in your format string.
|
| .. versionchanged:: 3.2
| Added the ``style`` parameter.
|
| format(self, record)
| Format the specified record as text.
|
| The record's attribute dictionary is used as the operand to a
| string formatting operation which yields the returned string.
| Before formatting the dictionary, a couple of preparatory steps
| are carried out. The message attribute of the record is computed
| using LogRecord.getMessage(). If the formatting string uses the
| time (as determined by a call to usesTime(), formatTime() is
| called to format the event time. If there is exception information,
| it is formatted using formatException() and appended to the message.
|
| formatException(self, ei)
| Format and return the specified exception information as a string.
|
| This default implementation just uses
| traceback.print_exception()
|
| formatMessage(self, record)
|
| formatStack(self, stack_info)
| This method is provided as an extension point for specialized
| formatting of stack information.
|
| The input data is a string as returned from a call to
| :func:`traceback.print_stack`, but with the last trailing newline
| removed.
|
| The base implementation just returns the value passed in.
|
| formatTime(self, record, datefmt=None)
| Return the creation time of the specified LogRecord as formatted text.
|
| This method should be called from format() by a formatter which
| wants to make use of a formatted time. This method can be overridden
| in formatters to provide for any specific requirement, but the
| basic behaviour is as follows: if datefmt (a string) is specified,
| it is used with time.strftime() to format the creation time of the
| record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.
| The resulting string is returned. This function uses a user-configurable
| function to convert the creation time to a tuple. By default,
| time.localtime() is used; to change this for a particular formatter
| instance, set the 'converter' attribute to a function with the same
| signature as time.localtime() or time.gmtime(). To change it for all
| formatters, for example if you want all logging times to be shown in GMT,
| set the 'converter' attribute in the Formatter class.
|
| usesTime(self)
| Check if the format uses the creation time of the record.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| converter = localtime(...)
| localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
| tm_sec,tm_wday,tm_yday,tm_isdst)
|
| Convert seconds since the Epoch to a time tuple expressing local time.
| When 'seconds' is not passed in, convert the current time instead.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| default_msec_format = '%s,%03d'
|
| default_time_format = '%Y-%m-%d %H:%M:%S'
class Handler(Filterer)
| Handler(level=0)
|
| Handler instances dispatch logging events to specific destinations.
|
| The base handler class. Acts as a placeholder which defines the Handler
| interface. Handlers can optionally use Formatter instances to format
| records as desired. By default, no formatter is specified; in this case,
| the 'raw' message as determined by record.message is logged.
|
| Method resolution order:
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Do whatever it takes to actually log the specified logging record.
|
| This version is intended to be implemented by subclasses and so
| raises a NotImplementedError.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LogRecord(builtins.object)
| LogRecord(name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
|
| A LogRecord instance represents an event being logged.
|
| LogRecord instances are created every time something is logged. They
| contain all the information pertinent to the event being logged. The
| main information passed in is in msg and args, which are combined
| using str(msg) % args to create the message field of the record. The
| record also includes information such as when the record was created,
| the source line where the logging call was made, and any exception
| information to be logged.
|
| Methods defined here:
|
| __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
| Initialize a logging record with interesting information.
|
| __repr__(self)
| Return repr(self).
|
| getMessage(self)
| Return the message for this LogRecord.
|
| Return the message for this LogRecord after merging any user-supplied
| arguments with the message.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LoggerAdapter(builtins.object)
| LoggerAdapter(logger, extra=None)
|
| An adapter for loggers which makes it easier to specify contextual
| information in logging output.
|
| Methods defined here:
|
| __init__(self, logger, extra=None)
| Initialize the adapter with a logger and a dict-like object which
| provides contextual information. This constructor signature allows
| easy stacking of LoggerAdapters, if so desired.
|
| You can effectively pass keyword arguments as shown in the
| following example:
|
| adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2"))
|
| __repr__(self)
| Return repr(self).
|
| critical(self, msg, *args, **kwargs)
| Delegate a critical call to the underlying logger.
|
| debug(self, msg, *args, **kwargs)
| Delegate a debug call to the underlying logger.
|
| error(self, msg, *args, **kwargs)
| Delegate an error call to the underlying logger.
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Delegate an exception call to the underlying logger.
|
| getEffectiveLevel(self)
| Get the effective level for the underlying logger.
|
| hasHandlers(self)
| See if the underlying logger has any handlers.
|
| info(self, msg, *args, **kwargs)
| Delegate an info call to the underlying logger.
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Delegate a log call to the underlying logger, after adding
| contextual information from this adapter instance.
|
| process(self, msg, kwargs)
| Process the logging message and keyword arguments passed in to
| a logging call to insert contextual information. You can either
| manipulate the message itself, the keyword args or both. Return
| the message and kwargs modified (or not) to suit your needs.
|
| Normally, you'll only need to override this one method in a
| LoggerAdapter subclass for your specific needs.
|
| setLevel(self, level)
| Set the specified level on the underlying logger.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Delegate a warning call to the underlying logger.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| manager
class NullHandler(Handler)
| NullHandler(level=0)
|
| This handler does nothing. It's intended to be used to avoid the
| "No handlers could be found for logger XXX" one-off warning. This is
| important for library code, which may contain code to log events. If a user
| of the library does not configure logging, the one-off warning might be
| produced; to avoid this, the library developer simply needs to instantiate
| a NullHandler and add it to the top-level logger of the library module or
| package.
|
| Method resolution order:
| NullHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Stub.
|
| handle(self, record)
| Stub.
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class StreamHandler(Handler)
| StreamHandler(stream=None)
|
| A handler class which writes logging records, appropriately formatted,
| to a stream. Note that this class does not close the stream, as
| sys.stdout or sys.stderr may be used.
|
| Method resolution order:
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, stream=None)
| Initialize the handler.
|
| If stream is not specified, sys.stderr is used.
|
| __repr__(self)
| Return repr(self).
|
| emit(self, record)
| Emit a record.
|
| If a formatter is specified, it is used to format the record.
| The record is then written to the stream with a trailing newline. If
| exception information is present, it is formatted using
| traceback.print_exception and appended to the stream. If the stream
| has an 'encoding' attribute, it is used to determine how to do the
| output to the stream.
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
addLevelName(level, levelName)
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
basicConfig(**kwargs)
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured, unless the keyword argument *force* is set to ``True``.
It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
style If a format string is specified, use this to specify the
type of format string (possible values '%', '{', '$', for
%-formatting, :meth:`str.format` and :class:`string.Template`
- defaults to '%').
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
handlers If specified, this should be an iterable of already created
handlers, which will be added to the root logger. Any handler
in the list which does not have a formatter assigned will be
assigned the formatter created in this function.
force If this keyword is specified as true, any existing handlers
attached to the root logger are removed and closed, before
carrying out the configuration as specified by the other
arguments.
encoding If specified together with a filename, this encoding is passed to
the created FileHandler, causing it to be used when the file is
opened.
errors If specified together with a filename, this value is passed to the
created FileHandler, causing it to be used when the file is
opened in text mode. If not specified, the default value is
`backslashreplace`.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
.. versionchanged:: 3.2
Added the ``style`` parameter.
.. versionchanged:: 3.3
Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
incompatible arguments (e.g. ``handlers`` specified together with
``filename``/``filemode``, or ``filename``/``filemode`` specified
together with ``stream``, or ``handlers`` specified together with
``stream``.
.. versionchanged:: 3.8
Added the ``force`` parameter.
.. versionchanged:: 3.9
Added the ``encoding`` and ``errors`` parameters.
captureWarnings(capture)
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
critical(msg, *args, **kwargs)
Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.
debug(msg, *args, **kwargs)
Log a message with severity 'DEBUG' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
disable(level=50)
Disable all logging calls of severity 'level' and below.
error(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
exception(msg, *args, exc_info=True, **kwargs)
Log a message with severity 'ERROR' on the root logger, with exception
information. If the logger has no handlers, basicConfig() is called to add
a console handler with a pre-defined format.
fatal(msg, *args, **kwargs)
Don't use this function, use critical() instead.
getHandlerByName(name)
Get a handler with the specified *name*, or None if there isn't one with
that name.
getHandlerNames()
Return all known handler names as an immutable set.
getLevelName(level)
Return the textual or numeric representation of logging level 'level'.
If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
INFO, DEBUG) then you get the corresponding string. If you have
associated levels with names using addLevelName then the name you have
associated with 'level' is returned.
If a numeric value corresponding to one of the defined levels is passed
in, the corresponding string representation is returned.
If a string representation of the level is passed in, the corresponding
numeric value is returned.
If no matching numeric or string value is passed in, the string
'Level %s' % level is returned.
getLevelNamesMapping()
getLogRecordFactory()
Return the factory to be used when instantiating a log record.
getLogger(name=None)
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
getLoggerClass()
Return the class to be used when instantiating a logger.
info(msg, *args, **kwargs)
Log a message with severity 'INFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
log(level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level' on the root logger. If
the logger has no handlers, call basicConfig() to add a console handler
with a pre-defined format.
makeLogRecord(dict)
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
setLogRecordFactory(factory)
Set the factory to be used when instantiating a log record.
:param factory: A callable which will be called to instantiate
a log record.
setLoggerClass(klass)
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
shutdown(handlerList=[<weakref at 0x00000172065F6700; to '_StderrHandler' at 0x00000172065F2630>])
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
warn(msg, *args, **kwargs)
warning(msg, *args, **kwargs)
Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
DATA
BASIC_FORMAT = '%(levelname)s:%(name)s:%(message)s'
CRITICAL = 50
DEBUG = 10
ERROR = 40
FATAL = 50
INFO = 20
NOTSET = 0
WARN = 30
WARNING = 30
__all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', ...
__status__ = 'production'
lastResort = <_StderrHandler <stderr> (WARNING)>
raiseExceptions = True
VERSION
0.5.1.2
DATE
07 February 2010
AUTHOR
Vinay Sajip <vinay_sajip@red-dove.com>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\logging\__init__.py
logging.handlers.os
Python Library Documentation: module os
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
https://docs.python.org/3.12/library/os.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This exports:
- all functions from posix or nt, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix' or 'nt'
- os.curdir is a string representing the current directory (always '.')
- os.pardir is a string representing the parent directory (always '..')
- os.sep is the (or a most common) pathname separator ('/' or '\\')
- os.extsep is the extension separator (always '.')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- os.defpath is the default search path for executables
- os.devnull 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 os.path
(e.g., split and join).
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.object
nt.DirEntry
builtins.tuple(builtins.object)
nt.times_result
nt.uname_result
stat_result
statvfs_result
terminal_size
class DirEntry(builtins.object)
| 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_junction(self, /)
| Return True if the entry is a junction; 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__(...)
| 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 os.path.join(scandir_path, entry.name)
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class stat_result(builtins.tuple)
| 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 os.stat for more information.
|
| Method resolution order:
| stat_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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_birthtime
| time of creation
|
| st_birthtime_ns
| time of creation in nanoseconds
|
| st_ctime
| time of last change
|
| st_ctime_ns
| time of last change in nanoseconds
|
| st_dev
| device
|
| st_file_attributes
| Windows file attribute bits
|
| 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_reparse_tag
| Windows reparse tag
|
| 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 = 20
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 3
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class statvfs_result(builtins.tuple)
| 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 os.statvfs for more information.
|
| Method resolution order:
| statvfs_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class terminal_size(builtins.tuple)
| terminal_size(iterable=(), /)
|
| A tuple of (columns, lines) for holding terminal window size
|
| Method resolution order:
| terminal_size
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class times_result(builtins.tuple)
| times_result(iterable=(), /)
|
| times_result: Result from os.times().
|
| 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 os.times for more information.
|
| Method resolution order:
| times_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class uname_result(builtins.tuple)
| uname_result(iterable=(), /)
|
| uname_result: Result from os.uname().
|
| 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 os.uname for more information.
|
| Method resolution order:
| uname_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
_exit(status)
Exit to the system with specified status, without normal exit processing.
abort()
Abort the interpreter immediately.
This function 'dumps core' or otherwise fails in the hardest way possible
on the hosting operating system. This function never returns.
access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
Use the real uid/gid to test for access to a path.
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 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.
chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
Change the access permissions of a file.
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.
Be careful when using number literals for *mode*. The conventional UNIX notation for
numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in
Python.
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.
It is an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
dir_fd and follow_symlinks may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
close(fd)
Close a file descriptor.
closerange(fd_low, fd_high, /)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
cpu_count()
Return the number of CPUs in the system; return None if indeterminable.
This number is not equivalent to the number of CPUs the current process can
use. The number of usable CPUs can be obtained with
``len(os.sched_getaffinity(0))``
device_encoding(fd)
Return a string describing the encoding of a terminal's file descriptor.
The file descriptor must be attached to a terminal.
If the device is not a terminal, return None.
dup(fd, /)
Return a duplicate of a file descriptor.
dup2(fd, fd2, inheritable=True)
Duplicate file descriptor.
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)
Execute the executable file with argument list args and
environment env, replacing the current process.
execlp(file, *args)
execlp(file, *args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
execlpe(file, *args)
execlpe(file, *args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the current
process.
execv(path, argv, /)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
execve(path, argv, env)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
execvp(file, args)
execvp(file, args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
args may be a list or tuple of strings.
execvpe(file, args, env)
execvpe(file, args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the
current process.
args may be a list or tuple of strings.
fdopen(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)
fsdecode(filename)
Decode filename (an os.PathLike, 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 os.PathLike, 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.
If the object is str or bytes, then allow it to pass through as-is. If the
object defines __fspath__(), then return the result of that method. All other
types raise a TypeError.
fstat(fd)
Perform a stat system call on the given file descriptor.
Like stat(), but for an open file descriptor.
Equivalent to os.stat(fd).
fsync(fd)
Force write of fd to disk.
ftruncate(fd, length, /)
Truncate a file, specified by file descriptor, to a specific length.
get_blocking(fd, /)
Get the blocking mode of the file descriptor.
Return False if the O_NONBLOCK flag is set, True if the flag is cleared.
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.
*env* must be an environment variable dict or None. If *env* is None,
os.environ will be used.
get_handle_inheritable(handle, /)
Get the close-on-exe flag of the specified file descriptor.
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.
If the file descriptor is not connected to a terminal, an OSError
is thrown.
This function will only be defined if an implementation is
available for this system.
shutil.get_terminal_size is the high-level function which should
normally be used, os.get_terminal_size is the low-level implementation.
getcwd()
Return a unicode string representing the current working directory.
getcwdb()
Return a bytes string representing the current working directory.
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.
getlogin()
Return the actual login name.
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).
isatty(fd, /)
Return True if the fd is connected to a terminal.
Return True if the file descriptor is an open file descriptor
connected to the slave end of a terminal.
kill(pid, signal, /)
Kill a process with a signal.
link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
Create a hard link to a file.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
If follow_symlinks is False, and the last element of src is a symbolic
link, link will create a link to the symbolic link itself instead of the
file the link points to.
src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your
platform. If they are unavailable, using them will raise a
NotImplementedError.
listdir(path=None)
Return a list containing the names of the files in the directory.
path can be specified as either str, bytes, or a path-like object. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.
On some platforms, path may also be specified as an open file descriptor;\
the file descriptor must refer to a directory.
If this functionality is unavailable, using it raises NotImplementedError.
The list is in arbitrary order. It does not include the special
entries '.' and '..' even if they are present in the directory.
listdrives()
Return a list containing the names of drives in the system.
A drive name typically looks like 'C:\\'.
listmounts(volume)
Return a list containing mount points for a particular volume.
'volume' should be a GUID path as returned from os.listvolumes.
listvolumes()
Return a list containing the volumes in the system.
Volumes are typically represented as a GUID path.
lseek(fd, position, whence, /)
Set the position of a file descriptor. Return the new position.
fd
An open file descriptor, as returned by os.open().
position
Position, interpreted relative to 'whence'.
whence
The relative position to seek from. Valid values are:
- SEEK_SET: seek from the start of the file.
- SEEK_CUR: seek from the current file position.
- SEEK_END: seek from the end of the file.
The return value is the number of bytes relative to the beginning of the file.
lstat(path, *, dir_fd=None)
Perform a stat system call on the given path, without following symbolic links.
Like stat(), but do not follow symbolic links.
Equivalent to stat(path, follow_symlinks=False).
makedirs(name, mode=511, exist_ok=False)
makedirs(name [, mode=0o777][, exist_ok=False])
Super-mkdir; create a leaf directory and all intermediate ones. Works like
mkdir, except that any intermediate path segment (not just the rightmost)
will be created if it does not exist. If the target directory already
exists, raise an OSError if exist_ok is False. Otherwise no exception is
raised. This is recursive.
mkdir(path, mode=511, *, dir_fd=None)
Create a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
The mode argument is ignored on Windows. Where it is used, the current umask
value is first masked out.
open(path, flags, mode=511, *, dir_fd=None)
Open a file for low level IO. Returns a file descriptor (integer).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
pipe()
Create a pipe.
Returns a tuple of two file descriptors:
(read_fd, write_fd)
popen(cmd, mode='r', buffering=-1)
putenv(name, value, /)
Change or add an environment variable.
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.
If dir_fd is 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.
dir_fd may not be implemented on your platform. If it is unavailable,
using it will raise a NotImplementedError.
remove(path, *, dir_fd=None)
Remove a file (same as unlink()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
removedirs(name)
removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.
rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
renames(old, new)
renames(old, new)
Super-rename; create directories as necessary and delete any left
empty. Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first. After the rename, directories corresponding to rightmost
path segments of the old name will be pruned until either the
whole path is consumed or a nonempty directory is found.
Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory, overwriting the destination.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
rmdir(path, *, dir_fd=None)
Remove a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
scandir(path=None)
Return an iterator of DirEntry objects for given path.
path can be specified as either str, bytes, or a path-like object. If path
is bytes, the names of yielded DirEntry objects will also be bytes; in
all other circumstances they will be str.
If path is None, uses the path='.'.
set_blocking(fd, blocking, /)
Set the blocking mode of the specified file descriptor.
Set the O_NONBLOCK flag if blocking is False,
clear the O_NONBLOCK flag otherwise.
set_handle_inheritable(handle, inheritable, /)
Set the inheritable flag of the specified handle.
set_inheritable(fd, inheritable, /)
Set the inheritable flag of the specified file descriptor.
spawnl(mode, file, *args)
spawnl(mode, file, *args) -> integer
Execute file 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.
spawnle(mode, file, *args)
spawnle(mode, file, *args, env) -> integer
Execute file 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.
spawnv(mode, path, argv, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
spawnve(mode, path, argv, env, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
startfile(...)
Start a file with its associated application.
When "operation" is not specified or "open", this acts like
double-clicking the file in Explorer, or giving the file name as an
argument to the DOS "start" command: the file is opened with whatever
application (if any) its extension is associated.
When another "operation" is given, it specifies what should be done with
the file. A typical operation is "print".
"arguments" is passed to the application, but should be omitted if the
file is a document.
"cwd" is the working directory for the operation. If "filepath" is
relative, it will be resolved against this directory. This argument
should usually be an absolute path.
"show_cmd" can be used to override the recommended visibility option.
See the Windows ShellExecute documentation for values.
startfile returns as soon as the associated application is launched.
There is no option to wait for the application to close, and no way
to retrieve the application's exit status.
The filepath is relative to the current directory. If you want to use
an absolute path, make sure the first character is not a slash ("/");
the underlying Win32 ShellExecute function doesn't work if it is.
stat(path, *, dir_fd=None, follow_symlinks=True)
Perform a stat system call on the given path.
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.
dir_fd and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
It's an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
strerror(code, /)
Translate an error code to a message string.
symlink(src, dst, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to src named dst.
target_is_directory is required on Windows if the target is to be
interpreted as a directory. (On Windows, symlink requires
Windows 6.0 or greater, and raises a NotImplementedError otherwise.)
target_is_directory is ignored on non-Windows platforms.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
system(command)
Execute the command in a subshell.
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.
umask(mask, /)
Set the current numeric umask and return the previous umask.
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
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.
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.
If times is not None, it must be a tuple (atime, mtime);
atime and mtime should be expressed as float seconds since the epoch.
If ns is specified, it must be a tuple (atime_ns, mtime_ns);
atime_ns and mtime_ns should be expressed as integer nanoseconds
since the epoch.
If times is None and ns is unspecified, utime uses the current time.
Specifying tuples for both times and ns is an error.
If dir_fd is 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.
If follow_symlinks is False, and the last element of the path is a symbolic
link, utime will modify the symbolic link itself instead of the file the
link points to.
It is an error to use dir_fd or follow_symlinks when specifying path
as an open file descriptor.
dir_fd and follow_symlinks may not be available on your platform.
If they are unavailable, using them will raise a NotImplementedError.
waitpid(pid, options, /)
Wait for completion of a given process.
Returns a tuple of information regarding the process:
(pid, status << 8)
The options argument is ignored on Windows.
waitstatus_to_exitcode(status)
Convert a wait status to an exit code.
On Unix:
* If WIFEXITED(status) is true, return WEXITSTATUS(status).
* If WIFSIGNALED(status) is true, return -WTERMSIG(status).
* Otherwise, raise a ValueError.
On Windows, return status shifted right by 8 bits.
On Unix, if the process is being traced or if waitpid() was called with
WUNTRACED option, the caller must first check if WIFSTOPPED(status) is true.
This function must not be called if WIFSTOPPED(status) is true.
walk(top, topdown=True, onerror=None, followlinks=False)
Directory tree generator.
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (including symlinks to directories,
and excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).
If optional arg 'topdown' is true or not specified, the triple for a
directory is generated before the triples for any of its subdirectories
(directories are generated top down). If topdown is false, the triple
for a directory is generated after the triples for all of its
subdirectories (directories are generated bottom up).
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 os.walk(), 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.
By default errors from the os.scandir() call are ignored. If
optional arg 'onerror' is specified, it should be a function; it
will be called with one argument, an OSError instance. It can
report the error to continue with the walk, or raise the exception
to abort the walk. Note that the filename is available as the
filename attribute of the exception object.
By default, os.walk does not follow symbolic links to subdirectories on
systems that support them. In order to get this functionality, set the
optional argument 'followlinks' to true.
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 os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print(root, "consumes ")
print(sum(getsize(join(root, name)) for name in files), end=" ")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
write(fd, data, /)
Write a bytes object to a file descriptor.
DATA
EX_OK = 0
F_OK = 0
O_APPEND = 8
O_BINARY = 32768
O_CREAT = 256
O_EXCL = 1024
O_NOINHERIT = 128
O_RANDOM = 16
O_RDONLY = 0
O_RDWR = 2
O_SEQUENTIAL = 32
O_SHORT_LIVED = 4096
O_TEMPORARY = 64
O_TEXT = 16384
O_TRUNC = 512
O_WRONLY = 1
P_DETACH = 4
P_NOWAIT = 1
P_NOWAITO = 3
P_OVERLAY = 2
P_WAIT = 0
R_OK = 4
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
TMP_MAX = 2147483647
W_OK = 2
X_OK = 1
__all__ = ['altsep', 'curdir', 'pardir', 'sep', 'pathsep', 'linesep', ...
altsep = '/'
curdir = '.'
defpath = r'.;C:\bin'
devnull = 'nul'
environ = environ({'ALLUSERSPROFILE': 'C:\\ProgramData', '...undled\\l...
extsep = '.'
linesep = '\r\n'
name = 'nt'
pardir = '..'
pathsep = ';'
sep = r'\'
supports_bytes_environ = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\os.py
logging.handlers.pickle
Python Library Documentation: module pickle
NAME
pickle - Create portable serialized representations of Python objects.
MODULE REFERENCE
https://docs.python.org/3.12/library/pickle.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.
Classes:
Pickler
Unpickler
Functions:
dump(object, file)
dumps(object) -> string
load(file) -> object
loads(bytes) -> object
Misc variables:
__version__
format_version
compatible_formats
CLASSES
builtins.Exception(builtins.BaseException)
_pickle.PickleError
_pickle.PicklingError
_pickle.UnpicklingError
builtins.object
_pickle.Pickler
_pickle.Unpickler
PickleBuffer
class PickleBuffer(builtins.object)
| Wrapper for potentially out-of-band buffers
|
| Methods defined here:
|
| __buffer__(self, flags, /)
| Return a buffer object that exposes the underlying memory of the object.
|
| __release_buffer__(self, buffer, /)
| Release the buffer object that exposes the underlying memory of the object.
|
| raw(self, /)
| Return a memoryview of the raw memory underlying this buffer.
| Will raise BufferError is the buffer isn't contiguous.
|
| release(self, /)
| Release the underlying buffer exposed by the PickleBuffer object.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
class PickleError(builtins.Exception)
| Method resolution order:
| PickleError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Pickler(builtins.object)
| Pickler(file, protocol=None, fix_imports=True, buffer_callback=None)
|
| This takes a binary file for writing a pickle data stream.
|
| The optional *protocol* argument tells the pickler to use the given
| protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
| protocol is 4. It was introduced in Python 3.4, and is incompatible
| with previous versions.
|
| Specifying a negative protocol version selects the highest protocol
| version supported. The higher the protocol used, the more recent the
| version of Python needed to read the pickle produced.
|
| The *file* argument must have a write() method that accepts a single
| bytes argument. It can thus be a file object opened for binary
| writing, an io.BytesIO instance, or any other custom object that meets
| this interface.
|
| If *fix_imports* is True and protocol is less than 3, pickle will try
| to map the new Python 3 names to the old module names used in Python
| 2, so that the pickle data stream is readable with Python 2.
|
| If *buffer_callback* is None (the default), buffer views are
| serialized into *file* as part of the pickle stream.
|
| If *buffer_callback* is not None, then it can be called any number
| of times with a buffer view. If the callback returns a false value
| (such as None), the given buffer is out-of-band; otherwise the
| buffer is serialized in-band, i.e. inside the pickle stream.
|
| It is an error if *buffer_callback* is not None and *protocol*
| is None or smaller than 5.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| clear_memo(self, /)
| Clears the pickler's "memo".
|
| The memo is the data structure that remembers which objects the
| pickler has already seen, so that shared or recursive objects are
| pickled by reference and not by value. This method is useful when
| re-using picklers.
|
| dump(self, obj, /)
| Write a pickled representation of the given object to the open file.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| bin
|
| dispatch_table
|
| fast
|
| memo
|
| persistent_id
class PicklingError(PickleError)
| Method resolution order:
| PicklingError
| PickleError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PickleError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Unpickler(builtins.object)
| Unpickler(file, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
|
| This takes a binary file for reading a pickle data stream.
|
| The protocol version of the pickle is detected automatically, so no
| protocol argument is needed. Bytes past the pickled object's
| representation are ignored.
|
| The argument *file* must have two methods, a read() method that takes
| an integer argument, and a readline() method that requires no
| arguments. Both methods should return bytes. Thus *file* can be a
| binary file object opened for reading, an io.BytesIO object, or any
| other custom object that meets this interface.
|
| Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
| which are used to control compatibility support for pickle stream
| generated by Python 2. If *fix_imports* is True, pickle will try to
| map the old Python 2 names to the new names used in Python 3. The
| *encoding* and *errors* tell pickle how to decode 8-bit string
| instances pickled by Python 2; these default to 'ASCII' and 'strict',
| respectively. The *encoding* can be 'bytes' to read these 8-bit
| string instances as bytes objects.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| find_class(self, module_name, global_name, /)
| Return an object from a specified module.
|
| If necessary, the module will be imported. Subclasses may override
| this method (e.g. to restrict unpickling of arbitrary classes and
| functions).
|
| This method is called whenever a class or a function object is
| needed. Both arguments passed are str objects.
|
| load(self, /)
| Load a pickle.
|
| Read a pickled object representation from the open file object given
| in the constructor, and return the reconstituted object hierarchy
| specified therein.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| memo
|
| persistent_load
class UnpicklingError(PickleError)
| Method resolution order:
| UnpicklingError
| PickleError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from PickleError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
dump(obj, file, protocol=None, *, fix_imports=True, buffer_callback=None)
Write a pickled representation of obj to the open file object file.
This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may
be more efficient.
The optional *protocol* argument tells the pickler to use the given
protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.
Specifying a negative protocol version selects the highest protocol
version supported. The higher the protocol used, the more recent the
version of Python needed to read the pickle produced.
The *file* argument must have a write() method that accepts a single
bytes argument. It can thus be a file object opened for binary
writing, an io.BytesIO instance, or any other custom object that meets
this interface.
If *fix_imports* is True and protocol is less than 3, pickle will try
to map the new Python 3 names to the old module names used in Python
2, so that the pickle data stream is readable with Python 2.
If *buffer_callback* is None (the default), buffer views are serialized
into *file* as part of the pickle stream. It is an error if
*buffer_callback* is not None and *protocol* is None or smaller than 5.
dumps(obj, protocol=None, *, fix_imports=True, buffer_callback=None)
Return the pickled representation of the object as a bytes object.
The optional *protocol* argument tells the pickler to use the given
protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.
Specifying a negative protocol version selects the highest protocol
version supported. The higher the protocol used, the more recent the
version of Python needed to read the pickle produced.
If *fix_imports* is True and *protocol* is less than 3, pickle will
try to map the new Python 3 names to the old module names used in
Python 2, so that the pickle data stream is readable with Python 2.
If *buffer_callback* is None (the default), buffer views are serialized
into *file* as part of the pickle stream. It is an error if
*buffer_callback* is not None and *protocol* is None or smaller than 5.
load(file, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
Read and return an object from the pickle data stored in a file.
This is equivalent to ``Unpickler(file).load()``, but may be more
efficient.
The protocol version of the pickle is detected automatically, so no
protocol argument is needed. Bytes past the pickled object's
representation are ignored.
The argument *file* must have two methods, a read() method that takes
an integer argument, and a readline() method that requires no
arguments. Both methods should return bytes. Thus *file* can be a
binary file object opened for reading, an io.BytesIO object, or any
other custom object that meets this interface.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
which are used to control compatibility support for pickle stream
generated by Python 2. If *fix_imports* is True, pickle will try to
map the old Python 2 names to the new names used in Python 3. The
*encoding* and *errors* tell pickle how to decode 8-bit string
instances pickled by Python 2; these default to 'ASCII' and 'strict',
respectively. The *encoding* can be 'bytes' to read these 8-bit
string instances as bytes objects.
loads(data, /, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
Read and return an object from the given pickle data.
The protocol version of the pickle is detected automatically, so no
protocol argument is needed. Bytes past the pickled object's
representation are ignored.
Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
which are used to control compatibility support for pickle stream
generated by Python 2. If *fix_imports* is True, pickle will try to
map the old Python 2 names to the new names used in Python 3. The
*encoding* and *errors* tell pickle how to decode 8-bit string
instances pickled by Python 2; these default to 'ASCII' and 'strict',
respectively. The *encoding* can be 'bytes' to read these 8-bit
string instances as bytes objects.
DATA
ADDITEMS = b'\x90'
APPEND = b'a'
APPENDS = b'e'
BINBYTES = b'B'
BINBYTES8 = b'\x8e'
BINFLOAT = b'G'
BINGET = b'h'
BININT = b'J'
BININT1 = b'K'
BININT2 = b'M'
BINPERSID = b'Q'
BINPUT = b'q'
BINSTRING = b'T'
BINUNICODE = b'X'
BINUNICODE8 = b'\x8d'
BUILD = b'b'
BYTEARRAY8 = b'\x96'
DEFAULT_PROTOCOL = 4
DICT = b'd'
DUP = b'2'
EMPTY_DICT = b'}'
EMPTY_LIST = b']'
EMPTY_SET = b'\x8f'
EMPTY_TUPLE = b')'
EXT1 = b'\x82'
EXT2 = b'\x83'
EXT4 = b'\x84'
FALSE = b'I00\n'
FLOAT = b'F'
FRAME = b'\x95'
FROZENSET = b'\x91'
GET = b'g'
GLOBAL = b'c'
HIGHEST_PROTOCOL = 5
INST = b'i'
INT = b'I'
LIST = b'l'
LONG = b'L'
LONG1 = b'\x8a'
LONG4 = b'\x8b'
LONG_BINGET = b'j'
LONG_BINPUT = b'r'
MARK = b'('
MEMOIZE = b'\x94'
NEWFALSE = b'\x89'
NEWOBJ = b'\x81'
NEWOBJ_EX = b'\x92'
NEWTRUE = b'\x88'
NEXT_BUFFER = b'\x97'
NONE = b'N'
OBJ = b'o'
PERSID = b'P'
POP = b'0'
POP_MARK = b'1'
PROTO = b'\x80'
PUT = b'p'
READONLY_BUFFER = b'\x98'
REDUCE = b'R'
SETITEM = b's'
SETITEMS = b'u'
SHORT_BINBYTES = b'C'
SHORT_BINSTRING = b'U'
SHORT_BINUNICODE = b'\x8c'
STACK_GLOBAL = b'\x93'
STOP = b'.'
STRING = b'S'
TRUE = b'I01\n'
TUPLE = b't'
TUPLE1 = b'\x85'
TUPLE2 = b'\x86'
TUPLE3 = b'\x87'
UNICODE = b'V'
__all__ = ['PickleError', 'PicklingError', 'UnpicklingError', 'Pickler...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\pickle.py
logging.handlers.queue
Python Library Documentation: module queue
NAME
queue - A multi-producer, multi-consumer queue.
MODULE REFERENCE
https://docs.python.org/3.12/library/queue.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.Exception(builtins.BaseException)
_queue.Empty
Full
builtins.object
_queue.SimpleQueue
Queue
LifoQueue
PriorityQueue
class Empty(builtins.Exception)
| Exception raised by Queue.get(block=0)/get_nowait().
|
| Method resolution order:
| Empty
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Full(builtins.Exception)
| Exception raised by Queue.put(block=0)/put_nowait().
|
| Method resolution order:
| Full
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class LifoQueue(Queue)
| LifoQueue(maxsize=0)
|
| Variant of Queue that retrieves most recently added entries first.
|
| Method resolution order:
| LifoQueue
| Queue
| builtins.object
|
| Methods inherited from Queue:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods inherited from Queue:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Queue:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class PriorityQueue(Queue)
| PriorityQueue(maxsize=0)
|
| Variant of Queue that retrieves open entries in priority order (lowest first).
|
| Entries are typically tuples of the form: (priority number, data).
|
| Method resolution order:
| PriorityQueue
| Queue
| builtins.object
|
| Methods inherited from Queue:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods inherited from Queue:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Queue:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Queue(builtins.object)
| Queue(maxsize=0)
|
| Create a queue object with a given maximum size.
|
| If maxsize is <= 0, the queue size is infinite.
|
| Methods defined here:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SimpleQueue(builtins.object)
| Simple, unbounded, reentrant FIFO queue.
|
| Methods defined here:
|
| empty(self, /)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| get(self, /, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self, /)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| put(self, /, item, block=True, timeout=None)
| Put the item on the queue.
|
| The optional 'block' and 'timeout' arguments are ignored, as this method
| never blocks. They are provided for compatibility with the Queue class.
|
| put_nowait(self, /, item)
| Put an item into the queue without blocking.
|
| This is exactly equivalent to `put(item)` and is only provided
| for compatibility with the Queue class.
|
| qsize(self, /)
| Return the approximate size of the queue (not reliable!).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
DATA
__all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue', 'Si...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\queue.py
logging.handlers.re
Python Library Documentation: package re
NAME
re - Support for regular expressions (RE).
MODULE REFERENCE
https://docs.python.org/3.12/library/re.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?aiLmsux) The letters set the corresponding flags defined below.
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
The special sequences consist of "\\" and a character from the list
below. If the ordinary character is not on the list, then the
resulting RE will match the second character.
\number Matches the contents of the group of the same number.
\A Matches only at the start of the string.
\Z Matches only at the end of the string.
\b Matches the empty string, but only at the start or end of a word.
\B Matches the empty string, but not at the start or end of a word.
\d Matches any decimal digit; equivalent to the set [0-9] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode digits.
\D Matches any non-digit character; equivalent to [^\d].
\s Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode whitespace characters.
\S Matches any non-whitespace character; equivalent to [^\s].
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the
range of Unicode alphanumeric characters (letters plus digits
plus underscore).
With LOCALE, it will match the set [0-9_] plus characters defined
as letters for the current locale.
\W Matches the complement of \w.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern to the beginning of a string.
fullmatch Match a regular expression pattern to all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string.
subn Same as sub, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a Match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics in a string.
Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
A ASCII For string patterns, make \w, \W, \b, \B, \d, \D
match the corresponding ASCII character categories
(rather than the whole Unicode categories, which is the
default).
For bytes patterns, this flag is the only available
behaviour and needn't be specified.
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE For compatibility only. Ignored for string patterns (it
is the default), and forbidden for bytes patterns.
This module also defines an exception 'error'.
PACKAGE CONTENTS
_casefix
_compiler
_constants
_parser
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
Match
Pattern
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
RegexFlag
class Match(builtins.object)
| The result of re.match() and re.search().
| Match objects always have a boolean value of True.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __getitem__(self, key, /)
| Return self[key].
|
| __repr__(self, /)
| Return repr(self).
|
| end(self, group=0, /)
| Return index of the end of the substring matched by group.
|
| expand(self, /, template)
| Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
|
| group(...)
| group([group1, ...]) -> str or tuple.
| Return subgroup(s) of the match by indices or names.
| For 0 returns the entire match.
|
| groupdict(self, /, default=None)
| Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
|
| default
| Is used for groups that did not participate in the match.
|
| groups(self, /, default=None)
| Return a tuple containing all the subgroups of the match, from 1.
|
| default
| Is used for groups that did not participate in the match.
|
| span(self, group=0, /)
| For match object m, return the 2-tuple (m.start(group), m.end(group)).
|
| start(self, group=0, /)
| Return index of the start of the substring matched by group.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| endpos
| The index into the string beyond which the RE engine will not go.
|
| lastgroup
| The name of the last matched capturing group.
|
| lastindex
| The integer index of the last matched capturing group.
|
| pos
| The index into the string at which the RE engine started looking for a match.
|
| re
| The regular expression object.
|
| regs
|
| string
| The string passed to match() or search().
class Pattern(builtins.object)
| Compiled regular expression object.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| findall(self, /, string, pos=0, endpos=9223372036854775807)
| Return a list of all non-overlapping matches of pattern in string.
|
| finditer(self, /, string, pos=0, endpos=9223372036854775807)
| Return an iterator over all non-overlapping matches for the RE pattern in string.
|
| For each match, the iterator returns a match object.
|
| fullmatch(self, /, string, pos=0, endpos=9223372036854775807)
| Matches against all of the string.
|
| match(self, /, string, pos=0, endpos=9223372036854775807)
| Matches zero or more characters at the beginning of the string.
|
| scanner(self, /, string, pos=0, endpos=9223372036854775807)
|
| search(self, /, string, pos=0, endpos=9223372036854775807)
| Scan through string looking for a match, and return a corresponding match object instance.
|
| Return None if no position in the string matches.
|
| split(self, /, string, maxsplit=0)
| Split string by the occurrences of pattern.
|
| sub(self, /, repl, string, count=0)
| Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
|
| subn(self, /, repl, string, count=0)
| Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| flags
| The regex matching flags.
|
| groupindex
| A dictionary mapping group names to group numbers.
|
| groups
| The number of capturing groups in the pattern.
|
| pattern
| The pattern string from which the RE object was compiled.
class RegexFlag(enum.IntFlag)
| RegexFlag(*values)
|
| An enumeration.
|
| Method resolution order:
| RegexFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __repr__ = global_flag_repr(self) from enum
| use module.flag_name instead of class.flag_name
|
| the module is the last module in case of a multi-module name
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __str__(self, /) from builtins.object
| Return str(self).
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII = re.ASCII
|
| DEBUG = re.DEBUG
|
| DOTALL = re.DOTALL
|
| IGNORECASE = re.IGNORECASE
|
| LOCALE = re.LOCALE
|
| MULTILINE = re.MULTILINE
|
| TEMPLATE = re.TEMPLATE
|
| UNICODE = re.UNICODE
|
| VERBOSE = re.VERBOSE
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class error(builtins.Exception)
| error(msg, pattern=None, pos=None)
|
| Exception raised for invalid regular expressions.
|
| Attributes:
|
| msg: The unformatted error message
| pattern: The regular expression pattern
| pos: The index in the pattern where compilation failed (may be None)
| lineno: The line corresponding to pos (may be None)
| colno: The column corresponding to pos (may be None)
|
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg, pattern=None, pos=None) from re._constants.error
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
compile(pattern, flags=0)
Compile a regular expression pattern, returning a Pattern object.
escape(pattern)
Escape special characters in a string.
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a Match object.
Empty matches are included in the result.
fullmatch(pattern, string, flags=0)
Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found.
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a Match object, or None if no match was found.
purge()
Clear the regular expression caches
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning
a Match object, or None if no match was found.
split(pattern, string, maxsplit=0, flags=0)
Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. If
capturing parentheses are used in pattern, then the text of all
groups in the pattern are also returned as part of the resulting
list. If maxsplit is nonzero, at most maxsplit splits occur,
and the remainder of the string is returned as the final element
of the list.
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used.
subn(pattern, repl, string, count=0, flags=0)
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl. number is the number of
substitutions that were made. repl can be either a string or a
callable; if a string, backslash escapes in it are processed.
If it is a callable, it's passed the Match object and must
return a replacement string to be used.
template(pattern, flags=0)
Compile a template pattern, returning a Pattern object, deprecated
DATA
A = re.ASCII
ASCII = re.ASCII
DOTALL = re.DOTALL
I = re.IGNORECASE
IGNORECASE = re.IGNORECASE
L = re.LOCALE
LOCALE = re.LOCALE
M = re.MULTILINE
MULTILINE = re.MULTILINE
NOFLAG = re.NOFLAG
S = re.DOTALL
U = re.UNICODE
UNICODE = re.UNICODE
VERBOSE = re.VERBOSE
X = re.VERBOSE
__all__ = ['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'fi...
VERSION
2.2.1
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\re\__init__.py
logging.handlers.socket
Python Library Documentation: module socket
NAME
socket
MODULE REFERENCE
https://docs.python.org/3.12/library/socket.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.
Functions:
socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
send_fds() -- Send file descriptor to the socket.
recv_fds() -- Receive file descriptors from the socket.
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
optional source address.
create_server() -- create a TCP socket and bind it to a specified address.
[*] not available on all platforms!
Special objects:
SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported
IntEnum constants:
AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
Integer constants:
Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.TimeoutError
gaierror
herror
builtins.object
_socket.socket
socket
enum.IntEnum(builtins.int, enum.ReprEnum)
AddressFamily
SocketKind
class AddressFamily(enum.IntEnum)
| AddressFamily(*values)
|
| An enumeration.
|
| Method resolution order:
| AddressFamily
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| AF_APPLETALK = <AddressFamily.AF_APPLETALK: 16>
|
| AF_BLUETOOTH = <AddressFamily.AF_BLUETOOTH: 32>
|
| AF_HYPERV = <AddressFamily.AF_HYPERV: 34>
|
| AF_INET = <AddressFamily.AF_INET: 2>
|
| AF_INET6 = <AddressFamily.AF_INET6: 23>
|
| AF_IPX = <AddressFamily.AF_IPX: 6>
|
| AF_IRDA = <AddressFamily.AF_IRDA: 26>
|
| AF_LINK = <AddressFamily.AF_LINK: 33>
|
| AF_SNA = <AddressFamily.AF_SNA: 11>
|
| AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class SocketKind(enum.IntEnum)
| SocketKind(*values)
|
| An enumeration.
|
| Method resolution order:
| SocketKind
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| SOCK_DGRAM = <SocketKind.SOCK_DGRAM: 2>
|
| SOCK_RAW = <SocketKind.SOCK_RAW: 3>
|
| SOCK_RDM = <SocketKind.SOCK_RDM: 4>
|
| SOCK_SEQPACKET = <SocketKind.SOCK_SEQPACKET: 5>
|
| SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
SocketType = class socket(builtins.object)
| socket(family=AF_INET, type=SOCK_STREAM, proto=0) -> socket object
| socket(family=-1, type=-1, proto=-1, fileno=None) -> socket object
|
| Open a socket of the given type. The family argument specifies the
| address family; it defaults to AF_INET. The type argument specifies
| whether this is a stream (SOCK_STREAM, this is the default)
| or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0,
| specifying the default protocol. Keyword arguments are accepted.
| The socket is created as non-inheritable.
|
| When a fileno is passed in, family, type and proto are auto-detected,
| unless they are explicitly set.
|
| A socket object represents one endpoint of a network connection.
|
| Methods of socket objects (keyword arguments not allowed):
|
| _accept() -- accept connection, returning new socket fd and client address
| bind(addr) -- bind the socket to a local address
| close() -- close the socket
| connect(addr) -- connect the socket to a remote address
| connect_ex(addr) -- connect, return an error code instead of an exception
| dup() -- return a new socket fd duplicated from fileno()
| fileno() -- return underlying file descriptor
| getpeername() -- return remote address [*]
| getsockname() -- return local address
| getsockopt(level, optname[, buflen]) -- get socket options
| gettimeout() -- return timeout or None
| listen([n]) -- start listening for incoming connections
| recv(buflen[, flags]) -- receive data
| recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)
| recvfrom(buflen[, flags]) -- receive data and sender's address
| recvfrom_into(buffer[, nbytes, [, flags])
| -- receive data and sender's address (into a buffer)
| sendall(data[, flags]) -- send all data
| send(data[, flags]) -- send data, may not send all of it
| sendto(data[, flags], addr) -- send data to a given address
| setblocking(bool) -- set or clear the blocking I/O flag
| getblocking() -- return True if socket is blocking, False if non-blocking
| setsockopt(level, optname, value[, optlen]) -- set socket options
| settimeout(None | float) -- set or clear the timeout
| shutdown(how) -- shut down traffic in one or both directions
|
| [*] not available on all platforms!
|
| Methods defined here:
|
| __del__(...)
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self, /)
| Return repr(self).
|
| bind(...)
| bind(address)
|
| Bind the socket to a local address. For IP sockets, the address is a
| pair (host, port); the host must refer to the local host. For raw packet
| sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]])
|
| close(...)
| close()
|
| Close the socket. It cannot be used after this call.
|
| connect(...)
| connect(address)
|
| Connect the socket to a remote address. For IP sockets, the address
| is a pair (host, port).
|
| connect_ex(...)
| connect_ex(address) -> errno
|
| This is like connect(address), but returns an error code (the errno value)
| instead of raising an exception when an error occurs.
|
| detach(...)
| detach()
|
| Close the socket object without closing the underlying file descriptor.
| The object cannot be used after this call, but the file descriptor
| can be reused for other purposes. The file descriptor is returned.
|
| fileno(...)
| fileno() -> integer
|
| Return the integer file descriptor of the socket.
|
| getblocking(...)
| getblocking()
|
| Returns True if socket is in blocking mode, or False if it
| is in non-blocking mode.
|
| getpeername(...)
| getpeername() -> address info
|
| Return the address of the remote endpoint. For IP sockets, the address
| info is a pair (hostaddr, port).
|
| getsockname(...)
| getsockname() -> address info
|
| Return the address of the local endpoint. The format depends on the
| address family. For IPv4 sockets, the address info is a pair
| (hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
| (hostaddr, port, flowinfo, scope_id).
|
| getsockopt(...)
| getsockopt(level, option[, buffersize]) -> value
|
| Get a socket option. See the Unix manual for level and option.
| If a nonzero buffersize argument is given, the return value is a
| string of that length; otherwise it is an integer.
|
| gettimeout(...)
| gettimeout() -> timeout
|
| Returns the timeout in seconds (float) associated with socket
| operations. A timeout of None indicates that timeouts on socket
| operations are disabled.
|
| ioctl(...)
| ioctl(cmd, option) -> long
|
| Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are
| SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.
| SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).
| SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default
|
| listen(...)
| listen([backlog])
|
| Enable a server to accept connections. If backlog is specified, it must be
| at least 0 (if it is lower, it is set to 0); it specifies the number of
| unaccepted connections that the system will allow before refusing new
| connections. If not specified, a default reasonable value is chosen.
|
| recv(...)
| recv(buffersize[, flags]) -> data
|
| Receive up to buffersize bytes from the socket. For the optional flags
| argument, see the Unix manual. When no data is available, block until
| at least one byte is available or until the remote end is closed. When
| the remote end is closed and all data is read, return the empty string.
|
| recv_into(...)
| recv_into(buffer, [nbytes[, flags]]) -> nbytes_read
|
| A version of recv() that stores its data into a buffer rather than creating
| a new string. Receive up to buffersize bytes from the socket. If buffersize
| is not specified (or 0), receive up to the size available in the given buffer.
|
| See recv() for documentation about the flags.
|
| recvfrom(...)
| recvfrom(buffersize[, flags]) -> (data, address info)
|
| Like recv(buffersize, flags) but also return the sender's address info.
|
| recvfrom_into(...)
| recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
|
| Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
|
| send(...)
| send(data[, flags]) -> count
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. Return the number of bytes
| sent; this may be less than len(data) if the network is busy.
|
| sendall(...)
| sendall(data[, flags])
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. This calls send() repeatedly
| until all data is sent. If an error occurs, it's impossible
| to tell how much data has been sent.
|
| sendto(...)
| sendto(data[, flags], address) -> count
|
| Like send(data, flags) but allows specifying the destination address.
| For IP sockets, the address is a pair (hostaddr, port).
|
| setblocking(...)
| setblocking(flag)
|
| Set the socket to blocking (flag is true) or non-blocking (false).
| setblocking(True) is equivalent to settimeout(None);
| setblocking(False) is equivalent to settimeout(0.0).
|
| setsockopt(...)
| setsockopt(level, option, value: int)
| setsockopt(level, option, value: buffer)
| setsockopt(level, option, None, optlen: int)
|
| Set a socket option. See the Unix manual for level and option.
| The value argument can either be an integer, a string buffer, or
| None, optlen.
|
| settimeout(...)
| settimeout(timeout)
|
| Set a timeout on socket operations. 'timeout' can be a float,
| giving in seconds, or None. Setting a timeout of None disables
| the timeout feature and is equivalent to setblocking(1).
| Setting a timeout of zero is the same as setblocking(0).
|
| share(...)
| share(process_id) -> bytes
|
| Share the socket with another process. The target process id
| must be provided and the resulting bytes object passed to the target
| process. There the shared socket can be instantiated by calling
| socket.fromshare().
|
| shutdown(...)
| shutdown(flag)
|
| Shut down the reading side of the socket (flag == SHUT_RD), the writing side
| of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| family
| the socket family
|
| proto
| the socket protocol
|
| timeout
| the socket timeout
|
| type
| the socket type
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class gaierror(builtins.OSError)
| Method resolution order:
| gaierror
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class herror(builtins.OSError)
| Method resolution order:
| herror
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class socket(_socket.socket)
| socket(family=-1, type=-1, proto=-1, fileno=None)
|
| A subclass of _socket.socket adding the makefile() method.
|
| Method resolution order:
| socket
| _socket.socket
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __getstate__(self)
| Helper for pickle.
|
| __init__(self, family=-1, type=-1, proto=-1, fileno=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Wrap __repr__() to reveal the real class name and socket
| address(es).
|
| accept(self)
| accept() -> (socket object, address info)
|
| Wait for an incoming connection. Return a new socket
| representing the connection, and the address of the client.
| For IP sockets, the address info is a pair (hostaddr, port).
|
| close(self)
| close()
|
| Close the socket. It cannot be used after this call.
|
| detach(self)
| detach() -> file descriptor
|
| Close the socket object without closing the underlying file descriptor.
| The object cannot be used after this call, but the file descriptor
| can be reused for other purposes. The file descriptor is returned.
|
| dup(self)
| dup() -> socket object
|
| Duplicate the socket. Return a new socket object connected to the same
| system resource. The new socket is non-inheritable.
|
| get_inheritable(self)
| Get the inheritable flag of the socket
|
| makefile(self, mode='r', buffering=None, *, encoding=None, errors=None, newline=None)
| makefile(...) -> an I/O stream connected to the socket
|
| The arguments are as for io.open() after the filename, except the only
| supported mode values are 'r' (default), 'w', 'b', or a combination of
| those.
|
| sendfile(self, file, offset=0, count=None)
| sendfile(file[, offset[, count]]) -> sent
|
| Send a file until EOF is reached by using high-performance
| os.sendfile() and return the total number of bytes which
| were sent.
| *file* must be a regular file object opened in binary mode.
| If os.sendfile() is not available (e.g. Windows) or file is
| not a regular file socket.send() will be used instead.
| *offset* tells from where to start reading the file.
| If specified, *count* is the total number of bytes to transmit
| as opposed to sending the file until EOF is reached.
| File position is updated on return or also in case of error in
| which case file.tell() can be used to figure out the number of
| bytes which were sent.
| The socket must be of SOCK_STREAM type.
| Non-blocking sockets are not supported.
|
| set_inheritable(self, inheritable)
| Set the inheritable flag of the socket
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| family
| Read-only access to the address family for this socket.
|
| type
| Read-only access to the socket type.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from _socket.socket:
|
| __del__(...)
|
| bind(...)
| bind(address)
|
| Bind the socket to a local address. For IP sockets, the address is a
| pair (host, port); the host must refer to the local host. For raw packet
| sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]])
|
| connect(...)
| connect(address)
|
| Connect the socket to a remote address. For IP sockets, the address
| is a pair (host, port).
|
| connect_ex(...)
| connect_ex(address) -> errno
|
| This is like connect(address), but returns an error code (the errno value)
| instead of raising an exception when an error occurs.
|
| fileno(...)
| fileno() -> integer
|
| Return the integer file descriptor of the socket.
|
| getblocking(...)
| getblocking()
|
| Returns True if socket is in blocking mode, or False if it
| is in non-blocking mode.
|
| getpeername(...)
| getpeername() -> address info
|
| Return the address of the remote endpoint. For IP sockets, the address
| info is a pair (hostaddr, port).
|
| getsockname(...)
| getsockname() -> address info
|
| Return the address of the local endpoint. The format depends on the
| address family. For IPv4 sockets, the address info is a pair
| (hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
| (hostaddr, port, flowinfo, scope_id).
|
| getsockopt(...)
| getsockopt(level, option[, buffersize]) -> value
|
| Get a socket option. See the Unix manual for level and option.
| If a nonzero buffersize argument is given, the return value is a
| string of that length; otherwise it is an integer.
|
| gettimeout(...)
| gettimeout() -> timeout
|
| Returns the timeout in seconds (float) associated with socket
| operations. A timeout of None indicates that timeouts on socket
| operations are disabled.
|
| ioctl(...)
| ioctl(cmd, option) -> long
|
| Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are
| SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.
| SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).
| SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default
|
| listen(...)
| listen([backlog])
|
| Enable a server to accept connections. If backlog is specified, it must be
| at least 0 (if it is lower, it is set to 0); it specifies the number of
| unaccepted connections that the system will allow before refusing new
| connections. If not specified, a default reasonable value is chosen.
|
| recv(...)
| recv(buffersize[, flags]) -> data
|
| Receive up to buffersize bytes from the socket. For the optional flags
| argument, see the Unix manual. When no data is available, block until
| at least one byte is available or until the remote end is closed. When
| the remote end is closed and all data is read, return the empty string.
|
| recv_into(...)
| recv_into(buffer, [nbytes[, flags]]) -> nbytes_read
|
| A version of recv() that stores its data into a buffer rather than creating
| a new string. Receive up to buffersize bytes from the socket. If buffersize
| is not specified (or 0), receive up to the size available in the given buffer.
|
| See recv() for documentation about the flags.
|
| recvfrom(...)
| recvfrom(buffersize[, flags]) -> (data, address info)
|
| Like recv(buffersize, flags) but also return the sender's address info.
|
| recvfrom_into(...)
| recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
|
| Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
|
| send(...)
| send(data[, flags]) -> count
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. Return the number of bytes
| sent; this may be less than len(data) if the network is busy.
|
| sendall(...)
| sendall(data[, flags])
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. This calls send() repeatedly
| until all data is sent. If an error occurs, it's impossible
| to tell how much data has been sent.
|
| sendto(...)
| sendto(data[, flags], address) -> count
|
| Like send(data, flags) but allows specifying the destination address.
| For IP sockets, the address is a pair (hostaddr, port).
|
| setblocking(...)
| setblocking(flag)
|
| Set the socket to blocking (flag is true) or non-blocking (false).
| setblocking(True) is equivalent to settimeout(None);
| setblocking(False) is equivalent to settimeout(0.0).
|
| setsockopt(...)
| setsockopt(level, option, value: int)
| setsockopt(level, option, value: buffer)
| setsockopt(level, option, None, optlen: int)
|
| Set a socket option. See the Unix manual for level and option.
| The value argument can either be an integer, a string buffer, or
| None, optlen.
|
| settimeout(...)
| settimeout(timeout)
|
| Set a timeout on socket operations. 'timeout' can be a float,
| giving in seconds, or None. Setting a timeout of None disables
| the timeout feature and is equivalent to setblocking(1).
| Setting a timeout of zero is the same as setblocking(0).
|
| share(...)
| share(process_id) -> bytes
|
| Share the socket with another process. The target process id
| must be provided and the resulting bytes object passed to the target
| process. There the shared socket can be instantiated by calling
| socket.fromshare().
|
| shutdown(...)
| shutdown(flag)
|
| Shut down the reading side of the socket (flag == SHUT_RD), the writing side
| of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
|
| ----------------------------------------------------------------------
| Static methods inherited from _socket.socket:
|
| __new__(*args, **kwargs) class method of _socket.socket
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _socket.socket:
|
| proto
| the socket protocol
|
| timeout
| the socket timeout
timeout = class TimeoutError(OSError)
| Timeout expired.
|
| Method resolution order:
| TimeoutError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
close(...)
close(integer) -> None
Close an integer socket file descriptor. This is like os.close(), but for
sockets; on some platforms os.close() won't work for socket file descriptors.
create_connection(address, timeout=<object object at 0x00000172058C8A30>, source_address=None, *, all_errors=False)
Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
A host of '' or port 0 tells the OS to use the default. When a connection
cannot be created, raises the last error if *all_errors* is False,
and an ExceptionGroup of all errors if *all_errors* is True.
create_server(address, *, family=<AddressFamily.AF_INET: 2>, backlog=None, reuse_port=False, dualstack_ipv6=False)
Convenience function which creates a SOCK_STREAM type socket
bound to *address* (a 2-tuple (host, port)) and return the socket
object.
*family* should be either AF_INET or AF_INET6.
*backlog* is the queue size passed to socket.listen().
*reuse_port* dictates whether to use the SO_REUSEPORT socket option.
*dualstack_ipv6*: if true and the platform supports it, it will
create an AF_INET6 socket able to accept both IPv4 or IPv6
connections. When false it will explicitly disable this option on
platforms that enable it by default (e.g. Linux).
>>> with create_server(('', 8000)) as server:
... while True:
... conn, addr = server.accept()
... # handle new connection
dup(...)
dup(integer) -> integer
Duplicate an integer socket file descriptor. This is like os.dup(), but for
sockets; on some platforms os.dup() won't work for socket file descriptors.
fromfd(fd, family, type, proto=0)
fromfd(fd, family, type[, proto]) -> socket object
Create a socket object from a duplicate of the given file
descriptor. The remaining arguments are the same as for socket().
fromshare(info)
fromshare(info) -> socket object
Create a socket object from the bytes object returned by
socket.share(pid).
getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)
Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string service name such as 'http', a numeric port number or
None. By passing None as the value of host and port, you can pass NULL to
the underlying C API.
The family, type and proto arguments can be optionally specified in order to
narrow the list of addresses returned. Passing zero as a value for each of
these arguments selects the full range of results.
getdefaulttimeout(...)
getdefaulttimeout() -> timeout
Returns the default timeout in seconds (float) for new socket objects.
A value of None indicates that new socket objects have no timeout.
When the socket module is first imported, the default is None.
getfqdn(name='')
Get fully qualified domain name from name.
An empty argument is interpreted as meaning the local host.
First the hostname returned by gethostbyaddr() is checked, then
possibly existing aliases. In case no FQDN is available and `name`
was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::',
hostname from gethostname() is returned.
gethostbyaddr(...)
gethostbyaddr(host) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
gethostbyname(...)
gethostbyname(host) -> address
Return the IP address (a string of the form '255.255.255.255') for a host.
gethostbyname_ex(...)
gethostbyname_ex(host) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
gethostname(...)
gethostname() -> string
Return the current host name.
getnameinfo(...)
getnameinfo(sockaddr, flags) --> (host, port)
Get host and port for a sockaddr.
getprotobyname(...)
getprotobyname(name) -> integer
Return the protocol number for the named protocol. (Rarely used.)
getservbyname(...)
getservbyname(servicename[, protocolname]) -> integer
Return a port number from a service name and protocol name.
The optional protocol name, if given, should be 'tcp' or 'udp',
otherwise any protocol will match.
getservbyport(...)
getservbyport(port[, protocolname]) -> string
Return the service name from a port number and protocol name.
The optional protocol name, if given, should be 'tcp' or 'udp',
otherwise any protocol will match.
has_dualstack_ipv6()
Return True if the platform supports creating a SOCK_STREAM socket
which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
htonl(...)
htonl(integer) -> integer
Convert a 32-bit integer from host to network byte order.
htons(...)
htons(integer) -> integer
Convert a 16-bit unsigned integer from host to network byte order.
if_indextoname(...)
if_indextoname(if_index)
Returns the interface name corresponding to the interface index if_index.
if_nameindex(...)
if_nameindex()
Returns a list of network interface information (index, name) tuples.
if_nametoindex(...)
if_nametoindex(if_name)
Returns the interface index corresponding to the interface name if_name.
inet_aton(...)
inet_aton(string) -> bytes giving packed 32-bit IP representation
Convert an IP address in string format (123.45.67.89) to the 32-bit packed
binary format used in low-level network functions.
inet_ntoa(...)
inet_ntoa(packed_ip) -> ip_address_string
Convert an IP address from 32-bit packed binary format to string format
inet_ntop(...)
inet_ntop(af, packed_ip) -> string formatted IP address
Convert a packed IP address of the given family to string format.
inet_pton(...)
inet_pton(af, ip) -> packed IP address string
Convert an IP address from string format to a packed string suitable
for use with low-level network functions.
ntohl(...)
ntohl(integer) -> integer
Convert a 32-bit integer from network to host byte order.
ntohs(...)
ntohs(integer) -> integer
Convert a 16-bit unsigned integer from network to host byte order.
setdefaulttimeout(...)
setdefaulttimeout(timeout)
Set the default timeout in seconds (float) for new socket objects.
A value of None indicates that new socket objects have no timeout.
When the socket module is first imported, the default is None.
socketpair = _fallback_socketpair(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=0)
socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
DATA
AF_APPLETALK = <AddressFamily.AF_APPLETALK: 16>
AF_BLUETOOTH = <AddressFamily.AF_BLUETOOTH: 32>
AF_DECnet = 12
AF_HYPERV = <AddressFamily.AF_HYPERV: 34>
AF_INET = <AddressFamily.AF_INET: 2>
AF_INET6 = <AddressFamily.AF_INET6: 23>
AF_IPX = <AddressFamily.AF_IPX: 6>
AF_IRDA = <AddressFamily.AF_IRDA: 26>
AF_LINK = <AddressFamily.AF_LINK: 33>
AF_SNA = <AddressFamily.AF_SNA: 11>
AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
AI_ADDRCONFIG = <AddressInfo.AI_ADDRCONFIG: 1024>
AI_ALL = <AddressInfo.AI_ALL: 256>
AI_CANONNAME = <AddressInfo.AI_CANONNAME: 2>
AI_NUMERICHOST = <AddressInfo.AI_NUMERICHOST: 4>
AI_NUMERICSERV = <AddressInfo.AI_NUMERICSERV: 8>
AI_PASSIVE = <AddressInfo.AI_PASSIVE: 1>
AI_V4MAPPED = <AddressInfo.AI_V4MAPPED: 2048>
BDADDR_ANY = '00:00:00:00:00:00'
BDADDR_LOCAL = '00:00:00:FF:FF:FF'
BTPROTO_RFCOMM = 3
CAPI = <capsule object "_socket.CAPI">
EAI_AGAIN = 11002
EAI_BADFLAGS = 10022
EAI_FAIL = 11003
EAI_FAMILY = 10047
EAI_MEMORY = 8
EAI_NODATA = 11001
EAI_NONAME = 11001
EAI_SERVICE = 10109
EAI_SOCKTYPE = 10044
HVSOCKET_ADDRESS_FLAG_PASSTHRU = 1
HVSOCKET_CONNECTED_SUSPEND = 4
HVSOCKET_CONNECT_TIMEOUT = 1
HVSOCKET_CONNECT_TIMEOUT_MAX = 300000
HV_GUID_BROADCAST = 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'
HV_GUID_CHILDREN = '90DB8B89-0D35-4F79-8CE9-49EA0AC8B7CD'
HV_GUID_LOOPBACK = 'E0E16197-DD56-4A10-9195-5EE7A155A838'
HV_GUID_PARENT = 'A42E7CDA-D03F-480C-9CC2-A4DE20ABB878'
HV_GUID_WILDCARD = '00000000-0000-0000-0000-000000000000'
HV_GUID_ZERO = '00000000-0000-0000-0000-000000000000'
HV_PROTOCOL_RAW = 1
INADDR_ALLHOSTS_GROUP = -536870911
INADDR_ANY = 0
INADDR_BROADCAST = -1
INADDR_LOOPBACK = 2130706433
INADDR_MAX_LOCAL_GROUP = -536870657
INADDR_NONE = -1
INADDR_UNSPEC_GROUP = -536870912
IPPORT_RESERVED = 1024
IPPORT_USERRESERVED = 5000
IPPROTO_AH = 51
IPPROTO_CBT = 7
IPPROTO_DSTOPTS = 60
IPPROTO_EGP = 8
IPPROTO_ESP = 50
IPPROTO_FRAGMENT = 44
IPPROTO_GGP = 3
IPPROTO_HOPOPTS = 0
IPPROTO_ICLFXBM = 78
IPPROTO_ICMP = 1
IPPROTO_ICMPV6 = 58
IPPROTO_IDP = 22
IPPROTO_IGMP = 2
IPPROTO_IGP = 9
IPPROTO_IP = 0
IPPROTO_IPV4 = 4
IPPROTO_IPV6 = 41
IPPROTO_L2TP = 115
IPPROTO_MAX = 256
IPPROTO_ND = 77
IPPROTO_NONE = 59
IPPROTO_PGM = 113
IPPROTO_PIM = 103
IPPROTO_PUP = 12
IPPROTO_RAW = 255
IPPROTO_RDP = 27
IPPROTO_ROUTING = 43
IPPROTO_SCTP = 132
IPPROTO_ST = 5
IPPROTO_TCP = 6
IPPROTO_UDP = 17
IPV6_CHECKSUM = 26
IPV6_DONTFRAG = 14
IPV6_HOPLIMIT = 21
IPV6_HOPOPTS = 1
IPV6_JOIN_GROUP = 12
IPV6_LEAVE_GROUP = 13
IPV6_MULTICAST_HOPS = 10
IPV6_MULTICAST_IF = 9
IPV6_MULTICAST_LOOP = 11
IPV6_PKTINFO = 19
IPV6_RECVRTHDR = 38
IPV6_RECVTCLASS = 40
IPV6_RTHDR = 32
IPV6_TCLASS = 39
IPV6_UNICAST_HOPS = 4
IPV6_V6ONLY = 27
IP_ADD_MEMBERSHIP = 12
IP_ADD_SOURCE_MEMBERSHIP = 15
IP_BLOCK_SOURCE = 17
IP_DROP_MEMBERSHIP = 13
IP_DROP_SOURCE_MEMBERSHIP = 16
IP_HDRINCL = 2
IP_MULTICAST_IF = 9
IP_MULTICAST_LOOP = 11
IP_MULTICAST_TTL = 10
IP_OPTIONS = 1
IP_PKTINFO = 19
IP_RECVDSTADDR = 25
IP_RECVTOS = 40
IP_TOS = 3
IP_TTL = 4
IP_UNBLOCK_SOURCE = 18
MSG_BCAST = <MsgFlag.MSG_BCAST: 1024>
MSG_CTRUNC = <MsgFlag.MSG_CTRUNC: 512>
MSG_DONTROUTE = <MsgFlag.MSG_DONTROUTE: 4>
MSG_ERRQUEUE = <MsgFlag.MSG_ERRQUEUE: 4096>
MSG_MCAST = <MsgFlag.MSG_MCAST: 2048>
MSG_OOB = <MsgFlag.MSG_OOB: 1>
MSG_PEEK = <MsgFlag.MSG_PEEK: 2>
MSG_TRUNC = <MsgFlag.MSG_TRUNC: 256>
MSG_WAITALL = <MsgFlag.MSG_WAITALL: 8>
NI_DGRAM = 16
NI_MAXHOST = 1025
NI_MAXSERV = 32
NI_NAMEREQD = 4
NI_NOFQDN = 1
NI_NUMERICHOST = 2
NI_NUMERICSERV = 8
RCVALL_MAX = 3
RCVALL_OFF = 0
RCVALL_ON = 1
RCVALL_SOCKETLEVELONLY = 2
SHUT_RD = 0
SHUT_RDWR = 2
SHUT_WR = 1
SIO_KEEPALIVE_VALS = 2550136836
SIO_LOOPBACK_FAST_PATH = 2550136848
SIO_RCVALL = 2550136833
SOCK_DGRAM = <SocketKind.SOCK_DGRAM: 2>
SOCK_RAW = <SocketKind.SOCK_RAW: 3>
SOCK_RDM = <SocketKind.SOCK_RDM: 4>
SOCK_SEQPACKET = <SocketKind.SOCK_SEQPACKET: 5>
SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
SOL_IP = 65531
SOL_SOCKET = 65535
SOL_TCP = 6
SOL_UDP = 17
SOMAXCONN = 2147483647
SO_ACCEPTCONN = 2
SO_BROADCAST = 32
SO_DEBUG = 1
SO_DONTROUTE = 16
SO_ERROR = 4103
SO_EXCLUSIVEADDRUSE = -5
SO_KEEPALIVE = 8
SO_LINGER = 128
SO_OOBINLINE = 256
SO_RCVBUF = 4098
SO_RCVLOWAT = 4100
SO_RCVTIMEO = 4102
SO_REUSEADDR = 4
SO_SNDBUF = 4097
SO_SNDLOWAT = 4099
SO_SNDTIMEO = 4101
SO_TYPE = 4104
SO_USELOOPBACK = 64
TCP_FASTOPEN = 15
TCP_KEEPCNT = 16
TCP_KEEPIDLE = 3
TCP_KEEPINTVL = 17
TCP_MAXSEG = 4
TCP_NODELAY = 1
__all__ = ['fromfd', 'getfqdn', 'create_connection', 'create_server', ...
errorTab = {6: 'Specified event object handle is invalid.', 8: 'Insuff...
has_ipv6 = True
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\socket.py
logging.handlers.struct
Python Library Documentation: module struct
NAME
struct
MODULE REFERENCE
https://docs.python.org/3.12/library/struct.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Functions to convert between Python values and C structs.
Python bytes objects are used to hold the data representing the C struct
and also as format strings (explained below) to describe the layout of data
in the C struct.
The optional first format char indicates byte order, size and alignment:
@: native order, size & alignment (default)
=: native order, std. size & alignment
<: little-endian, std. size & alignment
>: big-endian, std. size & alignment
!: same as >
The remaining chars indicate types of args and must match exactly;
these can be preceded by a decimal repeat count:
x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;
?: _Bool (requires C99; if not available, char is used instead)
h:short; H:unsigned short; i:int; I:unsigned int;
l:long; L:unsigned long; f:float; d:double; e:half-float.
Special cases (preceding decimal count indicates length):
s:string (array of char); p: pascal string (with count byte).
Special cases (only available in native format):
n:ssize_t; N:size_t;
P:an integer type that is wide enough to hold a pointer.
Special case (not in native mode unless 'long long' in platform C):
q:long long; Q:unsigned long long
Whitespace between formats is ignored.
The variable struct.error is an exception raised on errors.
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
_struct.Struct
class Struct(builtins.object)
| Struct(fmt) --> compiled struct object
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __sizeof__(...)
| S.__sizeof__() -> size of S in memory, in bytes
|
| iter_unpack(self, buffer, /)
| Return an iterator yielding tuples.
|
| Tuples are unpacked from the given bytes source, like a repeated
| invocation of unpack_from().
|
| Requires that the bytes length be a multiple of the struct size.
|
| pack(...)
| S.pack(v1, v2, ...) -> bytes
|
| Return a bytes object containing values v1, v2, ... packed according
| to the format string S.format. See help(struct) for more on format
| strings.
|
| pack_into(...)
| S.pack_into(buffer, offset, v1, v2, ...)
|
| Pack the values v1, v2, ... according to the format string S.format
| and write the packed bytes into the writable buffer buf starting at
| offset. Note that the offset is a required argument. See
| help(struct) for more on format strings.
|
| unpack(self, buffer, /)
| Return a tuple containing unpacked values.
|
| Unpack according to the format string Struct.format. The buffer's size
| in bytes must be Struct.size.
|
| See help(struct) for more on format strings.
|
| unpack_from(self, /, buffer, offset=0)
| Return a tuple containing unpacked values.
|
| Values are unpacked according to the format string Struct.format.
|
| The buffer's size in bytes, starting at position offset, must be
| at least Struct.size.
|
| See help(struct) for more on format strings.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| format
| struct format string
|
| size
| struct size in bytes
class error(builtins.Exception)
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
calcsize(format, /)
Return size in bytes of the struct described by the format string.
iter_unpack(format, buffer, /)
Return an iterator yielding tuples unpacked from the given bytes.
The bytes are unpacked according to the format string, like
a repeated invocation of unpack_from().
Requires that the bytes length be a multiple of the format struct size.
pack(...)
pack(format, v1, v2, ...) -> bytes
Return a bytes object containing the values v1, v2, ... packed according
to the format string. See help(struct) for more on format strings.
pack_into(...)
pack_into(format, buffer, offset, v1, v2, ...)
Pack the values v1, v2, ... according to the format string and write
the packed bytes into the writable buffer buf starting at offset. Note
that the offset is a required argument. See help(struct) for more
on format strings.
unpack(format, buffer, /)
Return a tuple containing values unpacked according to the format string.
The buffer's size in bytes must be calcsize(format).
See help(struct) for more on format strings.
unpack_from(format, /, buffer, offset=0)
Return a tuple containing values unpacked according to the format string.
The buffer's size, minus offset, must be at least calcsize(format).
See help(struct) for more on format strings.
DATA
__all__ = ['calcsize', 'pack', 'pack_into', 'unpack', 'unpack_from', '...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\struct.py
logging.handlers.threading
Python Library Documentation: module threading
NAME
threading - Thread module emulating a subset of Java's threading model.
MODULE REFERENCE
https://docs.python.org/3.12/library/threading.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.Exception(builtins.BaseException)
builtins.RuntimeError
BrokenBarrierError
builtins.object
_thread._local
Barrier
Condition
Event
Semaphore
BoundedSemaphore
Thread
Timer
builtins.tuple(builtins.object)
_thread._ExceptHookArgs
class Barrier(builtins.object)
| Barrier(parties, action=None, timeout=None)
|
| Implements a Barrier.
|
| Useful for synchronizing a fixed number of threads at known synchronization
| points. Threads block on 'wait()' and are simultaneously awoken once they
| have all made that call.
|
| Methods defined here:
|
| __init__(self, parties, action=None, timeout=None)
| Create a barrier, initialised to 'parties' threads.
|
| 'action' is a callable which, when supplied, will be called by one of
| the threads after they have all entered the barrier and just prior to
| releasing them all. If a 'timeout' is provided, it is used as the
| default for all subsequent 'wait()' calls.
|
| __repr__(self)
| Return repr(self).
|
| abort(self)
| Place the barrier into a 'broken' state.
|
| Useful in case of error. Any currently waiting threads and threads
| attempting to 'wait()' will have BrokenBarrierError raised.
|
| reset(self)
| Reset the barrier to the initial state.
|
| Any threads currently waiting will get the BrokenBarrier exception
| raised.
|
| wait(self, timeout=None)
| Wait for the barrier.
|
| When the specified number of threads have started waiting, they are all
| simultaneously awoken. If an 'action' was provided for the barrier, one
| of the threads will have executed that callback prior to returning.
| Returns an individual index number from 0 to 'parties-1'.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| broken
| Return True if the barrier is in a broken state.
|
| n_waiting
| Return the number of threads currently waiting at the barrier.
|
| parties
| Return the number of threads required to trip the barrier.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BoundedSemaphore(Semaphore)
| BoundedSemaphore(value=1)
|
| Implements a bounded semaphore.
|
| A bounded semaphore checks to make sure its current value doesn't exceed its
| initial value. If it does, ValueError is raised. In most situations
| semaphores are used to guard resources with limited capacity.
|
| If the semaphore is released too many times it's a sign of a bug. If not
| given, value defaults to 1.
|
| Like regular semaphores, bounded semaphores manage a counter representing
| the number of release() calls minus the number of acquire() calls, plus an
| initial value. The acquire() method blocks if necessary until it can return
| without making the counter negative. If not given, value defaults to 1.
|
| Method resolution order:
| BoundedSemaphore
| Semaphore
| builtins.object
|
| Methods defined here:
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| If the number of releases exceeds the number of acquires,
| raise a ValueError.
|
| ----------------------------------------------------------------------
| Methods inherited from Semaphore:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Semaphore:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BrokenBarrierError(builtins.RuntimeError)
| # exception raised by the Barrier class
|
| Method resolution order:
| BrokenBarrierError
| builtins.RuntimeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.RuntimeError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.RuntimeError:
|
| __new__(*args, **kwargs) class method of builtins.RuntimeError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Condition(builtins.object)
| Condition(lock=None)
|
| Class that implements a condition variable.
|
| A condition variable allows one or more threads to wait until they are
| notified by another thread.
|
| If the lock argument is given and not None, it must be a Lock or RLock
| object, and it is used as the underlying lock. Otherwise, a new RLock object
| is created and used as the underlying lock.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __init__(self, lock=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| notify(self, n=1)
| Wake up one or more threads waiting on this condition, if any.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method wakes up at most n of the threads waiting for the condition
| variable; it is a no-op if no threads are waiting.
|
| notifyAll(self)
| Wake up all threads waiting on this condition.
|
| This method is deprecated, use notify_all() instead.
|
| notify_all(self)
| Wake up all threads waiting on this condition.
|
| If the calling thread has not acquired the lock when this method
| is called, a RuntimeError is raised.
|
| wait(self, timeout=None)
| Wait until notified or until a timeout occurs.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method releases the underlying lock, and then blocks until it is
| awakened by a notify() or notify_all() call for the same condition
| variable in another thread, or until the optional timeout occurs. Once
| awakened or timed out, it re-acquires the lock and returns.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| When the underlying lock is an RLock, it is not released using its
| release() method, since this may not actually unlock the lock when it
| was acquired multiple times recursively. Instead, an internal interface
| of the RLock class is used, which really unlocks it even when it has
| been recursively acquired several times. Another internal interface is
| then used to restore the recursion level when the lock is reacquired.
|
| wait_for(self, predicate, timeout=None)
| Wait until a condition evaluates to True.
|
| predicate should be a callable which result will be interpreted as a
| boolean value. A timeout may be provided giving the maximum time to
| wait.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Event(builtins.object)
| Class implementing event objects.
|
| Events manage a flag that can be set to true with the set() method and reset
| to false with the clear() method. The wait() method blocks until the flag is
| true. The flag is initially false.
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| clear(self)
| Reset the internal flag to false.
|
| Subsequently, threads calling wait() will block until set() is called to
| set the internal flag to true again.
|
| isSet(self)
| Return true if and only if the internal flag is true.
|
| This method is deprecated, use is_set() instead.
|
| is_set(self)
| Return true if and only if the internal flag is true.
|
| set(self)
| Set the internal flag to true.
|
| All threads waiting for it to become true are awakened. Threads
| that call wait() once the flag is true will not block at all.
|
| wait(self, timeout=None)
| Block until the internal flag is true.
|
| If the internal flag is true on entry, return immediately. Otherwise,
| block until another thread calls set() to set the flag to true, or until
| the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| This method returns the internal flag on exit, so it will always return
| True except if a timeout is given and the operation times out.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
ExceptHookArgs = class _ExceptHookArgs(builtins.tuple)
| ExceptHookArgs(iterable=(), /)
|
| ExceptHookArgs
|
| Type used to pass arguments to threading.excepthook.
|
| Method resolution order:
| _ExceptHookArgs
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| exc_traceback
| Exception traceback
|
| exc_type
| Exception type
|
| exc_value
| Exception value
|
| thread
| Thread
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('exc_type', 'exc_value', 'exc_traceback', 'thread')
|
| n_fields = 4
|
| n_sequence_fields = 4
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class Semaphore(builtins.object)
| Semaphore(value=1)
|
| This class implements semaphore objects.
|
| Semaphores manage a counter representing the number of release() calls minus
| the number of acquire() calls, plus an initial value. The acquire() method
| blocks if necessary until it can return without making the counter
| negative. If not given, value defaults to 1.
|
| Methods defined here:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Thread(builtins.object)
| Thread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
|
| A class that represents a thread of control.
|
| This class can be safely subclassed in a limited fashion. There are two ways
| to specify the activity: by passing a callable object to the constructor, or
| by overriding the run() method in a subclass.
|
| Methods defined here:
|
| __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
ThreadError = class RuntimeError(Exception)
| Unspecified run-time error.
|
| Method resolution order:
| RuntimeError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| NotImplementedError
| RecursionError
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Timer(Thread)
| Timer(interval, function, args=None, kwargs=None)
|
| Call a function after a specified number of seconds:
|
| t = Timer(30.0, f, args=None, kwargs=None)
| t.start()
| t.cancel() # stop the timer's action if it's still waiting
|
| Method resolution order:
| Timer
| Thread
| builtins.object
|
| Methods defined here:
|
| __init__(self, interval, function, args=None, kwargs=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| cancel(self)
| Stop the timer if it hasn't finished yet.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| ----------------------------------------------------------------------
| Methods inherited from Thread:
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Thread:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Thread:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
local = class _local(builtins.object)
| Thread-local data
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
FUNCTIONS
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
Create a new lock object. See help(type(threading.Lock())) for
information about locks.
RLock(*args, **kwargs)
Factory function that returns a new reentrant lock.
A reentrant lock must be released by the thread that acquired it. Once a
thread has acquired a reentrant lock, the same thread may acquire it again
without blocking; the thread must release it once for each time it has
acquired it.
__excepthook__ = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
active_count()
Return the number of Thread objects currently alive.
The returned count is equal to the length of the list returned by
enumerate().
current_thread()
Return the current Thread object, corresponding to the caller's thread of control.
If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned.
enumerate()
Return a list of all Thread objects currently alive.
The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.
excepthook = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
get_ident(...)
get_ident() -> integer
Return a non-zero integer that uniquely identifies the current thread
amongst other threads that exist simultaneously.
This may be used to identify per-thread resources.
Even though on some platforms threads identities may appear to be
allocated consecutive numbers starting at 1, this behavior should not
be relied upon, and the number should be seen purely as a magic cookie.
A thread's identity may be reused for another thread after it exits.
get_native_id(...)
get_native_id() -> integer
Return a non-negative integer identifying the thread as reported
by the OS (kernel). This may be used to uniquely identify a
particular thread within a system.
getprofile()
Get the profiler function as set by threading.setprofile().
gettrace()
Get the trace function as set by threading.settrace().
main_thread()
Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started.
setprofile(func)
Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
setprofile_all_threads(func)
Set a profile function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
settrace(func)
Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
settrace_all_threads(func)
Set a trace function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
stack_size(...)
stack_size([size]) -> size
Return the thread stack size used when creating new threads. The
optional size argument specifies the stack size (in bytes) to be used
for subsequently created threads, and must be 0 (use platform or
configured default) or a positive integer value of at least 32,768 (32k).
If changing the thread stack size is unsupported, a ThreadError
exception is raised. If the specified size is invalid, a ValueError
exception is raised, and the stack size is unmodified. 32k bytes
currently the minimum supported stack size value to guarantee
sufficient stack space for the interpreter itself.
Note that some platforms may have particular restrictions on values for
the stack size, such as requiring a minimum stack size larger than 32 KiB or
requiring allocation in multiples of the system memory page size
- platform documentation should be referred to for more information
(4 KiB pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).
DATA
TIMEOUT_MAX = 4294967.0
__all__ = ['get_ident', 'active_count', 'Condition', 'current_thread',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\threading.py
logging.handlers.time
Python Library Documentation: built-in module time
NAME
time - This module provides various functions to manipulate time values.
DESCRIPTION
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating-point number (to represent fractions of seconds).
The epoch is the point where the time starts, the return value of time.gmtime(0).
It is January 1, 1970, 00:00:00 (UTC) on all platforms.
The other representation is a tuple of 9 integers giving local time.
The tuple items are:
year (including century, e.g. 1998)
month (1-12)
day (1-31)
hours (0-23)
minutes (0-59)
seconds (0-59)
weekday (0-6, Monday is 0)
Julian day (day in the year, 1-366)
DST (Daylight Savings Time) flag (-1, 0 or 1)
If the DST flag is 0, the time is given in the regular time zone;
if it is 1, the time is given in the DST time zone;
if it is -1, mktime() should guess based on the date and time.
CLASSES
builtins.tuple(builtins.object)
struct_time
class struct_time(builtins.tuple)
| struct_time(iterable=(), /)
|
| The time value as returned by gmtime(), localtime(), and strptime(), and
| accepted by asctime(), mktime() and strftime(). May be considered as a
| sequence of 9 integers.
|
| Note that several fields' values are not the same as those defined by
| the C language standard for struct tm. For example, the value of the
| field tm_year is the actual year, not year - 1900. See individual
| fields' descriptions for details.
|
| Method resolution order:
| struct_time
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| tm_gmtoff
| offset from UTC in seconds
|
| tm_hour
| hours, range [0, 23]
|
| tm_isdst
| 1 if summer time is in effect, 0 if not, and -1 if unknown
|
| tm_mday
| day of month, range [1, 31]
|
| tm_min
| minutes, range [0, 59]
|
| tm_mon
| month of year, range [1, 12]
|
| tm_sec
| seconds, range [0, 61])
|
| tm_wday
| day of week, range [0, 6], Monday is 0
|
| tm_yday
| day of year, range [1, 366]
|
| tm_year
| year, for example, 1993
|
| tm_zone
| abbreviation of timezone name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',...
|
| n_fields = 11
|
| n_sequence_fields = 9
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
asctime(...)
asctime([tuple]) -> string
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.
When the time tuple is not present, current time as returned by localtime()
is used.
ctime(...)
ctime(seconds) -> string
Convert a time in seconds since the Epoch to a string in local time.
This is equivalent to asctime(localtime(seconds)). When the time tuple is
not present, current time as returned by localtime() is used.
get_clock_info(...)
get_clock_info(name: str) -> dict
Get information of the specified clock.
gmtime(...)
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
tm_sec, tm_wday, tm_yday, tm_isdst)
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.
GMT). When 'seconds' is not passed in, convert the current time instead.
If the platform supports the tm_gmtoff and tm_zone, they are available as
attributes only.
localtime(...)
localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
tm_sec,tm_wday,tm_yday,tm_isdst)
Convert seconds since the Epoch to a time tuple expressing local time.
When 'seconds' is not passed in, convert the current time instead.
mktime(...)
mktime(tuple) -> floating-point number
Convert a time tuple in local time to seconds since the Epoch.
Note that mktime(gmtime(0)) will not generally return zero for most
time zones; instead the returned value will either be equal to that
of the timezone or altzone attributes on the time module.
monotonic(...)
monotonic() -> float
Monotonic clock, cannot go backward.
monotonic_ns(...)
monotonic_ns() -> int
Monotonic clock, cannot go backward, as nanoseconds.
perf_counter(...)
perf_counter() -> float
Performance counter for benchmarking.
perf_counter_ns(...)
perf_counter_ns() -> int
Performance counter for benchmarking as nanoseconds.
process_time(...)
process_time() -> float
Process time for profiling: sum of the kernel and user-space CPU time.
process_time_ns(...)
process_time() -> int
Process time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
sleep(...)
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating-point number for subsecond precision.
strftime(...)
strftime(format[, tuple]) -> string
Convert a time tuple to a string according to a format specification.
See the library reference manual for formatting codes. When the time tuple
is not present, current time as returned by localtime() is used.
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
strptime(...)
strptime(string, format) -> struct_time
Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as
strftime()).
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
thread_time(...)
thread_time() -> float
Thread time for profiling: sum of the kernel and user-space CPU time.
thread_time_ns(...)
thread_time() -> int
Thread time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
time(...)
time() -> floating-point number
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.
time_ns(...)
time_ns() -> int
Return the current time in nanoseconds since the Epoch.
DATA
altzone = -10800
daylight = 1
timezone = -7200
tzname = ('Egypt Standard Time', 'Egypt Daylight Time')
FILE
(built-in)
logging.config.BaseConfigurator
Python Library Documentation: class BaseConfigurator in module logging.config
class BaseConfigurator(builtins.object)
| BaseConfigurator(config)
|
| The configurator base class which defines some useful defaults.
|
| Methods defined here:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
logging.config.ConvertingDict
Python Library Documentation: class ConvertingDict in module logging.config class ConvertingDict(builtins.dict, ConvertingMixin) | A converting dictionary wrapper. | | Method resolution order: | ConvertingDict | builtins.dict | ConvertingMixin | builtins.object | | Methods defined here: | | __getitem__(self, key) | Return self[key]. | | get(self, key, default=None) | Return the value for key if key is in the dictionary, else default. | | pop(self, key, default=None) | D.pop(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. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.dict: | | __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. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __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. | | __len__(self, /) | Return len(self). | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __or__(self, value, /) | Return self|value. | | __repr__(self, /) | Return repr(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(...) | D.clear() -> None. Remove all items from D. | | copy(...) | D.copy() -> a shallow copy of D | | items(...) | D.items() -> a set-like object providing a view on D's items | | keys(...) | D.keys() -> a set-like object providing a view on D's keys | | 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(...) | D.update([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(...) | D.values() -> an object providing a view on D's values | | ---------------------------------------------------------------------- | Class methods inherited from builtins.dict: | | __class_getitem__(...) | See PEP 585 | | fromkeys(iterable, value=None, /) | Create a new dictionary with keys from iterable and values set to value. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.dict: | | __new__(*args, **kwargs) class method of builtins.dict | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes inherited from builtins.dict: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from ConvertingMixin: | | convert(self, value) | | convert_with_key(self, key, value, replace=True)
logging.config.ConvertingList
Python Library Documentation: class ConvertingList in module logging.config class ConvertingList(builtins.list, ConvertingMixin) | ConvertingList(iterable=(), /) | | A converting list wrapper. | | Method resolution order: | ConvertingList | builtins.list | ConvertingMixin | builtins.object | | Methods defined here: | | __getitem__(self, key) | Return self[index]. | | pop(self, idx=-1) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.list: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.list: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods inherited from builtins.list: | | __new__(*args, **kwargs) class method of builtins.list | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes inherited from builtins.list: | | __hash__ = None | | ---------------------------------------------------------------------- | Methods inherited from ConvertingMixin: | | convert(self, value) | | convert_with_key(self, key, value, replace=True)
logging.config.ConvertingMixin
Python Library Documentation: class ConvertingMixin in module logging.config class ConvertingMixin(builtins.object) | For ConvertingXXX's, this mixin class provides common functions | | Methods defined here: | | convert(self, value) | | convert_with_key(self, key, value, replace=True) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.config.ConvertingTuple
Python Library Documentation: class ConvertingTuple in module logging.config class ConvertingTuple(builtins.tuple, ConvertingMixin) | ConvertingTuple(iterable=(), /) | | A converting tuple wrapper. | | Method resolution order: | ConvertingTuple | builtins.tuple | ConvertingMixin | builtins.object | | Methods defined here: | | __getitem__(self, key) | Return self[key]. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | ---------------------------------------------------------------------- | Methods inherited from builtins.tuple: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __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. | | __repr__(self, /) | Return repr(self). | | __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 builtins.tuple: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods inherited from builtins.tuple: | | __new__(*args, **kwargs) class method of builtins.tuple | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from ConvertingMixin: | | convert(self, value) | | convert_with_key(self, key, value, replace=True) | | ---------------------------------------------------------------------- | Data descriptors inherited from ConvertingMixin: | | __weakref__ | list of weak references to the object
logging.config.DEFAULT_LOGGING_CONFIG_PORT
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.config.DictConfigurator
Python Library Documentation: class DictConfigurator in module logging.config
class DictConfigurator(BaseConfigurator)
| DictConfigurator(config)
|
| Configure logging using a dictionary-like object to describe the
| configuration.
|
| Method resolution order:
| DictConfigurator
| BaseConfigurator
| builtins.object
|
| Methods defined here:
|
| add_filters(self, filterer, filters)
| Add filters to a filterer from a list of names.
|
| add_handlers(self, logger, handlers)
| Add handlers to a logger from a list of names.
|
| common_logger_config(self, logger, config, incremental=False)
| Perform configuration which is common to root and non-root loggers.
|
| configure(self)
| Do the configuration.
|
| configure_filter(self, config)
| Configure a filter from a dictionary.
|
| configure_formatter(self, config)
| Configure a formatter from a dictionary.
|
| configure_handler(self, config)
| Configure a handler from a dictionary.
|
| configure_logger(self, name, config, incremental=False)
| Configure a non-root logger from a dictionary.
|
| configure_root(self, config, incremental=False)
| Configure a root logger from a dictionary.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseConfigurator:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods inherited from BaseConfigurator:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseConfigurator:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseConfigurator:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
logging.config.IDENTIFIER
Python Library Documentation: Pattern in module re object class Pattern(builtins.object) | Compiled regular expression object. | | Methods defined here: | | __copy__(self, /) | | __deepcopy__(self, memo, /) | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | findall(self, /, string, pos=0, endpos=9223372036854775807) | Return a list of all non-overlapping matches of pattern in string. | | finditer(self, /, string, pos=0, endpos=9223372036854775807) | Return an iterator over all non-overlapping matches for the RE pattern in string. | | For each match, the iterator returns a match object. | | fullmatch(self, /, string, pos=0, endpos=9223372036854775807) | Matches against all of the string. | | match(self, /, string, pos=0, endpos=9223372036854775807) | Matches zero or more characters at the beginning of the string. | | scanner(self, /, string, pos=0, endpos=9223372036854775807) | | search(self, /, string, pos=0, endpos=9223372036854775807) | Scan through string looking for a match, and return a corresponding match object instance. | | Return None if no position in the string matches. | | split(self, /, string, maxsplit=0) | Split string by the occurrences of pattern. | | sub(self, /, repl, string, count=0) | Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | | subn(self, /, repl, string, count=0) | Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Data descriptors defined here: | | flags | The regex matching flags. | | groupindex | A dictionary mapping group names to group numbers. | | groups | The number of capturing groups in the pattern. | | pattern | The pattern string from which the RE object was compiled.
logging.config.RESET_ERROR
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __repr__(self, /)
| Return repr(self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
logging.config.StreamRequestHandler
Python Library Documentation: class StreamRequestHandler in module socketserver class StreamRequestHandler(BaseRequestHandler) | StreamRequestHandler(request, client_address, server) | | Define self.rfile and self.wfile for stream sockets. | | Method resolution order: | StreamRequestHandler | BaseRequestHandler | builtins.object | | Methods defined here: | | finish(self) | | setup(self) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | disable_nagle_algorithm = False | | rbufsize = -1 | | timeout = None | | wbufsize = 0 | | ---------------------------------------------------------------------- | Methods inherited from BaseRequestHandler: | | __init__(self, request, client_address, server) | Initialize self. See help(type(self)) for accurate signature. | | handle(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseRequestHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
logging.config.ThreadingTCPServer
Python Library Documentation: class ThreadingTCPServer in module socketserver class ThreadingTCPServer(ThreadingMixIn, TCPServer) | ThreadingTCPServer(server_address, RequestHandlerClass, bind_and_activate=True) | | Method resolution order: | ThreadingTCPServer | ThreadingMixIn | TCPServer | BaseServer | builtins.object | | Methods inherited from ThreadingMixIn: | | process_request(self, request, client_address) | Start a new thread to process the request. | | process_request_thread(self, request, client_address) | Same as in BaseServer but as a thread. | | In addition, exception handling is done here. | | server_close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from ThreadingMixIn: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from ThreadingMixIn: | | block_on_close = True | | daemon_threads = False | | ---------------------------------------------------------------------- | Methods inherited from TCPServer: | | __init__(self, server_address, RequestHandlerClass, bind_and_activate=True) | Constructor. May be extended, do not override. | | close_request(self, request) | Called to clean up an individual request. | | fileno(self) | Return socket file number. | | Interface required by selector. | | get_request(self) | Get the request and client address from the socket. | | May be overridden. | | server_activate(self) | Called by constructor to activate the server. | | May be overridden. | | server_bind(self) | Called by constructor to bind the socket. | | May be overridden. | | shutdown_request(self, request) | Called to shutdown and close an individual request. | | ---------------------------------------------------------------------- | Data and other attributes inherited from TCPServer: | | address_family = <AddressFamily.AF_INET: 2> | | allow_reuse_address = False | | allow_reuse_port = False | | request_queue_size = 5 | | socket_type = <SocketKind.SOCK_STREAM: 1> | | ---------------------------------------------------------------------- | Methods inherited from BaseServer: | | __enter__(self) | | __exit__(self, *args) | | finish_request(self, request, client_address) | Finish one request by instantiating RequestHandlerClass. | | handle_error(self, request, client_address) | Handle an error gracefully. May be overridden. | | The default is to print a traceback and continue. | | handle_request(self) | Handle one request, possibly blocking. | | Respects self.timeout. | | handle_timeout(self) | Called if no new request arrives within self.timeout. | | Overridden by ForkingMixIn. | | serve_forever(self, poll_interval=0.5) | Handle one request at a time until shutdown. | | Polls for shutdown every poll_interval seconds. Ignores | self.timeout. If you need to do periodic tasks, do them in | another thread. | | service_actions(self) | Called by the serve_forever() loop. | | May be overridden by a subclass / Mixin to implement any code that | needs to be run during the loop. | | shutdown(self) | Stops the serve_forever loop. | | Blocks until the loop has finished. This must be called while | serve_forever() is running in another thread, or it will | deadlock. | | verify_request(self, request, client_address) | Verify the request. May be overridden. | | Return True if we should proceed with this request. | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseServer: | | timeout = None
logging.config.dictConfig
Python Library Documentation: function dictConfig in module logging.config
dictConfig(config)
Configure logging using a dictionary.
logging.config.dictConfigClass
Python Library Documentation: class DictConfigurator in module logging.config
class DictConfigurator(BaseConfigurator)
| DictConfigurator(config)
|
| Configure logging using a dictionary-like object to describe the
| configuration.
|
| Method resolution order:
| DictConfigurator
| BaseConfigurator
| builtins.object
|
| Methods defined here:
|
| add_filters(self, filterer, filters)
| Add filters to a filterer from a list of names.
|
| add_handlers(self, logger, handlers)
| Add handlers to a logger from a list of names.
|
| common_logger_config(self, logger, config, incremental=False)
| Perform configuration which is common to root and non-root loggers.
|
| configure(self)
| Do the configuration.
|
| configure_filter(self, config)
| Configure a filter from a dictionary.
|
| configure_formatter(self, config)
| Configure a formatter from a dictionary.
|
| configure_handler(self, config)
| Configure a handler from a dictionary.
|
| configure_logger(self, name, config, incremental=False)
| Configure a non-root logger from a dictionary.
|
| configure_root(self, config, incremental=False)
| Configure a root logger from a dictionary.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseConfigurator:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| as_tuple(self, value)
| Utility function which converts lists to tuples.
|
| cfg_convert(self, value)
| Default converter for the cfg:// protocol.
|
| configure_custom(self, config)
| Configure an object with a user-supplied factory.
|
| convert(self, value)
| Convert values to an appropriate type. dicts, lists and tuples are
| replaced by their converting alternatives. Strings are checked to
| see if they have a conversion format and are converted if they do.
|
| ext_convert(self, value)
| Default converter for the ext:// protocol.
|
| resolve(self, s)
| Resolve strings to objects using standard import and attribute
| syntax.
|
| ----------------------------------------------------------------------
| Static methods inherited from BaseConfigurator:
|
| importer = __import__(name, globals=None, locals=None, fromlist=(), level=0)
| Import a module.
|
| Because this function is meant for use by the Python
| interpreter and not for general use, it is better to use
| importlib.import_module() to programmatically import a module.
|
| The globals argument is only used to determine the context;
| they are not modified. The locals argument is unused. The fromlist
| should be a list of names to emulate ``from name import ...``, or an
| empty list to emulate ``import name``.
| When importing a module from a package, note that __import__('A.B', ...)
| returns package A when fromlist is empty, but its submodule B when
| fromlist is not empty. The level argument is used to determine whether to
| perform absolute or relative imports: 0 is absolute, while a positive number
| is the number of parent directories to search relative to the current module.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseConfigurator:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseConfigurator:
|
| CONVERT_PATTERN = re.compile('^(?P<prefix>[a-z]+)://(?P<suffix>.*)$')
|
| DIGIT_PATTERN = re.compile('^\\d+$')
|
| DOT_PATTERN = re.compile('^\\.\\s*(\\w+)\\s*')
|
| INDEX_PATTERN = re.compile('^\\[\\s*(\\w+)\\s*\\]\\s*')
|
| WORD_PATTERN = re.compile('^\\s*(\\w+)\\s*')
|
| value_converters = {'cfg': 'cfg_convert', 'ext': 'ext_convert'}
logging.config.errno
Python Library Documentation: built-in module errno
NAME
errno - This module makes available standard errno system symbols.
MODULE REFERENCE
https://docs.python.org/3.12/library/errno.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
The value of each symbol is the corresponding integer value,
e.g., on most systems, errno.ENOENT equals the integer 2.
The dictionary errno.errorcode maps numeric codes to symbol names,
e.g., errno.errorcode[2] could be the string 'ENOENT'.
Symbols that are not relevant to the underlying system are not defined.
To map error codes to error messages, use the function os.strerror(),
e.g. os.strerror(2) could return 'No such file or directory'.
DATA
E2BIG = 7
EACCES = 13
EADDRINUSE = 10048
EADDRNOTAVAIL = 10049
EAFNOSUPPORT = 10047
EAGAIN = 11
EALREADY = 10037
EBADF = 9
EBADMSG = 104
EBUSY = 16
ECANCELED = 105
ECHILD = 10
ECONNABORTED = 10053
ECONNREFUSED = 10061
ECONNRESET = 10054
EDEADLK = 36
EDEADLOCK = 36
EDESTADDRREQ = 10039
EDOM = 33
EDQUOT = 10069
EEXIST = 17
EFAULT = 14
EFBIG = 27
EHOSTDOWN = 10064
EHOSTUNREACH = 10065
EIDRM = 111
EILSEQ = 42
EINPROGRESS = 10036
EINTR = 4
EINVAL = 22
EIO = 5
EISCONN = 10056
EISDIR = 21
ELOOP = 10062
EMFILE = 24
EMLINK = 31
EMSGSIZE = 10040
ENAMETOOLONG = 38
ENETDOWN = 10050
ENETRESET = 10052
ENETUNREACH = 10051
ENFILE = 23
ENOBUFS = 10055
ENODATA = 120
ENODEV = 19
ENOENT = 2
ENOEXEC = 8
ENOLCK = 39
ENOLINK = 121
ENOMEM = 12
ENOMSG = 122
ENOPROTOOPT = 10042
ENOSPC = 28
ENOSR = 124
ENOSTR = 125
ENOSYS = 40
ENOTCONN = 10057
ENOTDIR = 20
ENOTEMPTY = 41
ENOTRECOVERABLE = 127
ENOTSOCK = 10038
ENOTSUP = 129
ENOTTY = 25
ENXIO = 6
EOPNOTSUPP = 10045
EOVERFLOW = 132
EOWNERDEAD = 133
EPERM = 1
EPFNOSUPPORT = 10046
EPIPE = 32
EPROTO = 134
EPROTONOSUPPORT = 10043
EPROTOTYPE = 10041
ERANGE = 34
EREMOTE = 10071
EROFS = 30
ESHUTDOWN = 10058
ESOCKTNOSUPPORT = 10044
ESPIPE = 29
ESRCH = 3
ESTALE = 10070
ETIME = 137
ETIMEDOUT = 10060
ETOOMANYREFS = 10059
ETXTBSY = 139
EUSERS = 10068
EWOULDBLOCK = 10035
EXDEV = 18
WSABASEERR = 10000
WSAEACCES = 10013
WSAEADDRINUSE = 10048
WSAEADDRNOTAVAIL = 10049
WSAEAFNOSUPPORT = 10047
WSAEALREADY = 10037
WSAEBADF = 10009
WSAECONNABORTED = 10053
WSAECONNREFUSED = 10061
WSAECONNRESET = 10054
WSAEDESTADDRREQ = 10039
WSAEDISCON = 10101
WSAEDQUOT = 10069
WSAEFAULT = 10014
WSAEHOSTDOWN = 10064
WSAEHOSTUNREACH = 10065
WSAEINPROGRESS = 10036
WSAEINTR = 10004
WSAEINVAL = 10022
WSAEISCONN = 10056
WSAELOOP = 10062
WSAEMFILE = 10024
WSAEMSGSIZE = 10040
WSAENAMETOOLONG = 10063
WSAENETDOWN = 10050
WSAENETRESET = 10052
WSAENETUNREACH = 10051
WSAENOBUFS = 10055
WSAENOPROTOOPT = 10042
WSAENOTCONN = 10057
WSAENOTEMPTY = 10066
WSAENOTSOCK = 10038
WSAEOPNOTSUPP = 10045
WSAEPFNOSUPPORT = 10046
WSAEPROCLIM = 10067
WSAEPROTONOSUPPORT = 10043
WSAEPROTOTYPE = 10041
WSAEREMOTE = 10071
WSAESHUTDOWN = 10058
WSAESOCKTNOSUPPORT = 10044
WSAESTALE = 10070
WSAETIMEDOUT = 10060
WSAETOOMANYREFS = 10059
WSAEUSERS = 10068
WSAEWOULDBLOCK = 10035
WSANOTINITIALISED = 10093
WSASYSNOTREADY = 10091
WSAVERNOTSUPPORTED = 10092
errorcode = {1: 'EPERM', 2: 'ENOENT', 3: 'ESRCH', 4: 'EINTR', 5: 'EIO'...
FILE
(built-in)
logging.config.fileConfig
Python Library Documentation: function fileConfig in module logging.config
fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Read the logging configuration from a ConfigParser-format file.
This can be called several times from an application, allowing an end user
the ability to select from various pre-canned configurations (if the
developer provides a mechanism to present the choices and load the chosen
configuration).
logging.config.functools
Python Library Documentation: module functools
NAME
functools - functools.py - Tools for working with functions and callable objects
MODULE REFERENCE
https://docs.python.org/3.12/library/functools.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.object
cached_property
partial
partialmethod
singledispatchmethod
class cached_property(builtins.object)
| cached_property(func)
|
| Methods defined here:
|
| __get__(self, instance, owner=None)
|
| __init__(self, func)
| Initialize self. See help(type(self)) for accurate signature.
|
| __set_name__(self, owner, name)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class partial(builtins.object)
| partial(func, *args, **keywords) - new function with partial application
| of the given arguments and keywords.
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
|
| __vectorcalloffset__
|
| args
| tuple of arguments to future partial calls
|
| func
| function object to use in future partial calls
|
| keywords
| dictionary of keyword arguments to future partial calls
class partialmethod(builtins.object)
| partialmethod(func, /, *args, **keywords)
|
| Method descriptor with partial application of the given arguments
| and keywords.
|
| Supports wrapping existing descriptors and handles non-descriptor
| callables as instance methods.
|
| Methods defined here:
|
| __get__(self, obj, cls=None)
|
| __init__(self, func, /, *args, **keywords)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| __isabstractmethod__
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class singledispatchmethod(builtins.object)
| singledispatchmethod(func)
|
| Single-dispatch generic method descriptor.
|
| Supports wrapping existing descriptors and handles non-descriptor
| callables as instance methods.
|
| Methods defined here:
|
| __get__(self, obj, cls=None)
|
| __init__(self, func)
| Initialize self. See help(type(self)) for accurate signature.
|
| register(self, cls, method=None)
| generic_method.register(cls, func) -> func
|
| Registers a new implementation for the given *cls* on a *generic_method*.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| __isabstractmethod__
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
cache(user_function, /)
Simple lightweight unbounded cache. Sometimes called "memoize".
cmp_to_key(mycmp)
Convert a cmp= function into a key= function.
mycmp
Function that compares two objects.
lru_cache(maxsize=128, typed=False)
Least-recently-used cache decorator.
If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.
If *typed* is True, arguments of different types will be cached separately.
For example, f(3.0) and f(3) will be treated as distinct calls with
distinct results.
Arguments to the cached function must be hashable.
View the cache statistics named tuple (hits, misses, maxsize, currsize)
with f.cache_info(). Clear the cache and statistics with f.cache_clear().
Access the underlying function with f.__wrapped__.
See: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
reduce(...)
reduce(function, iterable[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence
or iterable, from left to right, so as to reduce the iterable to a single
value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the iterable in the calculation, and serves as a default when the
iterable is empty.
singledispatch(func)
Single-dispatch generic function decorator.
Transforms a function into a generic function, which can have different
behaviours depending upon the type of its first argument. The decorated
function acts as the default implementation, and additional
implementations can be registered using the register() attribute of the
generic function.
total_ordering(cls)
Class decorator that fills in missing ordering methods
update_wrapper(wrapper, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))
Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))
Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
DATA
WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__qualname__', '__do...
WRAPPER_UPDATES = ('__dict__',)
__all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\functools.py
logging.config.io
Python Library Documentation: module io
NAME
io
MODULE REFERENCE
https://docs.python.org/3.12/library/io.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.
BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.
data:
DEFAULT_BUFFER_SIZE
An int containing the default buffer size used by the module's buffered
I/O classes. open() uses the file's blksize (as obtained by os.stat) if
possible.
CLASSES
_io._BufferedIOBase(_io._IOBase)
_io.BufferedRWPair
_io.BufferedRandom
_io.BufferedReader
_io.BufferedWriter
_io.BytesIO
BufferedIOBase(_io._BufferedIOBase, IOBase)
_io._IOBase(builtins.object)
IOBase
BufferedIOBase(_io._BufferedIOBase, IOBase)
RawIOBase(_io._RawIOBase, IOBase)
TextIOBase(_io._TextIOBase, IOBase)
_io._RawIOBase(_io._IOBase)
_io.FileIO
RawIOBase(_io._RawIOBase, IOBase)
_io._TextIOBase(_io._IOBase)
_io.StringIO
_io.TextIOWrapper
TextIOBase(_io._TextIOBase, IOBase)
builtins.OSError(builtins.Exception)
builtins.BlockingIOError
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.ValueError(builtins.Exception)
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.object
_io.IncrementalNewlineDecoder
class BlockingIOError(OSError)
| I/O operation would block.
|
| Method resolution order:
| BlockingIOError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class BufferedIOBase(_io._BufferedIOBase, IOBase)
| Base class for buffered IO objects.
|
| The main difference with RawIOBase is that the read() method
| supports omitting the size argument, and does not have a default
| implementation that defers to readinto().
|
| In addition, read(), readinto() and write() may raise
| BlockingIOError if the underlying raw stream is in non-blocking
| mode and not ready; unlike their raw counterparts, they will never
| return None.
|
| A typical implementation should not inherit from a RawIOBase
| implementation, but wrap one.
|
| Method resolution order:
| BufferedIOBase
| _io._BufferedIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class BufferedRWPair(_BufferedIOBase)
| BufferedRWPair(reader, writer, buffer_size=8192, /)
|
| A buffered reader and writer object together.
|
| A buffered reader object and buffered writer object put together to
| form a sequential IO object that can read and write. This is typically
| used with a socket or two-way pipe.
|
| reader and writer are RawIOBase objects that are readable and
| writeable respectively. If the buffer_size is omitted it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRWPair
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(...)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| flush(...)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(...)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(...)
|
| read(...)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(...)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(...)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(...)
|
| readinto1(...)
|
| writable(...)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(...)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedRandom(_BufferedIOBase)
| BufferedRandom(raw, buffer_size=8192)
|
| A buffered interface to random access streams.
|
| The constructor creates a reader and writer for a seekable stream,
| raw, given in the first argument. If the buffer_size is omitted it
| defaults to DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRandom
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedReader(_BufferedIOBase)
| BufferedReader(raw, buffer_size=8192)
|
| Create a new buffered reader using the given readable raw IO object.
|
| Method resolution order:
| BufferedReader
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BufferedWriter(_BufferedIOBase)
| BufferedWriter(raw, buffer_size=8192)
|
| A buffer for a writeable sequential RawIO object.
|
| The constructor creates a BufferedWriter for the given writeable raw
| stream. If the buffer_size is not given, it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedWriter
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| seek(self, target, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class BytesIO(_BufferedIOBase)
| BytesIO(initial_bytes=b'')
|
| Buffered I/O implementation using an in-memory bytes buffer.
|
| Method resolution order:
| BytesIO
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| close(self, /)
| Disable all I/O operations.
|
| flush(self, /)
| Does nothing.
|
| getbuffer(self, /)
| Get a read-write view over the contents of the BytesIO object.
|
| getvalue(self, /)
| Retrieve the entire contents of the BytesIO object.
|
| isatty(self, /)
| Always returns False.
|
| BytesIO objects are not connected to a TTY-like device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| read1(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative or omitted, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readinto(self, buffer, /)
| Read bytes into buffer.
|
| Returns number of bytes read (0 for EOF), or None if the object
| is set not to block and has no data to read.
|
| readline(self, size=-1, /)
| Next line from the file, as a bytes object.
|
| Retain newline. A non-negative size argument limits the maximum
| number of bytes to return (an incomplete line may be returned then).
| Return an empty bytes object at EOF.
|
| readlines(self, size=None, /)
| List of bytes objects, each a line from the file.
|
| Call readline() repeatedly and return a list of the lines so read.
| The optional size argument, if given, is an approximate bound on the
| total number of bytes in the lines returned.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to byte offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos may be negative;
| 2 End of stream - pos usually negative.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Current file position, an integer.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is unchanged. Returns the new size.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, b, /)
| Write bytes to file.
|
| Return the number of bytes written.
|
| writelines(self, lines, /)
| Write lines to the file.
|
| Note that newlines are not added. lines can be any iterable object
| producing bytes-like objects. This is equivalent to calling write() for
| each element.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed.
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class FileIO(_RawIOBase)
| FileIO(file, mode='r', closefd=True, opener=None)
|
| Open a file.
|
| The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
| writing, exclusive creation or appending. The file will be created if it
| doesn't exist when opened for writing or appending; it will be truncated
| when opened for writing. A FileExistsError will be raised if it already
| exists when opened for creating. Opening a file for creating implies
| writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
| to allow simultaneous reading and writing. A custom opener can be used by
| passing a callable as *opener*. The underlying file descriptor for the file
| object is then obtained by calling opener with (*name*, *flags*).
| *opener* must return an open file descriptor (passing os.open as *opener*
| results in functionality similar to passing None).
|
| Method resolution order:
| FileIO
| _RawIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Close the file.
|
| A closed file cannot be used for further I/O operations. close() may be
| called more than once without error.
|
| fileno(self, /)
| Return the underlying file descriptor (an integer).
|
| isatty(self, /)
| True if the file is connected to a TTY device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as bytes.
|
| Only makes one system call, so less data may be returned than requested.
| In non-blocking mode, returns None if no data is available.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| True if file was opened in a read mode.
|
| readall(self, /)
| Read all data from the file, returned as bytes.
|
| In non-blocking mode, returns as much as is immediately available,
| or None if no data is available. Return an empty bytes object at EOF.
|
| readinto(self, buffer, /)
| Same as RawIOBase.readinto().
|
| seek(self, pos, whence=0, /)
| Move to new file position and return the file position.
|
| Argument offset is a byte count. Optional argument whence defaults to
| SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
| are SEEK_CUR or 1 (move relative to current position, positive or negative),
| and SEEK_END or 2 (move relative to end of file, usually negative, although
| many platforms allow seeking beyond the end of a file).
|
| Note that not all file objects are seekable.
|
| seekable(self, /)
| True if file supports random-access.
|
| tell(self, /)
| Current file position.
|
| Can raise OSError for non seekable files.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes and return the truncated size.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is changed to the value of size.
|
| writable(self, /)
| True if file was opened in a write mode.
|
| write(self, b, /)
| Write buffer b to file, return number of bytes written.
|
| Only makes one system call, so not all of the data may be written.
| The number of bytes actually written is returned. In non-blocking mode,
| returns None if the write would block.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed
|
| closefd
| True if the file descriptor will be closed by close().
|
| mode
| String giving the file mode
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class IOBase(_io._IOBase)
| The abstract base class for all I/O classes.
|
| This class provides dummy implementations for many methods that
| derived classes can override selectively; the default implementations
| represent a file that cannot be read, written or seeked.
|
| Even though IOBase does not declare read, readinto, or write because
| their signatures will vary, implementations and clients should
| consider those methods part of the interface. Also, implementations
| may raise UnsupportedOperation when operations they do not support are
| called.
|
| The basic type used for binary data read from or written to a file is
| bytes. Other bytes-like objects are accepted as method arguments too.
| In some cases (such as readinto), a writable object is required. Text
| I/O classes work with str data.
|
| Note that calling any method (except additional calls to close(),
| which are ignored) on a closed stream should raise a ValueError.
|
| IOBase (and its subclasses) support the iterator protocol, meaning
| that an IOBase object can be iterated over yielding the lines in a
| stream.
|
| IOBase also supports the :keyword:`with` statement. In this example,
| fp is closed after the suite of the with statement is complete:
|
| with open('spam.txt', 'r') as fp:
| fp.write('Spam and eggs!')
|
| Method resolution order:
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class IncrementalNewlineDecoder(builtins.object)
| IncrementalNewlineDecoder(decoder, translate, errors='strict')
|
| Codec used when reading a file in universal newlines mode.
|
| It wraps another incremental decoder, translating \r\n and \r into \n.
| It also records the types of newlines encountered. When used with
| translate=False, it ensures that the newline sequence is returned in
| one piece. When used with decoder=None, it expects unicode strings as
| decode input and translates newlines without first invoking an external
| decoder.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, /, input, final=False)
|
| getstate(self, /)
|
| reset(self, /)
|
| setstate(self, state, /)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| newlines
class RawIOBase(_io._RawIOBase, IOBase)
| Base class for raw binary I/O.
|
| Method resolution order:
| RawIOBase
| _io._RawIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._RawIOBase:
|
| read(self, size=-1, /)
|
| readall(self, /)
| Read until EOF, using multiple read() call.
|
| readinto(...)
|
| write(...)
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class StringIO(_TextIOBase)
| StringIO(initial_value='', newline='\n')
|
| Text I/O implementation using an in-memory buffer.
|
| The initial_value argument sets the value of object. The newline
| argument is like the one of TextIOWrapper's constructor.
|
| Method resolution order:
| StringIO
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| close(self, /)
| Close the IO object.
|
| Attempting any further operation after the object is closed
| will raise a ValueError.
|
| This method has no effect if the file is already closed.
|
| getvalue(self, /)
| Retrieve the entire contents of the object.
|
| read(self, size=-1, /)
| Read at most size characters, returned as a string.
|
| If the argument is negative or omitted, read until EOF
| is reached. Return an empty string at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Returns an empty string if EOF is hit immediately.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to character offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos must be 0;
| 2 End of stream - pos must be 0.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Tell the current file position.
|
| truncate(self, pos=None, /)
| Truncate size to pos.
|
| The pos argument defaults to the current file position, as
| returned by tell(). The current file position is unchanged.
| Returns the new absolute position.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, s, /)
| Write string to file.
|
| Returns the number of characters written, which is always equal to
| the length of the string.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| line_buffering
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class TextIOBase(_io._TextIOBase, IOBase)
| Base class for text I/O.
|
| This class provides a character and line based interface to stream
| I/O. There is no readinto method because Python's character strings
| are immutable.
|
| Method resolution order:
| TextIOBase
| _io._TextIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| write(self, s, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class TextIOWrapper(_TextIOBase)
| TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False)
|
| Character and line based layer over a BufferedIOBase object, buffer.
|
| encoding gives the name of the encoding that the stream will be
| decoded or encoded with. It defaults to locale.getencoding().
|
| errors determines the strictness of encoding and decoding (see
| help(codecs.Codec) or the documentation for codecs.register) and
| defaults to "strict".
|
| newline controls how line endings are handled. It can be None, '',
| '\n', '\r', and '\r\n'. It works as follows:
|
| * On input, if newline is None, universal newlines mode is
| enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
| these are translated into '\n' before being returned to the
| caller. If it is '', universal newline mode is enabled, but line
| endings are returned to the caller untranslated. If it has any of
| the other legal values, input lines are only terminated by the given
| string, and the line ending is returned to the caller untranslated.
|
| * On output, if newline is None, any '\n' characters written are
| translated to the system default line separator, os.linesep. If
| newline is '' or '\n', no translation takes place. If newline is any
| of the other legal values, any '\n' characters written are translated
| to the given string.
|
| If line_buffering is True, a call to flush is implied when a call to
| write contains a newline character.
|
| Method resolution order:
| TextIOWrapper
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None)
| Reconfigure the text stream with new parameters.
|
| This also does an implicit stream flush.
|
| seek(self, cookie, whence=0, /)
| Set the stream position, and return the new stream position.
|
| cookie
| Zero or an opaque number returned by tell().
| whence
| The relative position to seek from.
|
| Four operations are supported, given by the following argument
| combinations:
|
| - seek(0, SEEK_SET): Rewind to the start of the stream.
| - seek(cookie, SEEK_SET): Restore a previous position;
| 'cookie' must be a number returned by tell().
| - seek(0, SEEK_END): Fast-forward to the end of the stream.
| - seek(0, SEEK_CUR): Leave the current stream position unchanged.
|
| Any other argument combinations are invalid,
| and may raise exceptions.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return the stream position as an opaque number.
|
| The return value of tell() can be given as input to seek(), to restore a
| previous stream position.
|
| truncate(self, pos=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(self, text, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| buffer
|
| closed
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| line_buffering
|
| name
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| write_through
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class UnsupportedOperation(builtins.OSError, builtins.ValueError)
| Method resolution order:
| UnsupportedOperation
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
dependent: locale.getencoding() is called to get the current locale encoding.
(For reading and writing raw bytes use binary mode and leave encoding
unspecified.) The available modes are:
========= ===============================================================
Character Meaning
--------- ---------------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
'a' open for writing, appending to the end of the file if it exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
========= ===============================================================
The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
line buffering (only usable in text mode), and an integer > 1 to indicate
the size of a fixed-size chunk buffer. When no buffering argument is
given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
is chosen using a heuristic trying to determine the underlying device's
"block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
On many systems, the buffer will typically be 4096 or 8192 bytes long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
* On input, if newline is None, universal newlines mode is
enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
these are translated into '\n' before being returned to the
caller. If it is '', universal newline mode is enabled, but line
endings are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
and must be True in that case.
A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
are performed. When open() is used to open a file in a text mode ('w',
'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
open_code(path)
Opens the provided file with the intent to import the contents.
This may perform extra validation beyond open(), but is otherwise interchangeable
with calling open(path, 'rb').
text_encoding(encoding, stacklevel=2, /)
A helper function to choose the text encoding.
When encoding is not None, this function returns it.
Otherwise, this function returns the default text encoding
(i.e. "locale" or "utf-8" depends on UTF-8 mode).
This function emits an EncodingWarning if encoding is None and
sys.flags.warn_default_encoding is true.
This can be used in APIs with an encoding=None parameter.
However, please consider using encoding="utf-8" for new APIs.
DATA
DEFAULT_BUFFER_SIZE = 8192
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
__all__ = ['BlockingIOError', 'open', 'open_code', 'IOBase', 'RawIOBas...
AUTHOR
Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\io.py
logging.config.listen
Python Library Documentation: function listen in module logging.config
listen(port=9030, verify=None)
Start up a socket server on the specified port, and listen for new
configurations.
These will be sent as a file suitable for processing by fileConfig().
Returns a Thread object on which you can call start() to start the server,
and which you can join() when appropriate. To stop the server, call
stopListening().
Use the ``verify`` argument to verify any bytes received across the wire
from a client. If specified, it should be a callable which receives a
single argument - the bytes of configuration data received across the
network - and it should return either ``None``, to indicate that the
passed in bytes could not be verified and should be discarded, or a
byte string which is then passed to the configuration machinery as
normal. Note that you can return transformed bytes, e.g. by decrypting
the bytes passed in.
logging.config.logging
Python Library Documentation: package logging
NAME
logging
MODULE REFERENCE
https://docs.python.org/3.12/library/logging.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
PACKAGE CONTENTS
config
handlers
CLASSES
builtins.object
BufferingFormatter
Filter
Formatter
LogRecord
LoggerAdapter
Filterer(builtins.object)
Handler
NullHandler
StreamHandler
FileHandler
Logger
class BufferingFormatter(builtins.object)
| BufferingFormatter(linefmt=None)
|
| A formatter suitable for formatting a number of records.
|
| Methods defined here:
|
| __init__(self, linefmt=None)
| Optionally specify a formatter which will be used to format each
| individual record.
|
| format(self, records)
| Format the specified records and return the result as a string.
|
| formatFooter(self, records)
| Return the footer string for the specified records.
|
| formatHeader(self, records)
| Return the header string for the specified records.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class FileHandler(StreamHandler)
| FileHandler(filename, mode='a', encoding=None, delay=False, errors=None)
|
| A handler class which writes formatted logging records to disk files.
|
| Method resolution order:
| FileHandler
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode='a', encoding=None, delay=False, errors=None)
| Open the specified file and use it as the stream for logging.
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| emit(self, record)
| Emit a record.
|
| If the stream was not opened because 'delay' was specified in the
| constructor, open it before calling the superclass's emit.
|
| If stream is not open, current mode is 'w' and `_closed=True`, record
| will not be emitted (see Issue #42378).
|
| ----------------------------------------------------------------------
| Methods inherited from StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Filter(builtins.object)
| Filter(name='')
|
| Filter instances are used to perform arbitrary filtering of LogRecords.
|
| Loggers and Handlers can optionally use Filter instances to filter
| records as desired. The base filter class only allows events which are
| below a certain point in the logger hierarchy. For example, a filter
| initialized with "A.B" will allow events logged by loggers "A.B",
| "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
| initialized with the empty string, all events are passed.
|
| Methods defined here:
|
| __init__(self, name='')
| Initialize a filter.
|
| Initialize with the name of the logger which, together with its
| children, will have its events allowed through the filter. If no
| name is specified, allow every event.
|
| filter(self, record)
| Determine if the specified record is to be logged.
|
| Returns True if the record should be logged, or False otherwise.
| If deemed appropriate, the record may be modified in-place.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Formatter(builtins.object)
| Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
|
| Formatter instances are used to convert a LogRecord to text.
|
| Formatters need to know how a LogRecord is constructed. They are
| responsible for converting a LogRecord to (usually) a string which can
| be interpreted by either a human or an external system. The base Formatter
| allows a formatting string to be specified. If none is supplied, the
| style-dependent default value, "%(message)s", "{message}", or
| "${message}", is used.
|
| The Formatter can be initialized with a format string which makes use of
| knowledge of the LogRecord attributes - e.g. the default value mentioned
| above makes use of the fact that the user's message and arguments are pre-
| formatted into a LogRecord's message attribute. Currently, the useful
| attributes in a LogRecord are described by:
|
| %(name)s Name of the logger (logging channel)
| %(levelno)s Numeric logging level for the message (DEBUG, INFO,
| WARNING, ERROR, CRITICAL)
| %(levelname)s Text logging level for the message ("DEBUG", "INFO",
| "WARNING", "ERROR", "CRITICAL")
| %(pathname)s Full pathname of the source file where the logging
| call was issued (if available)
| %(filename)s Filename portion of pathname
| %(module)s Module (name portion of filename)
| %(lineno)d Source line number where the logging call was issued
| (if available)
| %(funcName)s Function name
| %(created)f Time when the LogRecord was created (time.time()
| return value)
| %(asctime)s Textual time when the LogRecord was created
| %(msecs)d Millisecond portion of the creation time
| %(relativeCreated)d Time in milliseconds when the LogRecord was created,
| relative to the time the logging module was loaded
| (typically at application startup time)
| %(thread)d Thread ID (if available)
| %(threadName)s Thread name (if available)
| %(taskName)s Task name (if available)
| %(process)d Process ID (if available)
| %(message)s The result of record.getMessage(), computed just as
| the record is emitted
|
| Methods defined here:
|
| __init__(self, fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
| Initialize the formatter with specified format strings.
|
| Initialize the formatter either with the specified format string, or a
| default as described above. Allow for specialized date formatting with
| the optional datefmt argument. If datefmt is omitted, you get an
| ISO8601-like (or RFC 3339-like) format.
|
| Use a style parameter of '%', '{' or '$' to specify that you want to
| use one of %-formatting, :meth:`str.format` (``{}``) formatting or
| :class:`string.Template` formatting in your format string.
|
| .. versionchanged:: 3.2
| Added the ``style`` parameter.
|
| format(self, record)
| Format the specified record as text.
|
| The record's attribute dictionary is used as the operand to a
| string formatting operation which yields the returned string.
| Before formatting the dictionary, a couple of preparatory steps
| are carried out. The message attribute of the record is computed
| using LogRecord.getMessage(). If the formatting string uses the
| time (as determined by a call to usesTime(), formatTime() is
| called to format the event time. If there is exception information,
| it is formatted using formatException() and appended to the message.
|
| formatException(self, ei)
| Format and return the specified exception information as a string.
|
| This default implementation just uses
| traceback.print_exception()
|
| formatMessage(self, record)
|
| formatStack(self, stack_info)
| This method is provided as an extension point for specialized
| formatting of stack information.
|
| The input data is a string as returned from a call to
| :func:`traceback.print_stack`, but with the last trailing newline
| removed.
|
| The base implementation just returns the value passed in.
|
| formatTime(self, record, datefmt=None)
| Return the creation time of the specified LogRecord as formatted text.
|
| This method should be called from format() by a formatter which
| wants to make use of a formatted time. This method can be overridden
| in formatters to provide for any specific requirement, but the
| basic behaviour is as follows: if datefmt (a string) is specified,
| it is used with time.strftime() to format the creation time of the
| record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.
| The resulting string is returned. This function uses a user-configurable
| function to convert the creation time to a tuple. By default,
| time.localtime() is used; to change this for a particular formatter
| instance, set the 'converter' attribute to a function with the same
| signature as time.localtime() or time.gmtime(). To change it for all
| formatters, for example if you want all logging times to be shown in GMT,
| set the 'converter' attribute in the Formatter class.
|
| usesTime(self)
| Check if the format uses the creation time of the record.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| converter = localtime(...)
| localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
| tm_sec,tm_wday,tm_yday,tm_isdst)
|
| Convert seconds since the Epoch to a time tuple expressing local time.
| When 'seconds' is not passed in, convert the current time instead.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| default_msec_format = '%s,%03d'
|
| default_time_format = '%Y-%m-%d %H:%M:%S'
class Handler(Filterer)
| Handler(level=0)
|
| Handler instances dispatch logging events to specific destinations.
|
| The base handler class. Acts as a placeholder which defines the Handler
| interface. Handlers can optionally use Formatter instances to format
| records as desired. By default, no formatter is specified; in this case,
| the 'raw' message as determined by record.message is logged.
|
| Method resolution order:
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Do whatever it takes to actually log the specified logging record.
|
| This version is intended to be implemented by subclasses and so
| raises a NotImplementedError.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LogRecord(builtins.object)
| LogRecord(name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
|
| A LogRecord instance represents an event being logged.
|
| LogRecord instances are created every time something is logged. They
| contain all the information pertinent to the event being logged. The
| main information passed in is in msg and args, which are combined
| using str(msg) % args to create the message field of the record. The
| record also includes information such as when the record was created,
| the source line where the logging call was made, and any exception
| information to be logged.
|
| Methods defined here:
|
| __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
| Initialize a logging record with interesting information.
|
| __repr__(self)
| Return repr(self).
|
| getMessage(self)
| Return the message for this LogRecord.
|
| Return the message for this LogRecord after merging any user-supplied
| arguments with the message.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LoggerAdapter(builtins.object)
| LoggerAdapter(logger, extra=None)
|
| An adapter for loggers which makes it easier to specify contextual
| information in logging output.
|
| Methods defined here:
|
| __init__(self, logger, extra=None)
| Initialize the adapter with a logger and a dict-like object which
| provides contextual information. This constructor signature allows
| easy stacking of LoggerAdapters, if so desired.
|
| You can effectively pass keyword arguments as shown in the
| following example:
|
| adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2"))
|
| __repr__(self)
| Return repr(self).
|
| critical(self, msg, *args, **kwargs)
| Delegate a critical call to the underlying logger.
|
| debug(self, msg, *args, **kwargs)
| Delegate a debug call to the underlying logger.
|
| error(self, msg, *args, **kwargs)
| Delegate an error call to the underlying logger.
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Delegate an exception call to the underlying logger.
|
| getEffectiveLevel(self)
| Get the effective level for the underlying logger.
|
| hasHandlers(self)
| See if the underlying logger has any handlers.
|
| info(self, msg, *args, **kwargs)
| Delegate an info call to the underlying logger.
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Delegate a log call to the underlying logger, after adding
| contextual information from this adapter instance.
|
| process(self, msg, kwargs)
| Process the logging message and keyword arguments passed in to
| a logging call to insert contextual information. You can either
| manipulate the message itself, the keyword args or both. Return
| the message and kwargs modified (or not) to suit your needs.
|
| Normally, you'll only need to override this one method in a
| LoggerAdapter subclass for your specific needs.
|
| setLevel(self, level)
| Set the specified level on the underlying logger.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Delegate a warning call to the underlying logger.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| manager
class NullHandler(Handler)
| NullHandler(level=0)
|
| This handler does nothing. It's intended to be used to avoid the
| "No handlers could be found for logger XXX" one-off warning. This is
| important for library code, which may contain code to log events. If a user
| of the library does not configure logging, the one-off warning might be
| produced; to avoid this, the library developer simply needs to instantiate
| a NullHandler and add it to the top-level logger of the library module or
| package.
|
| Method resolution order:
| NullHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Stub.
|
| handle(self, record)
| Stub.
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class StreamHandler(Handler)
| StreamHandler(stream=None)
|
| A handler class which writes logging records, appropriately formatted,
| to a stream. Note that this class does not close the stream, as
| sys.stdout or sys.stderr may be used.
|
| Method resolution order:
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, stream=None)
| Initialize the handler.
|
| If stream is not specified, sys.stderr is used.
|
| __repr__(self)
| Return repr(self).
|
| emit(self, record)
| Emit a record.
|
| If a formatter is specified, it is used to format the record.
| The record is then written to the stream with a trailing newline. If
| exception information is present, it is formatted using
| traceback.print_exception and appended to the stream. If the stream
| has an 'encoding' attribute, it is used to determine how to do the
| output to the stream.
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
addLevelName(level, levelName)
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
basicConfig(**kwargs)
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured, unless the keyword argument *force* is set to ``True``.
It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
style If a format string is specified, use this to specify the
type of format string (possible values '%', '{', '$', for
%-formatting, :meth:`str.format` and :class:`string.Template`
- defaults to '%').
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
handlers If specified, this should be an iterable of already created
handlers, which will be added to the root logger. Any handler
in the list which does not have a formatter assigned will be
assigned the formatter created in this function.
force If this keyword is specified as true, any existing handlers
attached to the root logger are removed and closed, before
carrying out the configuration as specified by the other
arguments.
encoding If specified together with a filename, this encoding is passed to
the created FileHandler, causing it to be used when the file is
opened.
errors If specified together with a filename, this value is passed to the
created FileHandler, causing it to be used when the file is
opened in text mode. If not specified, the default value is
`backslashreplace`.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
.. versionchanged:: 3.2
Added the ``style`` parameter.
.. versionchanged:: 3.3
Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
incompatible arguments (e.g. ``handlers`` specified together with
``filename``/``filemode``, or ``filename``/``filemode`` specified
together with ``stream``, or ``handlers`` specified together with
``stream``.
.. versionchanged:: 3.8
Added the ``force`` parameter.
.. versionchanged:: 3.9
Added the ``encoding`` and ``errors`` parameters.
captureWarnings(capture)
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
critical(msg, *args, **kwargs)
Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.
debug(msg, *args, **kwargs)
Log a message with severity 'DEBUG' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
disable(level=50)
Disable all logging calls of severity 'level' and below.
error(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
exception(msg, *args, exc_info=True, **kwargs)
Log a message with severity 'ERROR' on the root logger, with exception
information. If the logger has no handlers, basicConfig() is called to add
a console handler with a pre-defined format.
fatal(msg, *args, **kwargs)
Don't use this function, use critical() instead.
getHandlerByName(name)
Get a handler with the specified *name*, or None if there isn't one with
that name.
getHandlerNames()
Return all known handler names as an immutable set.
getLevelName(level)
Return the textual or numeric representation of logging level 'level'.
If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
INFO, DEBUG) then you get the corresponding string. If you have
associated levels with names using addLevelName then the name you have
associated with 'level' is returned.
If a numeric value corresponding to one of the defined levels is passed
in, the corresponding string representation is returned.
If a string representation of the level is passed in, the corresponding
numeric value is returned.
If no matching numeric or string value is passed in, the string
'Level %s' % level is returned.
getLevelNamesMapping()
getLogRecordFactory()
Return the factory to be used when instantiating a log record.
getLogger(name=None)
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
getLoggerClass()
Return the class to be used when instantiating a logger.
info(msg, *args, **kwargs)
Log a message with severity 'INFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
log(level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level' on the root logger. If
the logger has no handlers, call basicConfig() to add a console handler
with a pre-defined format.
makeLogRecord(dict)
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
setLogRecordFactory(factory)
Set the factory to be used when instantiating a log record.
:param factory: A callable which will be called to instantiate
a log record.
setLoggerClass(klass)
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
shutdown(handlerList=[<weakref at 0x00000172065F6700; to '_StderrHandler' at 0x00000172065F2630>])
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
warn(msg, *args, **kwargs)
warning(msg, *args, **kwargs)
Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
DATA
BASIC_FORMAT = '%(levelname)s:%(name)s:%(message)s'
CRITICAL = 50
DEBUG = 10
ERROR = 40
FATAL = 50
INFO = 20
NOTSET = 0
WARN = 30
WARNING = 30
__all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', ...
__status__ = 'production'
lastResort = <_StderrHandler <stderr> (WARNING)>
raiseExceptions = True
VERSION
0.5.1.2
DATE
07 February 2010
AUTHOR
Vinay Sajip <vinay_sajip@red-dove.com>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\logging\__init__.py
logging.config.os
Python Library Documentation: module os
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
https://docs.python.org/3.12/library/os.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This exports:
- all functions from posix or nt, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix' or 'nt'
- os.curdir is a string representing the current directory (always '.')
- os.pardir is a string representing the parent directory (always '..')
- os.sep is the (or a most common) pathname separator ('/' or '\\')
- os.extsep is the extension separator (always '.')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- os.defpath is the default search path for executables
- os.devnull 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 os.path
(e.g., split and join).
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.object
nt.DirEntry
builtins.tuple(builtins.object)
nt.times_result
nt.uname_result
stat_result
statvfs_result
terminal_size
class DirEntry(builtins.object)
| 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_junction(self, /)
| Return True if the entry is a junction; 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__(...)
| 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 os.path.join(scandir_path, entry.name)
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class stat_result(builtins.tuple)
| 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 os.stat for more information.
|
| Method resolution order:
| stat_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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_birthtime
| time of creation
|
| st_birthtime_ns
| time of creation in nanoseconds
|
| st_ctime
| time of last change
|
| st_ctime_ns
| time of last change in nanoseconds
|
| st_dev
| device
|
| st_file_attributes
| Windows file attribute bits
|
| 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_reparse_tag
| Windows reparse tag
|
| 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 = 20
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 3
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class statvfs_result(builtins.tuple)
| 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 os.statvfs for more information.
|
| Method resolution order:
| statvfs_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class terminal_size(builtins.tuple)
| terminal_size(iterable=(), /)
|
| A tuple of (columns, lines) for holding terminal window size
|
| Method resolution order:
| terminal_size
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class times_result(builtins.tuple)
| times_result(iterable=(), /)
|
| times_result: Result from os.times().
|
| 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 os.times for more information.
|
| Method resolution order:
| times_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class uname_result(builtins.tuple)
| uname_result(iterable=(), /)
|
| uname_result: Result from os.uname().
|
| 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 os.uname for more information.
|
| Method resolution order:
| uname_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| 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 builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
_exit(status)
Exit to the system with specified status, without normal exit processing.
abort()
Abort the interpreter immediately.
This function 'dumps core' or otherwise fails in the hardest way possible
on the hosting operating system. This function never returns.
access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
Use the real uid/gid to test for access to a path.
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 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.
chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
Change the access permissions of a file.
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.
Be careful when using number literals for *mode*. The conventional UNIX notation for
numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in
Python.
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.
It is an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
dir_fd and follow_symlinks may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
close(fd)
Close a file descriptor.
closerange(fd_low, fd_high, /)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
cpu_count()
Return the number of CPUs in the system; return None if indeterminable.
This number is not equivalent to the number of CPUs the current process can
use. The number of usable CPUs can be obtained with
``len(os.sched_getaffinity(0))``
device_encoding(fd)
Return a string describing the encoding of a terminal's file descriptor.
The file descriptor must be attached to a terminal.
If the device is not a terminal, return None.
dup(fd, /)
Return a duplicate of a file descriptor.
dup2(fd, fd2, inheritable=True)
Duplicate file descriptor.
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)
Execute the executable file with argument list args and
environment env, replacing the current process.
execlp(file, *args)
execlp(file, *args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
execlpe(file, *args)
execlpe(file, *args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the current
process.
execv(path, argv, /)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
execve(path, argv, env)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
execvp(file, args)
execvp(file, args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
args may be a list or tuple of strings.
execvpe(file, args, env)
execvpe(file, args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the
current process.
args may be a list or tuple of strings.
fdopen(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)
fsdecode(filename)
Decode filename (an os.PathLike, 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 os.PathLike, 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.
If the object is str or bytes, then allow it to pass through as-is. If the
object defines __fspath__(), then return the result of that method. All other
types raise a TypeError.
fstat(fd)
Perform a stat system call on the given file descriptor.
Like stat(), but for an open file descriptor.
Equivalent to os.stat(fd).
fsync(fd)
Force write of fd to disk.
ftruncate(fd, length, /)
Truncate a file, specified by file descriptor, to a specific length.
get_blocking(fd, /)
Get the blocking mode of the file descriptor.
Return False if the O_NONBLOCK flag is set, True if the flag is cleared.
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.
*env* must be an environment variable dict or None. If *env* is None,
os.environ will be used.
get_handle_inheritable(handle, /)
Get the close-on-exe flag of the specified file descriptor.
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.
If the file descriptor is not connected to a terminal, an OSError
is thrown.
This function will only be defined if an implementation is
available for this system.
shutil.get_terminal_size is the high-level function which should
normally be used, os.get_terminal_size is the low-level implementation.
getcwd()
Return a unicode string representing the current working directory.
getcwdb()
Return a bytes string representing the current working directory.
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.
getlogin()
Return the actual login name.
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).
isatty(fd, /)
Return True if the fd is connected to a terminal.
Return True if the file descriptor is an open file descriptor
connected to the slave end of a terminal.
kill(pid, signal, /)
Kill a process with a signal.
link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
Create a hard link to a file.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
If follow_symlinks is False, and the last element of src is a symbolic
link, link will create a link to the symbolic link itself instead of the
file the link points to.
src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your
platform. If they are unavailable, using them will raise a
NotImplementedError.
listdir(path=None)
Return a list containing the names of the files in the directory.
path can be specified as either str, bytes, or a path-like object. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.
On some platforms, path may also be specified as an open file descriptor;\
the file descriptor must refer to a directory.
If this functionality is unavailable, using it raises NotImplementedError.
The list is in arbitrary order. It does not include the special
entries '.' and '..' even if they are present in the directory.
listdrives()
Return a list containing the names of drives in the system.
A drive name typically looks like 'C:\\'.
listmounts(volume)
Return a list containing mount points for a particular volume.
'volume' should be a GUID path as returned from os.listvolumes.
listvolumes()
Return a list containing the volumes in the system.
Volumes are typically represented as a GUID path.
lseek(fd, position, whence, /)
Set the position of a file descriptor. Return the new position.
fd
An open file descriptor, as returned by os.open().
position
Position, interpreted relative to 'whence'.
whence
The relative position to seek from. Valid values are:
- SEEK_SET: seek from the start of the file.
- SEEK_CUR: seek from the current file position.
- SEEK_END: seek from the end of the file.
The return value is the number of bytes relative to the beginning of the file.
lstat(path, *, dir_fd=None)
Perform a stat system call on the given path, without following symbolic links.
Like stat(), but do not follow symbolic links.
Equivalent to stat(path, follow_symlinks=False).
makedirs(name, mode=511, exist_ok=False)
makedirs(name [, mode=0o777][, exist_ok=False])
Super-mkdir; create a leaf directory and all intermediate ones. Works like
mkdir, except that any intermediate path segment (not just the rightmost)
will be created if it does not exist. If the target directory already
exists, raise an OSError if exist_ok is False. Otherwise no exception is
raised. This is recursive.
mkdir(path, mode=511, *, dir_fd=None)
Create a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
The mode argument is ignored on Windows. Where it is used, the current umask
value is first masked out.
open(path, flags, mode=511, *, dir_fd=None)
Open a file for low level IO. Returns a file descriptor (integer).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
pipe()
Create a pipe.
Returns a tuple of two file descriptors:
(read_fd, write_fd)
popen(cmd, mode='r', buffering=-1)
putenv(name, value, /)
Change or add an environment variable.
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.
If dir_fd is 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.
dir_fd may not be implemented on your platform. If it is unavailable,
using it will raise a NotImplementedError.
remove(path, *, dir_fd=None)
Remove a file (same as unlink()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
removedirs(name)
removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.
rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
renames(old, new)
renames(old, new)
Super-rename; create directories as necessary and delete any left
empty. Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first. After the rename, directories corresponding to rightmost
path segments of the old name will be pruned until either the
whole path is consumed or a nonempty directory is found.
Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory, overwriting the destination.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
rmdir(path, *, dir_fd=None)
Remove a directory.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
scandir(path=None)
Return an iterator of DirEntry objects for given path.
path can be specified as either str, bytes, or a path-like object. If path
is bytes, the names of yielded DirEntry objects will also be bytes; in
all other circumstances they will be str.
If path is None, uses the path='.'.
set_blocking(fd, blocking, /)
Set the blocking mode of the specified file descriptor.
Set the O_NONBLOCK flag if blocking is False,
clear the O_NONBLOCK flag otherwise.
set_handle_inheritable(handle, inheritable, /)
Set the inheritable flag of the specified handle.
set_inheritable(fd, inheritable, /)
Set the inheritable flag of the specified file descriptor.
spawnl(mode, file, *args)
spawnl(mode, file, *args) -> integer
Execute file 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.
spawnle(mode, file, *args)
spawnle(mode, file, *args, env) -> integer
Execute file 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.
spawnv(mode, path, argv, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
spawnve(mode, path, argv, env, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
startfile(...)
Start a file with its associated application.
When "operation" is not specified or "open", this acts like
double-clicking the file in Explorer, or giving the file name as an
argument to the DOS "start" command: the file is opened with whatever
application (if any) its extension is associated.
When another "operation" is given, it specifies what should be done with
the file. A typical operation is "print".
"arguments" is passed to the application, but should be omitted if the
file is a document.
"cwd" is the working directory for the operation. If "filepath" is
relative, it will be resolved against this directory. This argument
should usually be an absolute path.
"show_cmd" can be used to override the recommended visibility option.
See the Windows ShellExecute documentation for values.
startfile returns as soon as the associated application is launched.
There is no option to wait for the application to close, and no way
to retrieve the application's exit status.
The filepath is relative to the current directory. If you want to use
an absolute path, make sure the first character is not a slash ("/");
the underlying Win32 ShellExecute function doesn't work if it is.
stat(path, *, dir_fd=None, follow_symlinks=True)
Perform a stat system call on the given path.
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.
dir_fd and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
It's an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
strerror(code, /)
Translate an error code to a message string.
symlink(src, dst, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to src named dst.
target_is_directory is required on Windows if the target is to be
interpreted as a directory. (On Windows, symlink requires
Windows 6.0 or greater, and raises a NotImplementedError otherwise.)
target_is_directory is ignored on non-Windows platforms.
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
system(command)
Execute the command in a subshell.
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.
umask(mask, /)
Set the current numeric umask and return the previous umask.
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).
If dir_fd is 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.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
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.
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.
If times is not None, it must be a tuple (atime, mtime);
atime and mtime should be expressed as float seconds since the epoch.
If ns is specified, it must be a tuple (atime_ns, mtime_ns);
atime_ns and mtime_ns should be expressed as integer nanoseconds
since the epoch.
If times is None and ns is unspecified, utime uses the current time.
Specifying tuples for both times and ns is an error.
If dir_fd is 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.
If follow_symlinks is False, and the last element of the path is a symbolic
link, utime will modify the symbolic link itself instead of the file the
link points to.
It is an error to use dir_fd or follow_symlinks when specifying path
as an open file descriptor.
dir_fd and follow_symlinks may not be available on your platform.
If they are unavailable, using them will raise a NotImplementedError.
waitpid(pid, options, /)
Wait for completion of a given process.
Returns a tuple of information regarding the process:
(pid, status << 8)
The options argument is ignored on Windows.
waitstatus_to_exitcode(status)
Convert a wait status to an exit code.
On Unix:
* If WIFEXITED(status) is true, return WEXITSTATUS(status).
* If WIFSIGNALED(status) is true, return -WTERMSIG(status).
* Otherwise, raise a ValueError.
On Windows, return status shifted right by 8 bits.
On Unix, if the process is being traced or if waitpid() was called with
WUNTRACED option, the caller must first check if WIFSTOPPED(status) is true.
This function must not be called if WIFSTOPPED(status) is true.
walk(top, topdown=True, onerror=None, followlinks=False)
Directory tree generator.
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (including symlinks to directories,
and excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).
If optional arg 'topdown' is true or not specified, the triple for a
directory is generated before the triples for any of its subdirectories
(directories are generated top down). If topdown is false, the triple
for a directory is generated after the triples for all of its
subdirectories (directories are generated bottom up).
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 os.walk(), 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.
By default errors from the os.scandir() call are ignored. If
optional arg 'onerror' is specified, it should be a function; it
will be called with one argument, an OSError instance. It can
report the error to continue with the walk, or raise the exception
to abort the walk. Note that the filename is available as the
filename attribute of the exception object.
By default, os.walk does not follow symbolic links to subdirectories on
systems that support them. In order to get this functionality, set the
optional argument 'followlinks' to true.
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 os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print(root, "consumes ")
print(sum(getsize(join(root, name)) for name in files), end=" ")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
write(fd, data, /)
Write a bytes object to a file descriptor.
DATA
EX_OK = 0
F_OK = 0
O_APPEND = 8
O_BINARY = 32768
O_CREAT = 256
O_EXCL = 1024
O_NOINHERIT = 128
O_RANDOM = 16
O_RDONLY = 0
O_RDWR = 2
O_SEQUENTIAL = 32
O_SHORT_LIVED = 4096
O_TEMPORARY = 64
O_TEXT = 16384
O_TRUNC = 512
O_WRONLY = 1
P_DETACH = 4
P_NOWAIT = 1
P_NOWAITO = 3
P_OVERLAY = 2
P_WAIT = 0
R_OK = 4
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
TMP_MAX = 2147483647
W_OK = 2
X_OK = 1
__all__ = ['altsep', 'curdir', 'pardir', 'sep', 'pathsep', 'linesep', ...
altsep = '/'
curdir = '.'
defpath = r'.;C:\bin'
devnull = 'nul'
environ = environ({'ALLUSERSPROFILE': 'C:\\ProgramData', '...undled\\l...
extsep = '.'
linesep = '\r\n'
name = 'nt'
pardir = '..'
pathsep = ';'
sep = r'\'
supports_bytes_environ = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\os.py
logging.config.queue
Python Library Documentation: module queue
NAME
queue - A multi-producer, multi-consumer queue.
MODULE REFERENCE
https://docs.python.org/3.12/library/queue.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.Exception(builtins.BaseException)
_queue.Empty
Full
builtins.object
_queue.SimpleQueue
Queue
LifoQueue
PriorityQueue
class Empty(builtins.Exception)
| Exception raised by Queue.get(block=0)/get_nowait().
|
| Method resolution order:
| Empty
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Full(builtins.Exception)
| Exception raised by Queue.put(block=0)/put_nowait().
|
| Method resolution order:
| Full
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class LifoQueue(Queue)
| LifoQueue(maxsize=0)
|
| Variant of Queue that retrieves most recently added entries first.
|
| Method resolution order:
| LifoQueue
| Queue
| builtins.object
|
| Methods inherited from Queue:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods inherited from Queue:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Queue:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class PriorityQueue(Queue)
| PriorityQueue(maxsize=0)
|
| Variant of Queue that retrieves open entries in priority order (lowest first).
|
| Entries are typically tuples of the form: (priority number, data).
|
| Method resolution order:
| PriorityQueue
| Queue
| builtins.object
|
| Methods inherited from Queue:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods inherited from Queue:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Queue:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Queue(builtins.object)
| Queue(maxsize=0)
|
| Create a queue object with a given maximum size.
|
| If maxsize is <= 0, the queue size is infinite.
|
| Methods defined here:
|
| __init__(self, maxsize=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| empty(self)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() == 0
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can grow before the result of empty() or
| qsize() can be used.
|
| To create code that needs to wait for all queued tasks to be
| completed, the preferred technique is to use the join() method.
|
| full(self)
| Return True if the queue is full, False otherwise (not reliable!).
|
| This method is likely to be removed at some point. Use qsize() >= n
| as a direct substitute, but be aware that either approach risks a race
| condition where a queue can shrink before the result of full() or
| qsize() can be used.
|
| get(self, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| join(self)
| Blocks until all items in the Queue have been gotten and processed.
|
| The count of unfinished tasks goes up whenever an item is added to the
| queue. The count goes down whenever a consumer thread calls task_done()
| to indicate the item was retrieved and all work on it is complete.
|
| When the count of unfinished tasks drops to zero, join() unblocks.
|
| put(self, item, block=True, timeout=None)
| Put an item into the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until a free slot is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Full exception if no free slot was available within that time.
| Otherwise ('block' is false), put an item on the queue if a free slot
| is immediately available, else raise the Full exception ('timeout'
| is ignored in that case).
|
| put_nowait(self, item)
| Put an item into the queue without blocking.
|
| Only enqueue the item if a free slot is immediately available.
| Otherwise raise the Full exception.
|
| qsize(self)
| Return the approximate size of the queue (not reliable!).
|
| task_done(self)
| Indicate that a formerly enqueued task is complete.
|
| Used by Queue consumer threads. For each get() used to fetch a task,
| a subsequent call to task_done() tells the queue that the processing
| on the task is complete.
|
| If a join() is currently blocking, it will resume when all items
| have been processed (meaning that a task_done() call was received
| for every item that had been put() into the queue).
|
| Raises a ValueError if called more times than there were items
| placed in the queue.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SimpleQueue(builtins.object)
| Simple, unbounded, reentrant FIFO queue.
|
| Methods defined here:
|
| empty(self, /)
| Return True if the queue is empty, False otherwise (not reliable!).
|
| get(self, /, block=True, timeout=None)
| Remove and return an item from the queue.
|
| If optional args 'block' is true and 'timeout' is None (the default),
| block if necessary until an item is available. If 'timeout' is
| a non-negative number, it blocks at most 'timeout' seconds and raises
| the Empty exception if no item was available within that time.
| Otherwise ('block' is false), return an item if one is immediately
| available, else raise the Empty exception ('timeout' is ignored
| in that case).
|
| get_nowait(self, /)
| Remove and return an item from the queue without blocking.
|
| Only get an item if one is immediately available. Otherwise
| raise the Empty exception.
|
| put(self, /, item, block=True, timeout=None)
| Put the item on the queue.
|
| The optional 'block' and 'timeout' arguments are ignored, as this method
| never blocks. They are provided for compatibility with the Queue class.
|
| put_nowait(self, /, item)
| Put an item into the queue without blocking.
|
| This is exactly equivalent to `put(item)` and is only provided
| for compatibility with the Queue class.
|
| qsize(self, /)
| Return the approximate size of the queue (not reliable!).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
DATA
__all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue', 'Si...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\queue.py
logging.config.re
Python Library Documentation: package re
NAME
re - Support for regular expressions (RE).
MODULE REFERENCE
https://docs.python.org/3.12/library/re.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?aiLmsux) The letters set the corresponding flags defined below.
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
The special sequences consist of "\\" and a character from the list
below. If the ordinary character is not on the list, then the
resulting RE will match the second character.
\number Matches the contents of the group of the same number.
\A Matches only at the start of the string.
\Z Matches only at the end of the string.
\b Matches the empty string, but only at the start or end of a word.
\B Matches the empty string, but not at the start or end of a word.
\d Matches any decimal digit; equivalent to the set [0-9] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode digits.
\D Matches any non-digit character; equivalent to [^\d].
\s Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode whitespace characters.
\S Matches any non-whitespace character; equivalent to [^\s].
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the
range of Unicode alphanumeric characters (letters plus digits
plus underscore).
With LOCALE, it will match the set [0-9_] plus characters defined
as letters for the current locale.
\W Matches the complement of \w.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern to the beginning of a string.
fullmatch Match a regular expression pattern to all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string.
subn Same as sub, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a Match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics in a string.
Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
A ASCII For string patterns, make \w, \W, \b, \B, \d, \D
match the corresponding ASCII character categories
(rather than the whole Unicode categories, which is the
default).
For bytes patterns, this flag is the only available
behaviour and needn't be specified.
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE For compatibility only. Ignored for string patterns (it
is the default), and forbidden for bytes patterns.
This module also defines an exception 'error'.
PACKAGE CONTENTS
_casefix
_compiler
_constants
_parser
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
Match
Pattern
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
RegexFlag
class Match(builtins.object)
| The result of re.match() and re.search().
| Match objects always have a boolean value of True.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __getitem__(self, key, /)
| Return self[key].
|
| __repr__(self, /)
| Return repr(self).
|
| end(self, group=0, /)
| Return index of the end of the substring matched by group.
|
| expand(self, /, template)
| Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
|
| group(...)
| group([group1, ...]) -> str or tuple.
| Return subgroup(s) of the match by indices or names.
| For 0 returns the entire match.
|
| groupdict(self, /, default=None)
| Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
|
| default
| Is used for groups that did not participate in the match.
|
| groups(self, /, default=None)
| Return a tuple containing all the subgroups of the match, from 1.
|
| default
| Is used for groups that did not participate in the match.
|
| span(self, group=0, /)
| For match object m, return the 2-tuple (m.start(group), m.end(group)).
|
| start(self, group=0, /)
| Return index of the start of the substring matched by group.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| endpos
| The index into the string beyond which the RE engine will not go.
|
| lastgroup
| The name of the last matched capturing group.
|
| lastindex
| The integer index of the last matched capturing group.
|
| pos
| The index into the string at which the RE engine started looking for a match.
|
| re
| The regular expression object.
|
| regs
|
| string
| The string passed to match() or search().
class Pattern(builtins.object)
| Compiled regular expression object.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| findall(self, /, string, pos=0, endpos=9223372036854775807)
| Return a list of all non-overlapping matches of pattern in string.
|
| finditer(self, /, string, pos=0, endpos=9223372036854775807)
| Return an iterator over all non-overlapping matches for the RE pattern in string.
|
| For each match, the iterator returns a match object.
|
| fullmatch(self, /, string, pos=0, endpos=9223372036854775807)
| Matches against all of the string.
|
| match(self, /, string, pos=0, endpos=9223372036854775807)
| Matches zero or more characters at the beginning of the string.
|
| scanner(self, /, string, pos=0, endpos=9223372036854775807)
|
| search(self, /, string, pos=0, endpos=9223372036854775807)
| Scan through string looking for a match, and return a corresponding match object instance.
|
| Return None if no position in the string matches.
|
| split(self, /, string, maxsplit=0)
| Split string by the occurrences of pattern.
|
| sub(self, /, repl, string, count=0)
| Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
|
| subn(self, /, repl, string, count=0)
| Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| flags
| The regex matching flags.
|
| groupindex
| A dictionary mapping group names to group numbers.
|
| groups
| The number of capturing groups in the pattern.
|
| pattern
| The pattern string from which the RE object was compiled.
class RegexFlag(enum.IntFlag)
| RegexFlag(*values)
|
| An enumeration.
|
| Method resolution order:
| RegexFlag
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __repr__ = global_flag_repr(self) from enum
| use module.flag_name instead of class.flag_name
|
| the module is the last module in case of a multi-module name
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __str__(self, /) from builtins.object
| Return str(self).
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII = re.ASCII
|
| DEBUG = re.DEBUG
|
| DOTALL = re.DOTALL
|
| IGNORECASE = re.IGNORECASE
|
| LOCALE = re.LOCALE
|
| MULTILINE = re.MULTILINE
|
| TEMPLATE = re.TEMPLATE
|
| UNICODE = re.UNICODE
|
| VERBOSE = re.VERBOSE
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class error(builtins.Exception)
| error(msg, pattern=None, pos=None)
|
| Exception raised for invalid regular expressions.
|
| Attributes:
|
| msg: The unformatted error message
| pattern: The regular expression pattern
| pos: The index in the pattern where compilation failed (may be None)
| lineno: The line corresponding to pos (may be None)
| colno: The column corresponding to pos (may be None)
|
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg, pattern=None, pos=None) from re._constants.error
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
compile(pattern, flags=0)
Compile a regular expression pattern, returning a Pattern object.
escape(pattern)
Escape special characters in a string.
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a Match object.
Empty matches are included in the result.
fullmatch(pattern, string, flags=0)
Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found.
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a Match object, or None if no match was found.
purge()
Clear the regular expression caches
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning
a Match object, or None if no match was found.
split(pattern, string, maxsplit=0, flags=0)
Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. If
capturing parentheses are used in pattern, then the text of all
groups in the pattern are also returned as part of the resulting
list. If maxsplit is nonzero, at most maxsplit splits occur,
and the remainder of the string is returned as the final element
of the list.
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used.
subn(pattern, repl, string, count=0, flags=0)
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl. number is the number of
substitutions that were made. repl can be either a string or a
callable; if a string, backslash escapes in it are processed.
If it is a callable, it's passed the Match object and must
return a replacement string to be used.
template(pattern, flags=0)
Compile a template pattern, returning a Pattern object, deprecated
DATA
A = re.ASCII
ASCII = re.ASCII
DOTALL = re.DOTALL
I = re.IGNORECASE
IGNORECASE = re.IGNORECASE
L = re.LOCALE
LOCALE = re.LOCALE
M = re.MULTILINE
MULTILINE = re.MULTILINE
NOFLAG = re.NOFLAG
S = re.DOTALL
U = re.UNICODE
UNICODE = re.UNICODE
VERBOSE = re.VERBOSE
X = re.VERBOSE
__all__ = ['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'fi...
VERSION
2.2.1
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\re\__init__.py
logging.config.stopListening
Python Library Documentation: function stopListening in module logging.config
stopListening()
Stop the listening server which was created with a call to listen().
logging.config.struct
Python Library Documentation: module struct
NAME
struct
MODULE REFERENCE
https://docs.python.org/3.12/library/struct.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Functions to convert between Python values and C structs.
Python bytes objects are used to hold the data representing the C struct
and also as format strings (explained below) to describe the layout of data
in the C struct.
The optional first format char indicates byte order, size and alignment:
@: native order, size & alignment (default)
=: native order, std. size & alignment
<: little-endian, std. size & alignment
>: big-endian, std. size & alignment
!: same as >
The remaining chars indicate types of args and must match exactly;
these can be preceded by a decimal repeat count:
x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;
?: _Bool (requires C99; if not available, char is used instead)
h:short; H:unsigned short; i:int; I:unsigned int;
l:long; L:unsigned long; f:float; d:double; e:half-float.
Special cases (preceding decimal count indicates length):
s:string (array of char); p: pascal string (with count byte).
Special cases (only available in native format):
n:ssize_t; N:size_t;
P:an integer type that is wide enough to hold a pointer.
Special case (not in native mode unless 'long long' in platform C):
q:long long; Q:unsigned long long
Whitespace between formats is ignored.
The variable struct.error is an exception raised on errors.
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
_struct.Struct
class Struct(builtins.object)
| Struct(fmt) --> compiled struct object
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __sizeof__(...)
| S.__sizeof__() -> size of S in memory, in bytes
|
| iter_unpack(self, buffer, /)
| Return an iterator yielding tuples.
|
| Tuples are unpacked from the given bytes source, like a repeated
| invocation of unpack_from().
|
| Requires that the bytes length be a multiple of the struct size.
|
| pack(...)
| S.pack(v1, v2, ...) -> bytes
|
| Return a bytes object containing values v1, v2, ... packed according
| to the format string S.format. See help(struct) for more on format
| strings.
|
| pack_into(...)
| S.pack_into(buffer, offset, v1, v2, ...)
|
| Pack the values v1, v2, ... according to the format string S.format
| and write the packed bytes into the writable buffer buf starting at
| offset. Note that the offset is a required argument. See
| help(struct) for more on format strings.
|
| unpack(self, buffer, /)
| Return a tuple containing unpacked values.
|
| Unpack according to the format string Struct.format. The buffer's size
| in bytes must be Struct.size.
|
| See help(struct) for more on format strings.
|
| unpack_from(self, /, buffer, offset=0)
| Return a tuple containing unpacked values.
|
| Values are unpacked according to the format string Struct.format.
|
| The buffer's size in bytes, starting at position offset, must be
| at least Struct.size.
|
| See help(struct) for more on format strings.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| format
| struct format string
|
| size
| struct size in bytes
class error(builtins.Exception)
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
calcsize(format, /)
Return size in bytes of the struct described by the format string.
iter_unpack(format, buffer, /)
Return an iterator yielding tuples unpacked from the given bytes.
The bytes are unpacked according to the format string, like
a repeated invocation of unpack_from().
Requires that the bytes length be a multiple of the format struct size.
pack(...)
pack(format, v1, v2, ...) -> bytes
Return a bytes object containing the values v1, v2, ... packed according
to the format string. See help(struct) for more on format strings.
pack_into(...)
pack_into(format, buffer, offset, v1, v2, ...)
Pack the values v1, v2, ... according to the format string and write
the packed bytes into the writable buffer buf starting at offset. Note
that the offset is a required argument. See help(struct) for more
on format strings.
unpack(format, buffer, /)
Return a tuple containing values unpacked according to the format string.
The buffer's size in bytes must be calcsize(format).
See help(struct) for more on format strings.
unpack_from(format, /, buffer, offset=0)
Return a tuple containing values unpacked according to the format string.
The buffer's size, minus offset, must be at least calcsize(format).
See help(struct) for more on format strings.
DATA
__all__ = ['calcsize', 'pack', 'pack_into', 'unpack', 'unpack_from', '...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\struct.py
logging.config.threading
Python Library Documentation: module threading
NAME
threading - Thread module emulating a subset of Java's threading model.
MODULE REFERENCE
https://docs.python.org/3.12/library/threading.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.Exception(builtins.BaseException)
builtins.RuntimeError
BrokenBarrierError
builtins.object
_thread._local
Barrier
Condition
Event
Semaphore
BoundedSemaphore
Thread
Timer
builtins.tuple(builtins.object)
_thread._ExceptHookArgs
class Barrier(builtins.object)
| Barrier(parties, action=None, timeout=None)
|
| Implements a Barrier.
|
| Useful for synchronizing a fixed number of threads at known synchronization
| points. Threads block on 'wait()' and are simultaneously awoken once they
| have all made that call.
|
| Methods defined here:
|
| __init__(self, parties, action=None, timeout=None)
| Create a barrier, initialised to 'parties' threads.
|
| 'action' is a callable which, when supplied, will be called by one of
| the threads after they have all entered the barrier and just prior to
| releasing them all. If a 'timeout' is provided, it is used as the
| default for all subsequent 'wait()' calls.
|
| __repr__(self)
| Return repr(self).
|
| abort(self)
| Place the barrier into a 'broken' state.
|
| Useful in case of error. Any currently waiting threads and threads
| attempting to 'wait()' will have BrokenBarrierError raised.
|
| reset(self)
| Reset the barrier to the initial state.
|
| Any threads currently waiting will get the BrokenBarrier exception
| raised.
|
| wait(self, timeout=None)
| Wait for the barrier.
|
| When the specified number of threads have started waiting, they are all
| simultaneously awoken. If an 'action' was provided for the barrier, one
| of the threads will have executed that callback prior to returning.
| Returns an individual index number from 0 to 'parties-1'.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| broken
| Return True if the barrier is in a broken state.
|
| n_waiting
| Return the number of threads currently waiting at the barrier.
|
| parties
| Return the number of threads required to trip the barrier.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BoundedSemaphore(Semaphore)
| BoundedSemaphore(value=1)
|
| Implements a bounded semaphore.
|
| A bounded semaphore checks to make sure its current value doesn't exceed its
| initial value. If it does, ValueError is raised. In most situations
| semaphores are used to guard resources with limited capacity.
|
| If the semaphore is released too many times it's a sign of a bug. If not
| given, value defaults to 1.
|
| Like regular semaphores, bounded semaphores manage a counter representing
| the number of release() calls minus the number of acquire() calls, plus an
| initial value. The acquire() method blocks if necessary until it can return
| without making the counter negative. If not given, value defaults to 1.
|
| Method resolution order:
| BoundedSemaphore
| Semaphore
| builtins.object
|
| Methods defined here:
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| If the number of releases exceeds the number of acquires,
| raise a ValueError.
|
| ----------------------------------------------------------------------
| Methods inherited from Semaphore:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Semaphore:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BrokenBarrierError(builtins.RuntimeError)
| # exception raised by the Barrier class
|
| Method resolution order:
| BrokenBarrierError
| builtins.RuntimeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.RuntimeError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.RuntimeError:
|
| __new__(*args, **kwargs) class method of builtins.RuntimeError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Condition(builtins.object)
| Condition(lock=None)
|
| Class that implements a condition variable.
|
| A condition variable allows one or more threads to wait until they are
| notified by another thread.
|
| If the lock argument is given and not None, it must be a Lock or RLock
| object, and it is used as the underlying lock. Otherwise, a new RLock object
| is created and used as the underlying lock.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __init__(self, lock=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| notify(self, n=1)
| Wake up one or more threads waiting on this condition, if any.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method wakes up at most n of the threads waiting for the condition
| variable; it is a no-op if no threads are waiting.
|
| notifyAll(self)
| Wake up all threads waiting on this condition.
|
| This method is deprecated, use notify_all() instead.
|
| notify_all(self)
| Wake up all threads waiting on this condition.
|
| If the calling thread has not acquired the lock when this method
| is called, a RuntimeError is raised.
|
| wait(self, timeout=None)
| Wait until notified or until a timeout occurs.
|
| If the calling thread has not acquired the lock when this method is
| called, a RuntimeError is raised.
|
| This method releases the underlying lock, and then blocks until it is
| awakened by a notify() or notify_all() call for the same condition
| variable in another thread, or until the optional timeout occurs. Once
| awakened or timed out, it re-acquires the lock and returns.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| When the underlying lock is an RLock, it is not released using its
| release() method, since this may not actually unlock the lock when it
| was acquired multiple times recursively. Instead, an internal interface
| of the RLock class is used, which really unlocks it even when it has
| been recursively acquired several times. Another internal interface is
| then used to restore the recursion level when the lock is reacquired.
|
| wait_for(self, predicate, timeout=None)
| Wait until a condition evaluates to True.
|
| predicate should be a callable which result will be interpreted as a
| boolean value. A timeout may be provided giving the maximum time to
| wait.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Event(builtins.object)
| Class implementing event objects.
|
| Events manage a flag that can be set to true with the set() method and reset
| to false with the clear() method. The wait() method blocks until the flag is
| true. The flag is initially false.
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| clear(self)
| Reset the internal flag to false.
|
| Subsequently, threads calling wait() will block until set() is called to
| set the internal flag to true again.
|
| isSet(self)
| Return true if and only if the internal flag is true.
|
| This method is deprecated, use is_set() instead.
|
| is_set(self)
| Return true if and only if the internal flag is true.
|
| set(self)
| Set the internal flag to true.
|
| All threads waiting for it to become true are awakened. Threads
| that call wait() once the flag is true will not block at all.
|
| wait(self, timeout=None)
| Block until the internal flag is true.
|
| If the internal flag is true on entry, return immediately. Otherwise,
| block until another thread calls set() to set the flag to true, or until
| the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof).
|
| This method returns the internal flag on exit, so it will always return
| True except if a timeout is given and the operation times out.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
ExceptHookArgs = class _ExceptHookArgs(builtins.tuple)
| ExceptHookArgs(iterable=(), /)
|
| ExceptHookArgs
|
| Type used to pass arguments to threading.excepthook.
|
| Method resolution order:
| _ExceptHookArgs
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| exc_traceback
| Exception traceback
|
| exc_type
| Exception type
|
| exc_value
| Exception value
|
| thread
| Thread
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('exc_type', 'exc_value', 'exc_traceback', 'thread')
|
| n_fields = 4
|
| n_sequence_fields = 4
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(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 builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class Semaphore(builtins.object)
| Semaphore(value=1)
|
| This class implements semaphore objects.
|
| Semaphores manage a counter representing the number of release() calls minus
| the number of acquire() calls, plus an initial value. The acquire() method
| blocks if necessary until it can return without making the counter
| negative. If not given, value defaults to 1.
|
| Methods defined here:
|
| __enter__ = acquire(self, blocking=True, timeout=None)
|
| __exit__(self, t, v, tb)
|
| __init__(self, value=1)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self, blocking=True, timeout=None)
| Acquire a semaphore, decrementing the internal counter by one.
|
| When invoked without arguments: if the internal counter is larger than
| zero on entry, decrement it by one and return immediately. If it is zero
| on entry, block, waiting until some other thread has called release() to
| make it larger than zero. This is done with proper interlocking so that
| if multiple acquire() calls are blocked, release() will wake exactly one
| of them up. The implementation may pick one at random, so the order in
| which blocked threads are awakened should not be relied on. There is no
| return value in this case.
|
| When invoked with blocking set to true, do the same thing as when called
| without arguments, and return true.
|
| When invoked with blocking set to false, do not block. If a call without
| an argument would block, return false immediately; otherwise, do the
| same thing as when called without arguments, and return true.
|
| When invoked with a timeout other than None, it will block for at
| most timeout seconds. If acquire does not complete successfully in
| that interval, return false. Return true otherwise.
|
| release(self, n=1)
| Release a semaphore, incrementing the internal counter by one or more.
|
| When the counter is zero on entry and another thread is waiting for it
| to become larger than zero again, wake up that thread.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Thread(builtins.object)
| Thread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
|
| A class that represents a thread of control.
|
| This class can be safely subclassed in a limited fashion. There are two ways
| to specify the activity: by passing a callable object to the constructor, or
| by overriding the run() method in a subclass.
|
| Methods defined here:
|
| __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
ThreadError = class RuntimeError(Exception)
| Unspecified run-time error.
|
| Method resolution order:
| RuntimeError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| NotImplementedError
| RecursionError
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Timer(Thread)
| Timer(interval, function, args=None, kwargs=None)
|
| Call a function after a specified number of seconds:
|
| t = Timer(30.0, f, args=None, kwargs=None)
| t.start()
| t.cancel() # stop the timer's action if it's still waiting
|
| Method resolution order:
| Timer
| Thread
| builtins.object
|
| Methods defined here:
|
| __init__(self, interval, function, args=None, kwargs=None)
| This constructor should always be called with keyword arguments. Arguments are:
|
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is a list or tuple of arguments for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
|
| cancel(self)
| Stop the timer if it hasn't finished yet.
|
| run(self)
| Method representing the thread's activity.
|
| You may override this method in a subclass. The standard run() method
| invokes the callable object passed to the object's constructor as the
| target argument, if any, with sequential and keyword arguments taken
| from the args and kwargs arguments, respectively.
|
| ----------------------------------------------------------------------
| Methods inherited from Thread:
|
| __repr__(self)
| Return repr(self).
|
| getName(self)
| Return a string used for identification purposes only.
|
| This method is deprecated, use the name attribute instead.
|
| isDaemon(self)
| Return whether this thread is a daemon.
|
| This method is deprecated, use the daemon attribute instead.
|
| is_alive(self)
| Return whether the thread is alive.
|
| This method returns True just before the run() method starts until just
| after the run() method terminates. See also the module function
| enumerate().
|
| join(self, timeout=None)
| Wait until the thread terminates.
|
| This blocks the calling thread until the thread whose join() method is
| called terminates -- either normally or through an unhandled exception
| or until the optional timeout occurs.
|
| When the timeout argument is present and not None, it should be a
| floating-point number specifying a timeout for the operation in seconds
| (or fractions thereof). As join() always returns None, you must call
| is_alive() after join() to decide whether a timeout happened -- if the
| thread is still alive, the join() call timed out.
|
| When the timeout argument is not present or None, the operation will
| block until the thread terminates.
|
| A thread can be join()ed many times.
|
| join() raises a RuntimeError if an attempt is made to join the current
| thread as that would cause a deadlock. It is also an error to join() a
| thread before it has been started and attempts to do so raises the same
| exception.
|
| setDaemon(self, daemonic)
| Set whether this thread is a daemon.
|
| This method is deprecated, use the .daemon property instead.
|
| setName(self, name)
| Set the name string for this thread.
|
| This method is deprecated, use the name attribute instead.
|
| start(self)
| Start the thread's activity.
|
| It must be called at most once per thread object. It arranges for the
| object's run() method to be invoked in a separate thread of control.
|
| This method will raise a RuntimeError if called more than once on the
| same thread object.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from Thread:
|
| ident
| Thread identifier of this thread or None if it has not been started.
|
| This is a nonzero integer. See the get_ident() function. Thread
| identifiers may be recycled when a thread exits and another thread is
| created. The identifier is available even after the thread has exited.
|
| native_id
| Native integral thread ID of this thread, or None if it has not been started.
|
| This is a non-negative integer. See the get_native_id() function.
| This represents the Thread ID as reported by the kernel.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Thread:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| daemon
| A boolean value indicating whether this thread is a daemon thread.
|
| This must be set before start() is called, otherwise RuntimeError is
| raised. Its initial value is inherited from the creating thread; the
| main thread is not a daemon thread and therefore all threads created in
| the main thread default to daemon = False.
|
| The entire Python program exits when only daemon threads are left.
|
| name
| A string used for identification purposes only.
|
| It has no semantics. Multiple threads may be given the same name. The
| initial name is set by the constructor.
local = class _local(builtins.object)
| Thread-local data
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
FUNCTIONS
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
Create a new lock object. See help(type(threading.Lock())) for
information about locks.
RLock(*args, **kwargs)
Factory function that returns a new reentrant lock.
A reentrant lock must be released by the thread that acquired it. Once a
thread has acquired a reentrant lock, the same thread may acquire it again
without blocking; the thread must release it once for each time it has
acquired it.
__excepthook__ = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
active_count()
Return the number of Thread objects currently alive.
The returned count is equal to the length of the list returned by
enumerate().
current_thread()
Return the current Thread object, corresponding to the caller's thread of control.
If the caller's thread of control was not created through the threading
module, a dummy thread object with limited functionality is returned.
enumerate()
Return a list of all Thread objects currently alive.
The list includes daemonic threads, dummy thread objects created by
current_thread(), and the main thread. It excludes terminated threads and
threads that have not yet been started.
excepthook = _excepthook(...)
excepthook(exc_type, exc_value, exc_traceback, thread)
Handle uncaught Thread.run() exception.
get_ident(...)
get_ident() -> integer
Return a non-zero integer that uniquely identifies the current thread
amongst other threads that exist simultaneously.
This may be used to identify per-thread resources.
Even though on some platforms threads identities may appear to be
allocated consecutive numbers starting at 1, this behavior should not
be relied upon, and the number should be seen purely as a magic cookie.
A thread's identity may be reused for another thread after it exits.
get_native_id(...)
get_native_id() -> integer
Return a non-negative integer identifying the thread as reported
by the OS (kernel). This may be used to uniquely identify a
particular thread within a system.
getprofile()
Get the profiler function as set by threading.setprofile().
gettrace()
Get the trace function as set by threading.settrace().
main_thread()
Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started.
setprofile(func)
Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
setprofile_all_threads(func)
Set a profile function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
settrace(func)
Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
settrace_all_threads(func)
Set a trace function for all threads started from the threading module
and all Python threads that are currently executing.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
stack_size(...)
stack_size([size]) -> size
Return the thread stack size used when creating new threads. The
optional size argument specifies the stack size (in bytes) to be used
for subsequently created threads, and must be 0 (use platform or
configured default) or a positive integer value of at least 32,768 (32k).
If changing the thread stack size is unsupported, a ThreadError
exception is raised. If the specified size is invalid, a ValueError
exception is raised, and the stack size is unmodified. 32k bytes
currently the minimum supported stack size value to guarantee
sufficient stack space for the interpreter itself.
Note that some platforms may have particular restrictions on values for
the stack size, such as requiring a minimum stack size larger than 32 KiB or
requiring allocation in multiples of the system memory page size
- platform documentation should be referred to for more information
(4 KiB pages are common; using multiples of 4096 for the stack size is
the suggested approach in the absence of more specific information).
DATA
TIMEOUT_MAX = 4294967.0
__all__ = ['get_ident', 'active_count', 'Condition', 'current_thread',...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\threading.py
logging.config.traceback
Python Library Documentation: module traceback
NAME
traceback - Extract, format and print information about Python stack traces.
MODULE REFERENCE
https://docs.python.org/3.12/library/traceback.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.list(builtins.object)
StackSummary
builtins.object
FrameSummary
TracebackException
class FrameSummary(builtins.object)
| FrameSummary(filename, lineno, name, *, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None)
|
| Information about a single frame from a traceback.
|
| - :attr:`filename` The filename for the frame.
| - :attr:`lineno` The line within filename for the frame that was
| active when the frame was captured.
| - :attr:`name` The name of the function or method that was executing
| when the frame was captured.
| - :attr:`line` The text from the linecache module for the
| of code that was running when the frame was captured.
| - :attr:`locals` Either None if locals were not supplied, or a dict
| mapping the name to the repr() of the variable.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __getitem__(self, pos)
|
| __init__(self, filename, lineno, name, *, lookup_line=True, locals=None, line=None, end_lineno=None, colno=None, end_colno=None)
| Construct a FrameSummary.
|
| :param lookup_line: If True, `linecache` is consulted for the source
| code line. Otherwise, the line will be looked up when first needed.
| :param locals: If supplied the frame locals, which will be captured as
| object representations.
| :param line: If provided, use this instead of looking up the line in
| the linecache.
|
| __iter__(self)
|
| __len__(self)
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| line
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| colno
|
| end_colno
|
| end_lineno
|
| filename
|
| lineno
|
| locals
|
| name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
class StackSummary(builtins.list)
| StackSummary(iterable=(), /)
|
| A list of FrameSummary objects, representing a stack of frames.
|
| Method resolution order:
| StackSummary
| builtins.list
| builtins.object
|
| Methods defined here:
|
| format(self)
| Format the stack ready for printing.
|
| Returns a list of strings ready for printing. Each string in the
| resulting list corresponds to a single frame from the stack.
| Each string ends in a newline; the strings may contain internal
| newlines as well, for those items with source text lines.
|
| For long sequences of the same frame and line, the first few
| repetitions are shown, followed by a summary line stating the exact
| number of further repetitions.
|
| format_frame_summary(self, frame_summary)
| Format the lines for a single FrameSummary.
|
| Returns a string representing one frame involved in the stack. This
| gets called for every frame to be printed in the stack summary.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| extract(frame_gen, *, limit=None, lookup_lines=True, capture_locals=False)
| Create a StackSummary from a traceback or stack object.
|
| :param frame_gen: A generator that yields (frame, lineno) tuples
| whose summaries are to be included in the stack.
| :param limit: None to include all frames or the number of frames to
| include.
| :param lookup_lines: If True, lookup lines for each frame immediately,
| otherwise lookup is deferred until the frame is rendered.
| :param capture_locals: If True, the local variables from each frame will
| be captured as object representations into the FrameSummary.
|
| from_list(a_list)
| Create a StackSummary object from a supplied list of
| FrameSummary objects or old-style list of tuples.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.list:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __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, index, /)
| Return self[index].
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(self, /)
| Return a reverse iterator over the list.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(self, /)
| Return the size of the list in memory, in bytes.
|
| append(self, object, /)
| Append object to the end of the list.
|
| clear(self, /)
| Remove all items from list.
|
| copy(self, /)
| Return a shallow copy of the list.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| extend(self, iterable, /)
| Extend list by appending elements from the iterable.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| insert(self, index, object, /)
| Insert object before index.
|
| pop(self, index=-1, /)
| Remove and return item at index (default last).
|
| Raises IndexError if list is empty or index is out of range.
|
| remove(self, value, /)
| Remove first occurrence of value.
|
| Raises ValueError if the value is not present.
|
| reverse(self, /)
| Reverse *IN PLACE*.
|
| sort(self, /, *, key=None, reverse=False)
| Sort the list in ascending order and return None.
|
| The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
| order of two equal elements is maintained).
|
| If a key function is given, apply it once to each list item and sort them,
| ascending or descending, according to their function values.
|
| The reverse flag can be set to sort in descending order.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.list:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.list:
|
| __new__(*args, **kwargs) class method of builtins.list
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.list:
|
| __hash__ = None
class TracebackException(builtins.object)
| TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10, _seen=None)
|
| An exception ready for rendering.
|
| The traceback module captures enough attributes from the original exception
| to this intermediary form to ensure that no references are held, while
| still being able to fully print or format it.
|
| max_group_width and max_group_depth control the formatting of exception
| groups. The depth refers to the nesting level of the group, and the width
| refers to the size of a single exception group's exceptions array. The
| formatted output is truncated when either limit is exceeded.
|
| Use `from_exception` to create TracebackException instances from exception
| objects, or the constructor to create TracebackException instances from
| individual components.
|
| - :attr:`__cause__` A TracebackException of the original *__cause__*.
| - :attr:`__context__` A TracebackException of the original *__context__*.
| - :attr:`exceptions` For exception groups - a list of TracebackException
| instances for the nested *exceptions*. ``None`` for other exceptions.
| - :attr:`__suppress_context__` The *__suppress_context__* value from the
| original exception.
| - :attr:`stack` A `StackSummary` representing the traceback.
| - :attr:`exc_type` The class of the original traceback.
| - :attr:`filename` For syntax errors - the filename where the error
| occurred.
| - :attr:`lineno` For syntax errors - the linenumber where the error
| occurred.
| - :attr:`end_lineno` For syntax errors - the end linenumber where the error
| occurred. Can be `None` if not present.
| - :attr:`text` For syntax errors - the text where the error
| occurred.
| - :attr:`offset` For syntax errors - the offset into the text where the
| error occurred.
| - :attr:`end_offset` For syntax errors - the end offset into the text where
| the error occurred. Can be `None` if not present.
| - :attr:`msg` For syntax errors - the compiler error message.
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10, _seen=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| format(self, *, chain=True, _ctx=None)
| Format the exception.
|
| If chain is not *True*, *__cause__* and *__context__* will not be formatted.
|
| The return value is a generator of strings, each ending in a newline and
| some containing internal newlines. `print_exception` is a wrapper around
| this method which just prints the lines to a file.
|
| The message indicating which exception occurred is always the last
| string in the output.
|
| format_exception_only(self)
| Format the exception part of the traceback.
|
| The return value is a generator of strings, each ending in a newline.
|
| Generator yields the exception message.
| For :exc:`SyntaxError` exceptions, it
| also yields (before the exception message)
| several lines that (when printed)
| display detailed information about where the syntax error occurred.
| Following the message, generator also yields
| all the exception's ``__notes__``.
|
| print(self, *, file=None, chain=True)
| Print the result of self.format(chain=chain) to 'file'.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_exception(exc, *args, **kwargs)
| Create a TracebackException from an exception.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
FUNCTIONS
clear_frames(tb)
Clear all references to local variables in the frames of a traceback.
extract_stack(f=None, limit=None)
Extract the raw traceback from the current stack frame.
The return value has the same format as for extract_tb(). The
optional 'f' and 'limit' arguments have the same meaning as for
print_stack(). Each item in the list is a quadruple (filename,
line number, function name, text), and the entries are in order
from oldest to newest stack frame.
extract_tb(tb, limit=None)
Return a StackSummary object representing a list of
pre-processed entries from traceback.
This is useful for alternate formatting of stack traces. If
'limit' is omitted or None, all entries are extracted. A
pre-processed stack trace entry is a FrameSummary object
containing attributes filename, lineno, name, and line
representing the information that is usually printed for a stack
trace. The line is a string with leading and trailing
whitespace stripped; if the source is not available it is None.
format_exc(limit=None, chain=True)
Like print_exc() but return a string.
format_exception(exc, /, value=<implicit>, tb=<implicit>, limit=None, chain=True)
Format a stack trace and the exception information.
The arguments have the same meaning as the corresponding arguments
to print_exception(). The return value is a list of strings, each
ending in a newline and some containing internal newlines. When
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
format_exception_only(exc, /, value=<implicit>)
Format the exception part of a traceback.
The return value is a list of strings, each ending in a newline.
The list contains the exception's message, which is
normally a single string; however, for :exc:`SyntaxError` exceptions, it
contains several lines that (when printed) display detailed information
about where the syntax error occurred. Following the message, the list
contains the exception's ``__notes__``.
format_list(extracted_list)
Format a list of tuples or FrameSummary objects for printing.
Given a list of tuples or FrameSummary objects as returned by
extract_tb() or extract_stack(), return a list of strings ready
for printing.
Each string in the resulting list corresponds to the item with the
same index in the argument list. Each string ends in a newline;
the strings may contain internal newlines as well, for those items
whose source text line is not None.
format_stack(f=None, limit=None)
Shorthand for 'format_list(extract_stack(f, limit))'.
format_tb(tb, limit=None)
A shorthand for 'format_list(extract_tb(tb, limit))'.
print_exc(limit=None, file=None, chain=True)
Shorthand for 'print_exception(sys.exception(), limit, file, chain)'.
print_exception(exc, /, value=<implicit>, tb=<implicit>, limit=None, file=None, chain=True)
Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
This differs from print_tb() in the following ways: (1) if
traceback is not None, it prints a header "Traceback (most recent
call last):"; (2) it prints the exception type and value after the
stack trace; (3) if type is SyntaxError and value has the
appropriate format, it prints the line where the syntax error
occurred with a caret on the next line indicating the approximate
position of the error.
print_last(limit=None, file=None, chain=True)
This is a shorthand for 'print_exception(sys.last_exc, limit, file, chain)'.
print_stack(f=None, limit=None, file=None)
Print a stack trace from its invocation point.
The optional 'f' argument can be used to specify an alternate
stack frame at which to start. The optional 'limit' and 'file'
arguments have the same meaning as for print_exception().
print_tb(tb, limit=None, file=None)
Print up to 'limit' stack trace entries from the traceback 'tb'.
If 'limit' is omitted or None, all entries are printed. If 'file'
is omitted or None, the output goes to sys.stderr; otherwise
'file' should be an open file or file-like object with a write()
method.
walk_stack(f)
Walk a stack yielding the frame and line number for each frame.
This will follow f.f_back from the given frame. If no frame is given, the
current stack is used. Usually used with StackSummary.extract.
walk_tb(tb)
Walk a traceback yielding the frame and line number for each frame.
This will follow tb.tb_next (and thus is in the opposite order to
walk_stack). Usually used with StackSummary.extract.
DATA
__all__ = ['extract_stack', 'extract_tb', 'format_exception', 'format_...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\traceback.py
logging.config.valid_ident
Python Library Documentation: function valid_ident in module logging.config valid_ident(s)