Module Expr Str Import alias Import alias Import alias ClassDef bases NameLoad body Expr Str Pass decorator_list ClassDef bases body Expr Str Assign NameStore Num Assign NameStore NameLoad FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Dict decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareLtE Call NameLoad AttributeLoad NameLoad attr Num body Return Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If CompareIn NameLoad NameLoad body Delete SubscriptDel NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assert CompareEq Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Dict For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign SubscriptStore NameLoad Index NameLoad Num Assign SubscriptStore NameLoad Index NameLoad Num For NameStore Call AttributeLoad NameLoad attr body AugAssignAdd SubscriptStore NameLoad Index NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Delete SubscriptDel NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body If CompareEq NameLoad Num body Delete SubscriptDel NameLoad Index NameLoad Assign NameStore NameLoad If UnaryOpNot NameLoad body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assert CompareIs AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str While NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Return ExceptHandler body Expr Call AttributeLoad NameLoad attr BinOpAdd Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore Str FunctionDef arguments args NameParam defaults vararg body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str While NameLoad body If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If BoolOpOr UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Break orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assert UnaryOpNot NameLoad Return NameLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If BoolOpOr UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Break orelse Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assert UnaryOpNot NameLoad Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareNotIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr orelse If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr orelse If NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Assert Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareNotEq NameLoad AttributeLoad NameLoad attr While NameLoad body If CompareIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr If UnaryOpNot Call AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr orelse Break orelse If AttributeLoad NameLoad attr body For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If Call AttributeLoad NameLoad attr body Break orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Continue Break orelse Break Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareNotEq NameLoad AttributeLoad NameLoad attr If CompareIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr If UnaryOpNot Call AttributeLoad NameLoad attr body Return NameLoad orelse If AttributeLoad NameLoad attr body For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If Call AttributeLoad NameLoad attr body Break orelse Return NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIn NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse Assign NameStore SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIn NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse Assign NameStore SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assert CompareNotEq NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpOr UnaryOpNot AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr If BoolOpAnd UnaryOpNot Call AttributeLoad NameLoad attr UnaryOpNot NameLoad body Delete SubscriptDel AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore AttributeLoad AttributeLoad NameLoad attr attr body For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Break orelse Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareIn NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse Assign NameStore SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Assert CompareNotIn NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad If AttributeLoad NameLoad attr body For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareNotEq NameLoad NameLoad body Assert CompareNotIn NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad If AttributeLoad NameLoad attr body If CompareIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr For NameStore AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr Assert CompareNotIn NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list decorator_list
N/A N/A locksmith.py

