plesty.lib.utils.registry ========================= .. py:module:: plesty.lib.utils.registry .. autoapi-nested-parse:: Resource registry and local IP utilities for Plesty. Classes ------- .. autoapisummary:: plesty.lib.utils.registry.ResourceRegistry Functions --------- .. autoapisummary:: plesty.lib.utils.registry.get_local_ip Module Contents --------------- .. py:class:: ResourceRegistry Global registry for tracking active device resource instances. .. py:attribute:: _active_resources :type: dict[Any, weakref.ref[Any]] .. py:method:: acquire(key: Any, obj: Any) -> None :classmethod: Register a resource under key, raising RuntimeError if already in use. A key whose previous holder has been garbage-collected (a dead weak reference) counts as free: the lock only guards against two *live* instances holding the same resource, so a stale entry is reclaimed rather than blocking acquisition. .. py:method:: release(key: Any) -> None :classmethod: Release a registered resource by key. .. py:function:: get_local_ip() -> str Return the local IP address of this machine.