threading API Reference

Full documentation for threading (Standard Library / Native)

threading.Barrier
Python Library Documentation: class Barrier in module threading

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
threading.BoundedSemaphore
Python Library Documentation: class BoundedSemaphore in module threading

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
threading.BrokenBarrierError
Python Library Documentation: class BrokenBarrierError in module threading

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
threading.Condition
Python Library Documentation: class Condition in module threading

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
threading.Event
Python Library Documentation: class Event in module threading

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
threading.ExceptHookArgs
Python Library Documentation: class _ExceptHookArgs in module _thread

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
threading.Lock
Python Library Documentation: built-in function allocate_lock in module _thread

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.
threading.RLock
Python Library Documentation: function RLock in module threading

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.
threading.Semaphore
Python Library Documentation: class Semaphore in module threading

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
threading.TIMEOUT_MAX
Python Library Documentation: float object

class float(object)
 |  float(x=0, /)
 |
 |  Convert a string or number to a floating-point number, if possible.
 |
 |  Methods defined here:
 |
 |  __abs__(self, /)
 |      abs(self)
 |
 |  __add__(self, value, /)
 |      Return self+value.
 |
 |  __bool__(self, /)
 |      True if self else False
 |
 |  __ceil__(self, /)
 |      Return the ceiling as an Integral.
 |
 |  __divmod__(self, value, /)
 |      Return divmod(self, value).
 |
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  __float__(self, /)
 |      float(self)
 |
 |  __floor__(self, /)
 |      Return the floor as an Integral.
 |
 |  __floordiv__(self, value, /)
 |      Return self//value.
 |
 |  __format__(self, format_spec, /)
 |      Formats the float according to format_spec.
 |
 |  __ge__(self, value, /)
 |      Return self>=value.
 |
 |  __getnewargs__(self, /)
 |
 |  __gt__(self, value, /)
 |      Return self>value.
 |
 |  __hash__(self, /)
 |      Return hash(self).
 |
 |  __int__(self, /)
 |      int(self)
 |
 |  __le__(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).
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __rfloordiv__(self, value, /)
 |      Return value//self.
 |
 |  __rmod__(self, value, /)
 |      Return value%self.
 |
 |  __rmul__(self, value, /)
 |      Return value*self.
 |
 |  __round__(self, ndigits=None, /)
 |      Return the Integral closest to x, rounding half toward even.
 |
 |      When an argument is passed, work like built-in round(x, ndigits).
 |
 |  __rpow__(self, value, mod=None, /)
 |      Return pow(value, self, mod).
 |
 |  __rsub__(self, value, /)
 |      Return value-self.
 |
 |  __rtruediv__(self, value, /)
 |      Return value/self.
 |
 |  __sub__(self, value, /)
 |      Return self-value.
 |
 |  __truediv__(self, value, /)
 |      Return self/value.
 |
 |  __trunc__(self, /)
 |      Return the Integral closest to x between 0 and x.
 |
 |  as_integer_ratio(self, /)
 |      Return a pair of integers, whose ratio is exactly equal to the original float.
 |
 |      The ratio is in lowest terms and has a positive denominator.  Raise
 |      OverflowError on infinities and a ValueError on NaNs.
 |
 |      >>> (10.0).as_integer_ratio()
 |      (10, 1)
 |      >>> (0.0).as_integer_ratio()
 |      (0, 1)
 |      >>> (-.25).as_integer_ratio()
 |      (-1, 4)
 |
 |  conjugate(self, /)
 |      Return self, the complex conjugate of any float.
 |
 |  hex(self, /)
 |      Return a hexadecimal representation of a floating-point number.
 |
 |      >>> (-0.1).hex()
 |      '-0x1.999999999999ap-4'
 |      >>> 3.14159.hex()
 |      '0x1.921f9f01b866ep+1'
 |
 |  is_integer(self, /)
 |      Return True if the float is an integer.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __getformat__(typestr, /)
 |      You probably don't want to use this function.
 |
 |        typestr
 |          Must be 'double' or 'float'.
 |
 |      It exists mainly to be used in Python's test suite.
 |
 |      This function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE,
 |      little-endian' best describes the format of floating-point numbers used by the
 |      C type named by typestr.
 |
 |  fromhex(string, /)
 |      Create a floating-point number from a hexadecimal string.
 |
 |      >>> float.fromhex('0x1.ffffp10')
 |      2047.984375
 |      >>> float.fromhex('-0x1p-1074')
 |      -5e-324
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  imag
 |      the imaginary part of a complex number
 |
 |  real
 |      the real part of a complex number
threading.Thread
Python Library Documentation: class Thread in module threading

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.
threading.ThreadError
Python Library Documentation: class RuntimeError in module builtins

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
threading.Timer
Python Library Documentation: class Timer in module threading

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.
threading.WeakSet
Python Library Documentation: class WeakSet in module _weakrefset

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
threading.activeCount
Python Library Documentation: function activeCount in module threading

activeCount()
    Return the number of Thread objects currently alive.

    This function is deprecated, use active_count() instead.
threading.active_count
Python Library Documentation: function active_count in module threading

active_count()
    Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().
threading.currentThread
Python Library Documentation: function currentThread in module threading

currentThread()
    Return the current Thread object, corresponding to the caller's thread of control.

    This function is deprecated, use current_thread() instead.
threading.current_thread
Python Library Documentation: function current_thread in module threading

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.
threading.enumerate
Python Library Documentation: function enumerate in module threading

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.
threading.excepthook
Python Library Documentation: built-in function _excepthook in module _thread

_excepthook(...)
    excepthook(exc_type, exc_value, exc_traceback, thread)

    Handle uncaught Thread.run() exception.
threading.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

threading.get_ident
Python Library Documentation: built-in function get_ident in module _thread

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.
threading.get_native_id
Python Library Documentation: built-in function get_native_id in module _thread

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.
threading.getprofile
Python Library Documentation: function getprofile in module threading

getprofile()
    Get the profiler function as set by threading.setprofile().
threading.gettrace
Python Library Documentation: function gettrace in module threading

gettrace()
    Get the trace function as set by threading.settrace().
threading.local
Python Library Documentation: class _local in module _thread

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.
threading.main_thread
Python Library Documentation: function main_thread in module threading

main_thread()
    Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
threading.setprofile
Python Library Documentation: function setprofile in module threading

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.
threading.setprofile_all_threads
Python Library Documentation: function setprofile_all_threads in module threading

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.
threading.settrace
Python Library Documentation: function settrace in module threading

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.
threading.settrace_all_threads
Python Library Documentation: function settrace_all_threads in module threading

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.
threading.stack_size
Python Library Documentation: built-in function stack_size in module _thread

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).