logging.handlers.MemoryHandler

class logging.handlers.MemoryHandler(capacity, flushLevel=ERROR, target=None) Returns a new instance of the MemoryHandler class. The instance is initialized with a buffer size of capacity. If flushLevel is not specified, ERROR is used. If no target is specified, the target will need to be set using setTarget() before this handler does anything useful. close() Calls flush(), sets the target to None and clears the buffer. flush() For a MemoryHandler, flushing means just sending the bu

importlib.util.MAGIC_NUMBER

importlib.util.MAGIC_NUMBER The bytes which represent the bytecode version number. If you need help with loading/writing bytecode then consider importlib.abc.SourceLoader. New in version 3.4.

ctypes.WinError()

ctypes.WinError(code=None, descr=None) Windows only: this function is probably the worst-named thing in ctypes. It creates an instance of OSError. If code is not specified, GetLastError is called to determine the error code. If descr is not specified, FormatError() is called to get a textual description of the error. Changed in version 3.3: An instance of WindowsError used to be created.

concurrent.futures.Future.add_done_callback()

add_done_callback(fn) Attaches the callable fn to the future. fn will be called, with the future as its only argument, when the future is cancelled or finishes running. Added callables are called in the order that they were added and are always called in a thread belonging to the process that added them. If the callable raises an Exception subclass, it will be logged and ignored. If the callable raises a BaseException subclass, the behavior is undefined. If the future has already completed o

socket.socket.recvmsg_into()

socket.recvmsg_into(buffers[, ancbufsize[, flags]]) Receive normal data and ancillary data from the socket, behaving as recvmsg() would, but scatter the non-ancillary data into a series of buffers instead of returning a new bytes object. The buffers argument must be an iterable of objects that export writable buffers (e.g. bytearray objects); these will be filled with successive chunks of the non-ancillary data until it has all been written or there are no more buffers. The operating system

textwrap.indent()

textwrap.indent(text, prefix, predicate=None) Add prefix to the beginning of selected lines in text. Lines are separated by calling text.splitlines(True). By default, prefix is added to all lines that do not consist solely of whitespace (including any line endings). For example: >>> s = 'hello\n\n \nworld' >>> indent(s, ' ') ' hello\n\n \n world' The optional predicate argument can be used to control which lines are indented. For example, it is easy to add prefix to eve

test.support.temp_umask()

test.support.temp_umask(umask) A context manager that temporarily sets the process umask.

socket.getprotobyname()

socket.getprotobyname(protocolname) Translate an Internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function. This is usually only needed for sockets opened in “raw” mode (SOCK_RAW); for the normal socket modes, the correct protocol is chosen automatically if the protocol is omitted or zero.

unittest.TestCase.assertAlmostEqual()

assertAlmostEqual(first, second, places=7, msg=None, delta=None) assertNotAlmostEqual(first, second, places=7, msg=None, delta=None) Test that first and second are approximately (or not approximately) equal by computing the difference, rounding to the given number of decimal places (default 7), and comparing to zero. Note that these methods round the values to the given number of decimal places (i.e. like the round() function) and not significant digits. If delta is supplied instead of places

urllib.robotparser.RobotFileParser.mtime()

mtime() Returns the time the robots.txt file was last fetched. This is useful for long-running web spiders that need to check for new robots.txt files periodically.