From c265f3f94e647e24ba217f3b04a6180a005b425b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 29 Jan 2022 12:43:57 -0500 Subject: [PATCH] Move namespace path type into `msg` mod --- tractor/_portal.py | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/tractor/_portal.py b/tractor/_portal.py index 7f540e9..672c9af 100644 --- a/tractor/_portal.py +++ b/tractor/_portal.py @@ -21,7 +21,6 @@ concurrency linked tasks running in disparate memory domains. ''' from __future__ import annotations import importlib -from pkgutil import resolve_name import inspect from typing import ( Any, Optional, @@ -38,6 +37,7 @@ from async_generator import asynccontextmanager from ._state import current_actor from ._ipc import Channel from .log import get_logger +from .msg import NamespacePath from ._exceptions import ( unpack_error, NoResult, @@ -68,34 +68,6 @@ async def maybe_open_nursery( yield nursery -class NamespacePath(str): - ''' - A serializeable description of a (function) Python object location - described by the target's module path and its namespace key. - - ''' - def load_ref(self) -> object: - return resolve_name(self) - - def to_tuple( - self, - - ) -> tuple[str, str]: - ref = self.load_ref() - return ref.__module__, getattr(ref, '__name__', '') - - @classmethod - def from_ref( - cls, - obj, - - ) -> NamespacePath: - return cls(':'.join( - (obj.__module__, - obj.__name__,) - )) - - def _unwrap_msg( msg: dict[str, Any],