ValuesView,
)
+from pyutils.typez.typing import Closable
+
class PickleSerializer:
"""A serializer that uses pickling. Used to read/write bytes in the shared
# whole thing?
-class SharedDict(object):
+class SharedDict(Closable):
"""This class emulates the dict container but uses a
`Multiprocessing.SharedMemory` region to back the dict such that it
can be read and written by multiple independent processes at the
import threading
from typing import Any, Callable, Optional, Tuple
+from pyutils.typez.typing import Runnable
+
# This module is commonly used by others in here and should avoid
# taking any unnecessary dependencies back on them.
return wrapper(_funct)
-class ThreadWithReturnValue(threading.Thread):
+class ThreadWithReturnValue(threading.Thread, Runnable):
"""A thread whose return value is plumbed back out as the return
value of :meth:`join`. Use like a normal thread::
@abstractmethod
def __eq__(self, other: Any) -> bool:
...
+
+
+class Closable(Protocol):
+ """Something that can be closed."""
+
+ def close(self) -> None:
+ ...
+
+
+class Cloneable(Protocol):
+ """Something that can be cloned."""
+
+ def clone(self) -> None:
+ ...
+
+
+class Runnable(Protocol):
+ """Something that can be run."""
+
+ def run(self) -> None:
+ ...