This is a class that manages a set of locks.
 N/A coro N/A random N/A tb DeadlockError N/A Exception N/A N/A DeadlockError

    Raised when an attempt to call lock() causes a deadlock.
     N/A N/A LockSmith N/A N/A N/A LockSmith()

    This class manages a set of locks.
    Locks are associated with a key.
    A separate thread handles detecting deadlocks.
     N/A deadlock_check_period 60 N/A thread None __init__ N/A N/A self N/A N/A N/A N/A self locks N/A N/A __len__ N/A N/A self N/A N/A N/A N/A len N/A self locks N/A check_for_deadlocks N/A N/A self N/A N/A N/A check_for_deadlocks(self) -> None
        This will check for deadlocks.
        Deadlocks will be broken by picking one of the deadlocked threads and
        raising DeadlockError on it.
         N/A N/A N/A len N/A self locks 1 N/A N/A N/A g N/A N/A self _build_graph N/A thread_ids N/A N/A self _find_threads_to_break g N/A thread_id thread_ids N/A N/A thread N/A N/A coro all_threads N/A thread_id N/A N/A N/A thread raise_exception DeadlockError N/A __debug__ N/A N/A N/A k v N/A N/A g items N/A N/A N/A v thread_ids N/A N/A N/A g N/A k N/A cycle_g N/A N/A self _find_cycles g N/A N/A N/A len cycle_g 0 N/A _build_graph N/A N/A self N/A N/A N/A _build_graph(self) -> g
        Builds a wait-for-graph based on the threads in the locks.
         N/A NotImplementedError N/A _in_degree N/A N/A self g N/A N/A N/A _in_degree (self, g) -> indegree_dict
        Computes the in-degree for each vertex and returns a dictionary where
        the key is the vertex and the value is its in-degree.

        <g>: A graph.  Dictionary with keys as nodes and value is a list of
        nodes pointing to it.
         N/A r N/A N/A N/A k v N/A N/A g iteritems N/A N/A N/A r N/A k 0 N/A N/A r N/A v 0 N/A v N/A N/A g itervalues N/A N/A N/A r N/A v 1 N/A r N/A _find_threads_to_break N/A N/A self g N/A N/A N/A _find_threads_to_break(self, g) -> thread_id_list
        Find threads to interrupt with DeadlockError in order to break any
        cycles that exist.  In a cycle, it picks a thread at random to break
        the cycle.  There can be more than 1 thread returned if there are
        multiple cycles.
         N/A to_break N/A N/A cycle_g N/A N/A self _find_cycles g N/A cycle_g N/A N/A thread N/A N/A random choice N/A N/A cycle_g keys N/A N/A cycle_g N/A thread N/A N/A N/A to_break append thread N/A cycle_g N/A N/A self _find_cycles cycle_g N/A to_break N/A _find_cycles N/A N/A self g N/A N/A N/A _find_cycles(g) -> cycle_g
        Finds cycles in the given graph.

        <g>: A graph.  Dictionary with keys as nodes and value the node it is
        pointing to.

        Returns <g> with all nodes not involved in a cycle removed.
         N/A g N/A N/A g copy N/A True N/A N/A in_d N/A N/A self _in_degree g N/A found False N/A N/A k v N/A N/A in_d iteritems N/A N/A N/A v 0 N/A N/A N/A g N/A k N/A found True N/A N/A found N/A N/A g N/A start_manager_thread N/A N/A self N/A N/A N/A start_manager_thread(self) -> None
        This will spawn a thread that continually monitors the locks looking
        for deadlocks.
         N/A N/A N/A self thread None N/A N/A self thread N/A N/A coro spawn N/A self thread_manager thread_name locksmith_cycle_manager N/A thread_manager N/A N/A self N/A N/A N/A thread_manager(self) -> None
        This is the deadlock detection thread.
         N/A True N/A N/A N/A N/A N/A N/A coro sleep_relative N/A self deadlock_check_period N/A N/A N/A self check_for_deadlocks N/A N/A N/A N/A coro Interrupted N/A N/A N/A self thread None N/A N/A N/A N/A N/A N/A coro print_stderr N/A N/A N/A tb traceback_string N/A stop_manager_thread N/A N/A self N/A N/A N/A stop_manager_thread(self) -> None
        This will stop the manager thread.
         N/A N/A N/A self thread None N/A N/A N/A N/A N/A self thread shutdown N/A N/A MutexLockSmith N/A LockSmith N/A N/A global_lock_name __global__ __init__ N/A N/A self N/A args N/A N/A N/A N/A LockSmith __init__ self args N/A N/A self global_cv N/A N/A coro condition_variable N/A N/A self global_finished_cv N/A N/A coro condition_variable N/A lock_global N/A N/A self N/A N/A N/A lock_global(self) -> None
        Acquires the global lock.
         N/A True N/A N/A N/A N/A self locks N/A N/A N/A N/A self _lock N/A self global_lock_name N/A N/A lock N/A N/A N/A self locks values N/A N/A N/A N/A N/A N/A lock has_lock lock N/A N/A N/A N/A N/A N/A self _lock N/A self global_lock_name N/A N/A N/A N/A N/A self global_cv wait N/A try_lock_global N/A N/A self N/A N/A N/A try_lock_global(self) -> boolean
        Attempts to acquire the global lock, without blocking. Returns true
        on failure and false on success, mirroring the behavior of
        coro.mutex.trylock().
         N/A N/A N/A self locks N/A N/A rv N/A N/A self _trylock N/A self global_lock_name N/A N/A rv N/A False N/A lock N/A N/A N/A self locks values N/A N/A N/A N/A N/A N/A lock has_lock lock N/A N/A N/A N/A N/A N/A self _trylock N/A self global_lock_name N/A N/A rv N/A False N/A True N/A unlock_global N/A N/A self N/A N/A N/A unlock_global(self) -> None
        Unlock the global lock.
         N/A N/A N/A self _unlock N/A self global_lock_name N/A N/A N/A self global_lock_name N/A self locks N/A N/A N/A self global_cv N/A N/A N/A N/A N/A self global_cv wake_all N/A N/A N/A self global_finished_cv N/A N/A N/A N/A N/A self global_finished_cv wake_all N/A N/A __debug__ N/A N/A lock N/A N/A self locks N/A N/A self global_lock_name N/A N/A N/A lock has_lock N/A lock N/A N/A self key N/A N/A N/A lock(self, key) -> None
        Aquires a lock for the given key.
         N/A N/A key N/A self global_lock_name N/A True N/A N/A N/A N/A self global_lock_name N/A self locks N/A N/A lock N/A N/A self locks N/A N/A self global_lock_name N/A N/A N/A N/A lock has_lock N/A N/A N/A N/A N/A self global_finished_cv wait N/A N/A N/A N/A N/A self global_cv N/A N/A lock N/A N/A N/A self locks values N/A N/A N/A N/A lock has_lock N/A N/A N/A N/A N/A N/A N/A self global_finished_cv wait N/A N/A N/A N/A N/A N/A N/A self _lock key N/A try_lock N/A N/A self key N/A N/A N/A try_lock(self, key) -> boolean
        Attempts to acquire a lock for the given key, without blocking. Returns
        true on failure and false on success, mirroring the behavior of
        coro.mutex.trylock().
         N/A N/A key N/A self global_lock_name N/A N/A N/A self global_lock_name N/A self locks N/A N/A lock N/A N/A self locks N/A N/A self global_lock_name N/A N/A N/A N/A lock has_lock N/A N/A True N/A N/A N/A self global_cv N/A N/A lock N/A N/A N/A self locks values N/A N/A N/A N/A lock has_lock N/A N/A N/A N/A True N/A N/A N/A self _trylock key N/A _lock N/A N/A self key N/A N/A N/A N/A key N/A self locks N/A N/A lock N/A N/A self locks N/A key N/A N/A lock N/A N/A self locks N/A key N/A N/A coro mutex N/A N/A N/A lock lock N/A _trylock N/A N/A self key N/A N/A N/A N/A key N/A self locks N/A N/A lock N/A N/A self locks N/A key N/A N/A lock N/A N/A self locks N/A key N/A N/A coro mutex N/A N/A N/A lock trylock N/A unlock N/A N/A self key N/A N/A N/A unlock(self, key) -> None
        Releases a lock for the given key.

        Raises KeyError if no lock is being held.
         N/A N/A key N/A self global_lock_name N/A N/A N/A self _unlock key N/A N/A N/A N/A self locks N/A N/A self _global_waiter_has_all_locks N/A N/A N/A N/A N/A self global_cv wake_all N/A _unlock N/A N/A self key N/A N/A N/A lock N/A N/A self locks N/A key N/A N/A N/A lock unlock N/A N/A N/A N/A N/A lock locked N/A lock N/A N/A N/A N/A self locks N/A key N/A _global_waiter_has_all_locks N/A N/A self N/A N/A N/A _global_waiter_has_all_locks(self) -> boolean
        Returns whether or not one of the threads waiting for the global lock
        owns all locks.
         N/A t N/A N/A self global_cv _waiting N/A N/A lock N/A N/A N/A self locks values N/A N/A N/A N/A N/A lock has_lock t N/A N/A N/A N/A True N/A False N/A trylock N/A N/A self key N/A N/A N/A trylock(self, key) -> boolean
        Attempts to lock the mutex.  If it is already locked, then it
        returns 1.  If it successfully acquires the lock, it returns 0.
         N/A N/A key N/A self locks N/A N/A lock N/A N/A self locks N/A key N/A N/A lock N/A N/A self locks N/A key N/A N/A coro mutex N/A N/A N/A lock trylock N/A _build_graph N/A N/A self N/A N/A N/A _build_graph(self) -> g
        Builds a wait-for-graph based on the threads in the locks.
         N/A g N/A N/A lock N/A N/A N/A self locks values N/A N/A owner_id N/A N/A N/A lock _owner thread_id N/A t N/A lock _waiting N/A N/A thread_id N/A N/A t thread_id N/A N/A thread_id g N/A N/A g N/A thread_id owner_id N/A N/A self global_cv N/A N/A t N/A N/A self global_cv _waiting N/A N/A thread_id N/A N/A t thread_id N/A lock N/A N/A N/A self locks values N/A N/A lock_owner_thread_id N/A N/A N/A lock _owner thread_id N/A N/A thread_id lock_owner_thread_id N/A N/A N/A thread_id g N/A N/A g N/A thread_id lock_owner_thread_id N/A N/A self global_finished_cv N/A N/A N/A N/A self global_lock_name N/A self locks N/A N/A lock N/A N/A self locks N/A N/A self global_lock_name N/A owner_thread_id N/A N/A N/A lock _owner thread_id N/A t N/A N/A self global_finished_cv _waiting N/A N/A thread_id N/A N/A t thread_id N/A N/A thread_id g N/A N/A g N/A thread_id owner_thread_id N/A g N/A N/A