doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
Queue([maxsize]) Create a shared queue.Queue object and return a proxy for it.
python.library.multiprocessing#multiprocessing.managers.SyncManager.Queue
RLock() Create a shared threading.RLock object and return a proxy for it.
python.library.multiprocessing#multiprocessing.managers.SyncManager.RLock
Semaphore([value]) Create a shared threading.Semaphore object and return a proxy for it.
python.library.multiprocessing#multiprocessing.managers.SyncManager.Semaphore
Value(typecode, value) Create an object with a writable value attribute and return a proxy for it.
python.library.multiprocessing#multiprocessing.managers.SyncManager.Value
multiprocessing.parent_process() Return the Process object corresponding to the parent process of the current_process(). For the main process, parent_process will be None. New in version 3.8.
python.library.multiprocessing#multiprocessing.parent_process
multiprocessing.Pipe([duplex]) Returns a pair (conn1, conn2) of Connection objects representing the ends of a pipe. If duplex is True (the default) then the pipe is bidirectional. If duplex is False then the pipe is unidirectional: conn1 can only be used for receiving messages and conn2 can only be used for sending m...
python.library.multiprocessing#multiprocessing.Pipe
class multiprocessing.pool.AsyncResult The class of the result returned by Pool.apply_async() and Pool.map_async(). get([timeout]) Return the result when it arrives. If timeout is not None and the result does not arrive within timeout seconds then multiprocessing.TimeoutError is raised. If the remote call raised ...
python.library.multiprocessing#multiprocessing.pool.AsyncResult
get([timeout]) Return the result when it arrives. If timeout is not None and the result does not arrive within timeout seconds then multiprocessing.TimeoutError is raised. If the remote call raised an exception then that exception will be reraised by get().
python.library.multiprocessing#multiprocessing.pool.AsyncResult.get
ready() Return whether the call has completed.
python.library.multiprocessing#multiprocessing.pool.AsyncResult.ready
successful() Return whether the call completed without raising an exception. Will raise ValueError if the result is not ready. Changed in version 3.7: If the result is not ready, ValueError is raised instead of AssertionError.
python.library.multiprocessing#multiprocessing.pool.AsyncResult.successful
wait([timeout]) Wait until the result is available or until timeout seconds pass.
python.library.multiprocessing#multiprocessing.pool.AsyncResult.wait
class multiprocessing.pool.Pool([processes[, initializer[, initargs[, maxtasksperchild[, context]]]]]) A process pool object which controls a pool of worker processes to which jobs can be submitted. It supports asynchronous results with timeouts and callbacks and has a parallel map implementation. processes is the nu...
python.library.multiprocessing#multiprocessing.pool.Pool
apply(func[, args[, kwds]]) Call func with arguments args and keyword arguments kwds. It blocks until the result is ready. Given this blocks, apply_async() is better suited for performing work in parallel. Additionally, func is only executed in one of the workers of the pool.
python.library.multiprocessing#multiprocessing.pool.Pool.apply
apply_async(func[, args[, kwds[, callback[, error_callback]]]]) A variant of the apply() method which returns a AsyncResult object. If callback is specified then it should be a callable which accepts a single argument. When the result becomes ready callback is applied to it, that is unless the call failed, in which c...
python.library.multiprocessing#multiprocessing.pool.Pool.apply_async
close() Prevents any more tasks from being submitted to the pool. Once all the tasks have been completed the worker processes will exit.
python.library.multiprocessing#multiprocessing.pool.Pool.close
imap(func, iterable[, chunksize]) A lazier version of map(). The chunksize argument is the same as the one used by the map() method. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Also if chunksize is 1 then the next() method of the i...
python.library.multiprocessing#multiprocessing.pool.Pool.imap
imap_unordered(func, iterable[, chunksize]) The same as imap() except that the ordering of the results from the returned iterator should be considered arbitrary. (Only when there is only one worker process is the order guaranteed to be “correct”.)
python.library.multiprocessing#multiprocessing.pool.Pool.imap_unordered
join() Wait for the worker processes to exit. One must call close() or terminate() before using join().
python.library.multiprocessing#multiprocessing.pool.Pool.join
map(func, iterable[, chunksize]) A parallel equivalent of the map() built-in function (it supports only one iterable argument though, for multiple iterables see starmap()). It blocks until the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate task...
python.library.multiprocessing#multiprocessing.pool.Pool.map
map_async(func, iterable[, chunksize[, callback[, error_callback]]]) A variant of the map() method which returns a AsyncResult object. If callback is specified then it should be a callable which accepts a single argument. When the result becomes ready callback is applied to it, that is unless the call failed, in whic...
python.library.multiprocessing#multiprocessing.pool.Pool.map_async
starmap(func, iterable[, chunksize]) Like map() except that the elements of the iterable are expected to be iterables that are unpacked as arguments. Hence an iterable of [(1,2), (3, 4)] results in [func(1,2), func(3,4)]. New in version 3.3.
python.library.multiprocessing#multiprocessing.pool.Pool.starmap
starmap_async(func, iterable[, chunksize[, callback[, error_callback]]]) A combination of starmap() and map_async() that iterates over iterable of iterables and calls func with the iterables unpacked. Returns a result object. New in version 3.3.
python.library.multiprocessing#multiprocessing.pool.Pool.starmap_async
terminate() Stops the worker processes immediately without completing outstanding work. When the pool object is garbage collected terminate() will be called immediately.
python.library.multiprocessing#multiprocessing.pool.Pool.terminate
class multiprocessing.pool.ThreadPool([processes[, initializer[, initargs]]]) A thread pool object which controls a pool of worker threads to which jobs can be submitted. ThreadPool instances are fully interface compatible with Pool instances, and their resources must also be properly managed, either by using the poo...
python.library.multiprocessing#multiprocessing.pool.ThreadPool
class multiprocessing.Process(group=None, target=None, name=None, args=(), kwargs={}, *, daemon=None) Process objects represent activity that is run in a separate process. The Process class has equivalents of all the methods of threading.Thread. The constructor should always be called with keyword arguments. group sh...
python.library.multiprocessing#multiprocessing.Process
authkey The process’s authentication key (a byte string). When multiprocessing is initialized the main process is assigned a random string using os.urandom(). When a Process object is created, it will inherit the authentication key of its parent process, although this may be changed by setting authkey to another byte...
python.library.multiprocessing#multiprocessing.Process.authkey
close() Close the Process object, releasing all resources associated with it. ValueError is raised if the underlying process is still running. Once close() returns successfully, most other methods and attributes of the Process object will raise ValueError. New in version 3.7.
python.library.multiprocessing#multiprocessing.Process.close
daemon The process’s daemon flag, a Boolean value. This must be set before start() is called. The initial value is inherited from the creating process. When a process exits, it attempts to terminate all of its daemonic child processes. Note that a daemonic process is not allowed to create child processes. Otherwise a...
python.library.multiprocessing#multiprocessing.Process.daemon
exitcode The child’s exit code. This will be None if the process has not yet terminated. A negative value -N indicates that the child was terminated by signal N.
python.library.multiprocessing#multiprocessing.Process.exitcode
is_alive() Return whether the process is alive. Roughly, a process object is alive from the moment the start() method returns until the child process terminates.
python.library.multiprocessing#multiprocessing.Process.is_alive
join([timeout]) If the optional argument timeout is None (the default), the method blocks until the process whose join() method is called terminates. If timeout is a positive number, it blocks at most timeout seconds. Note that the method returns None if its process terminates or if the method times out. Check the pr...
python.library.multiprocessing#multiprocessing.Process.join
kill() Same as terminate() but using the SIGKILL signal on Unix. New in version 3.7.
python.library.multiprocessing#multiprocessing.Process.kill
name The process’s name. The name is a string used for identification purposes only. It has no semantics. Multiple processes may be given the same name. The initial name is set by the constructor. If no explicit name is provided to the constructor, a name of the form ‘Process-N1:N2:…:Nk’ is constructed, where each Nk...
python.library.multiprocessing#multiprocessing.Process.name
pid Return the process ID. Before the process is spawned, this will be None.
python.library.multiprocessing#multiprocessing.Process.pid
run() Method representing the process’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.
python.library.multiprocessing#multiprocessing.Process.run
sentinel A numeric handle of a system object which will become “ready” when the process ends. You can use this value if you want to wait on several events at once using multiprocessing.connection.wait(). Otherwise calling join() is simpler. On Windows, this is an OS handle usable with the WaitForSingleObject and Wait...
python.library.multiprocessing#multiprocessing.Process.sentinel
start() Start the process’s activity. This must be called at most once per process object. It arranges for the object’s run() method to be invoked in a separate process.
python.library.multiprocessing#multiprocessing.Process.start
terminate() Terminate the process. On Unix this is done using the SIGTERM signal; on Windows TerminateProcess() is used. Note that exit handlers and finally clauses, etc., will not be executed. Note that descendant processes of the process will not be terminated – they will simply become orphaned. Warning If this me...
python.library.multiprocessing#multiprocessing.Process.terminate
exception multiprocessing.ProcessError The base class of all multiprocessing exceptions.
python.library.multiprocessing#multiprocessing.ProcessError
class multiprocessing.Queue([maxsize]) Returns a process shared queue implemented using a pipe and a few locks/semaphores. When a process first puts an item on the queue a feeder thread is started which transfers objects from a buffer into the pipe. The usual queue.Empty and queue.Full exceptions from the standard li...
python.library.multiprocessing#multiprocessing.Queue
cancel_join_thread() Prevent join_thread() from blocking. In particular, this prevents the background thread from being joined automatically when the process exits – see join_thread(). A better name for this method might be allow_exit_without_flush(). It is likely to cause enqueued data to lost, and you almost certai...
python.library.multiprocessing#multiprocessing.Queue.cancel_join_thread
close() Indicate that no more data will be put on this queue by the current process. The background thread will quit once it has flushed all buffered data to the pipe. This is called automatically when the queue is garbage collected.
python.library.multiprocessing#multiprocessing.Queue.close
empty() Return True if the queue is empty, False otherwise. Because of multithreading/multiprocessing semantics, this is not reliable.
python.library.multiprocessing#multiprocessing.Queue.empty
full() Return True if the queue is full, False otherwise. Because of multithreading/multiprocessing semantics, this is not reliable.
python.library.multiprocessing#multiprocessing.Queue.full
get([block[, timeout]]) Remove and return an item from the queue. If optional args block is True (the default) and timeout is None (the default), block if necessary until an item is available. If timeout is a positive number, it blocks at most timeout seconds and raises the queue.Empty exception if no item was availa...
python.library.multiprocessing#multiprocessing.Queue.get
get_nowait() Equivalent to get(False).
python.library.multiprocessing#multiprocessing.Queue.get_nowait
join_thread() Join the background thread. This can only be used after close() has been called. It blocks until the background thread exits, ensuring that all data in the buffer has been flushed to the pipe. By default if a process is not the creator of the queue then on exit it will attempt to join the queue’s backgr...
python.library.multiprocessing#multiprocessing.Queue.join_thread
put(obj[, block[, timeout]]) Put obj into the queue. If the optional argument block is True (the default) and timeout is None (the default), block if necessary until a free slot is available. If timeout is a positive number, it blocks at most timeout seconds and raises the queue.Full exception if no free slot was ava...
python.library.multiprocessing#multiprocessing.Queue.put
put_nowait(obj) Equivalent to put(obj, False).
python.library.multiprocessing#multiprocessing.Queue.put_nowait
qsize() Return the approximate size of the queue. Because of multithreading/multiprocessing semantics, this number is not reliable. Note that this may raise NotImplementedError on Unix platforms like Mac OS X where sem_getvalue() is not implemented.
python.library.multiprocessing#multiprocessing.Queue.qsize
class multiprocessing.RLock A recursive lock object: a close analog of threading.RLock. A recursive lock must be released by the process or thread that acquired it. Once a process or thread has acquired a recursive lock, the same process or thread may acquire it again without blocking; that process or thread must rel...
python.library.multiprocessing#multiprocessing.RLock
acquire(block=True, timeout=None) Acquire a lock, blocking or non-blocking. When invoked with the block argument set to True, block until the lock is in an unlocked state (not owned by any process or thread) unless the lock is already owned by the current process or thread. The current process or thread then takes ow...
python.library.multiprocessing#multiprocessing.RLock.acquire
release() Release a lock, decrementing the recursion level. If after the decrement the recursion level is zero, reset the lock to unlocked (not owned by any process or thread) and if any other processes or threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the ...
python.library.multiprocessing#multiprocessing.RLock.release
class multiprocessing.Semaphore([value]) A semaphore object: a close analog of threading.Semaphore. A solitary difference from its close analog exists: its acquire method’s first argument is named block, as is consistent with Lock.acquire().
python.library.multiprocessing#multiprocessing.Semaphore
multiprocessing.set_executable() Sets the path of the Python interpreter to use when starting a child process. (By default sys.executable is used). Embedders will probably need to do some thing like set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe')) before they can create child processes. Changed in versi...
python.library.multiprocessing#multiprocessing.set_executable
multiprocessing.set_start_method(method) Set the method which should be used to start child processes. method can be 'fork', 'spawn' or 'forkserver'. Note that this should be called at most once, and it should be protected inside the if __name__ == '__main__' clause of the main module. New in version 3.4.
python.library.multiprocessing#multiprocessing.set_start_method
multiprocessing.sharedctypes.Array(typecode_or_type, size_or_initializer, *, lock=True) The same as RawArray() except that depending on the value of lock a process-safe synchronization wrapper may be returned instead of a raw ctypes array. If lock is True (the default) then a new lock object is created to synchronize...
python.library.multiprocessing#multiprocessing.sharedctypes.Array
multiprocessing.sharedctypes.copy(obj) Return a ctypes object allocated from shared memory which is a copy of the ctypes object obj.
python.library.multiprocessing#multiprocessing.sharedctypes.copy
multiprocessing.Manager() Returns a started SyncManager object which can be used for sharing objects between processes. The returned manager object corresponds to a spawned child process and has methods which will create shared objects and return corresponding proxies.
python.library.multiprocessing#multiprocessing.sharedctypes.multiprocessing.Manager
multiprocessing.sharedctypes.RawArray(typecode_or_type, size_or_initializer) Return a ctypes array allocated from shared memory. typecode_or_type determines the type of the elements of the returned array: it is either a ctypes type or a one character typecode of the kind used by the array module. If size_or_initializ...
python.library.multiprocessing#multiprocessing.sharedctypes.RawArray
multiprocessing.sharedctypes.RawValue(typecode_or_type, *args) Return a ctypes object allocated from shared memory. typecode_or_type determines the type of the returned object: it is either a ctypes type or a one character typecode of the kind used by the array module. *args is passed on to the constructor for the ty...
python.library.multiprocessing#multiprocessing.sharedctypes.RawValue
multiprocessing.sharedctypes.synchronized(obj[, lock]) Return a process-safe wrapper object for a ctypes object which uses lock to synchronize access. If lock is None (the default) then a multiprocessing.RLock object is created automatically. A synchronized wrapper will have two methods in addition to those of the ob...
python.library.multiprocessing#multiprocessing.sharedctypes.synchronized
multiprocessing.sharedctypes.Value(typecode_or_type, *args, lock=True) The same as RawValue() except that depending on the value of lock a process-safe synchronization wrapper may be returned instead of a raw ctypes object. If lock is True (the default) then a new lock object is created to synchronize access to the v...
python.library.multiprocessing#multiprocessing.sharedctypes.Value
multiprocessing.shared_memory — Provides shared memory for direct access across processes Source code: Lib/multiprocessing/shared_memory.py New in version 3.8. This module provides a class, SharedMemory, for the allocation and management of shared memory to be accessed by one or more processes on a multicore or symme...
python.library.multiprocessing.shared_memory
class multiprocessing.shared_memory.ShareableList(sequence=None, *, name=None) Provides a mutable list-like object where all values stored within are stored in a shared memory block. This constrains storable values to only the int, float, bool, str (less than 10M bytes each), bytes (less than 10M bytes each), and Non...
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.ShareableList
count(value) Returns the number of occurrences of value.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.ShareableList.count
format Read-only attribute containing the struct packing format used by all currently stored values.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.ShareableList.format
index(value) Returns first index position of value. Raises ValueError if value is not present.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.ShareableList.index
shm The SharedMemory instance where the values are stored.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.ShareableList.shm
class multiprocessing.shared_memory.SharedMemory(name=None, create=False, size=0) Creates a new shared memory block or attaches to an existing shared memory block. Each shared memory block is assigned a unique name. In this way, one process can create a shared memory block with a particular name and a different proce...
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory
buf A memoryview of contents of the shared memory block.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory.buf
close() Closes access to the shared memory from this instance. In order to ensure proper cleanup of resources, all instances should call close() once the instance is no longer needed. Note that calling close() does not cause the shared memory block itself to be destroyed.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory.close
name Read-only access to the unique name of the shared memory block.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory.name
size Read-only access to size in bytes of the shared memory block.
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory.size
unlink() Requests that the underlying shared memory block be destroyed. In order to ensure proper cleanup of resources, unlink() should be called once (and only once) across all processes which have need for the shared memory block. After requesting its destruction, a shared memory block may or may not be immediately...
python.library.multiprocessing.shared_memory#multiprocessing.shared_memory.SharedMemory.unlink
class multiprocessing.SimpleQueue It is a simplified Queue type, very close to a locked Pipe. close() Close the queue: release internal resources. A queue must not be used anymore after it is closed. For example, get(), put() and empty() methods must no longer be called. New in version 3.9. empty() Return...
python.library.multiprocessing#multiprocessing.SimpleQueue
close() Close the queue: release internal resources. A queue must not be used anymore after it is closed. For example, get(), put() and empty() methods must no longer be called. New in version 3.9.
python.library.multiprocessing#multiprocessing.SimpleQueue.close
empty() Return True if the queue is empty, False otherwise.
python.library.multiprocessing#multiprocessing.SimpleQueue.empty
get() Remove and return an item from the queue.
python.library.multiprocessing#multiprocessing.SimpleQueue.get
put(item) Put item into the queue.
python.library.multiprocessing#multiprocessing.SimpleQueue.put
exception multiprocessing.TimeoutError Raised by methods with a timeout when the timeout expires.
python.library.multiprocessing#multiprocessing.TimeoutError
multiprocessing.Value(typecode_or_type, *args, lock=True) Return a ctypes object allocated from shared memory. By default the return value is actually a synchronized wrapper for the object. The object itself can be accessed via the value attribute of a Value. typecode_or_type determines the type of the returned objec...
python.library.multiprocessing#multiprocessing.Value
exception NameError Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found.
python.library.exceptions#NameError
netrc — netrc file processing Source code: Lib/netrc.py The netrc class parses and encapsulates the netrc file format used by the Unix ftp program and other FTP clients. class netrc.netrc([file]) A netrc instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, spec...
python.library.netrc
class netrc.netrc([file]) A netrc instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, specifies the file to parse. If no argument is given, the file .netrc in the user’s home directory – as determined by os.path.expanduser() – will be read. Otherwise, a FileNotF...
python.library.netrc#netrc.netrc
netrc.authenticators(host) Return a 3-tuple (login, account, password) of authenticators for host. If the netrc file did not contain an entry for the given host, return the tuple associated with the ‘default’ entry. If neither matching host nor default entry is available, return None.
python.library.netrc#netrc.netrc.authenticators
netrc.hosts Dictionary mapping host names to (login, account, password) tuples. The ‘default’ entry, if any, is represented as a pseudo-host by that name.
python.library.netrc#netrc.netrc.hosts
netrc.macros Dictionary mapping macro names to string lists.
python.library.netrc#netrc.netrc.macros
netrc.__repr__() Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.)
python.library.netrc#netrc.netrc.__repr__
exception netrc.NetrcParseError Exception raised by the netrc class when syntactical errors are encountered in source text. Instances of this exception provide three interesting attributes: msg is a textual explanation of the error, filename is the name of the source file, and lineno gives the line number on which th...
python.library.netrc#netrc.NetrcParseError
next(iterator[, default]) Retrieve the next item from the iterator by calling its __next__() method. If default is given, it is returned if the iterator is exhausted, otherwise StopIteration is raised.
python.library.functions#next
nis — Interface to Sun’s NIS (Yellow Pages) The nis module gives a thin wrapper around the NIS library, useful for central administration of several hosts. Because NIS exists only on Unix systems, this module is only available for Unix. The nis module defines the following functions: nis.match(key, mapname, domain=de...
python.library.nis
nis.cat(mapname, domain=default_domain) Return a dictionary mapping key to value such that match(key, mapname)==value. Note that both keys and values of the dictionary are arbitrary arrays of bytes. Note that mapname is first checked if it is an alias to another name. The domain argument allows overriding the NIS dom...
python.library.nis#nis.cat
exception nis.error An error raised when a NIS function returns an error code.
python.library.nis#nis.error
nis.get_default_domain() Return the system default NIS domain.
python.library.nis#nis.get_default_domain
nis.maps(domain=default_domain) Return a list of all valid maps. The domain argument allows overriding the NIS domain used for the lookup. If unspecified, lookup is in the default NIS domain.
python.library.nis#nis.maps
nis.match(key, mapname, domain=default_domain) Return the match for key in map mapname, or raise an error (nis.error) if there is none. Both should be strings, key is 8-bit clean. Return value is an arbitrary array of bytes (may contain NULL and other joys). Note that mapname is first checked if it is an alias to ano...
python.library.nis#nis.match
BaseHandler.http_error_<nnn>(req, fp, code, msg, hdrs) nnn should be a three-digit HTTP error code. This method is also not defined in BaseHandler, but will be called, if it exists, on an instance of a subclass, when an HTTP error with code nnn occurs. Subclasses should override this method to handle specific HTTP er...
python.library.urllib.request#nnn
nntplib — NNTP protocol client Source code: Lib/nntplib.py This module defines the class NNTP which implements the client side of the Network News Transfer Protocol. It can be used to implement a news reader or poster, or automated news processors. It is compatible with RFC 3977 as well as the older RFC 977 and RFC 298...
python.library.nntplib
nntplib.decode_header(header_str) Decode a header value, un-escaping any escaped non-ASCII characters. header_str must be a str object. The unescaped value is returned. Using this function is recommended to display some headers in a human readable form: >>> decode_header("Some subject") 'Some subject' >>> decode_head...
python.library.nntplib#nntplib.decode_header