Compare commits

..

2 Commits

Author SHA1 Message Date
Tyler Goodlet aca015f1c2 Mask top level import of `.hilevel`
Since it isn't required until the landing of the new service-manager
stuff in #12; was an oversight
from commit `0607a31dddeba032a2cf7d9fe605edd9d7bb4846`.
2025-03-27 15:57:44 -04:00
Tyler Goodlet 818cd8535f Support `ctx: UnionType` annots for `@tractor.context` eps 2025-03-27 15:56:39 -04:00
2 changed files with 12 additions and 2 deletions

View File

@ -67,4 +67,4 @@ from ._root import (
from ._ipc import Channel as Channel
from ._portal import Portal as Portal
from ._runtime import Actor as Actor
from . import hilevel as hilevel
# from . import hilevel as hilevel

View File

@ -47,6 +47,9 @@ from functools import partial
import inspect
from pprint import pformat
import textwrap
from types import (
UnionType,
)
from typing import (
Any,
AsyncGenerator,
@ -2548,7 +2551,14 @@ def context(
name: str
param: Type
for name, param in annots.items():
if param is Context:
if (
param is Context
or (
isinstance(param, UnionType)
and
Context in param.__args__
)
):
ctx_var_name: str = name
break
else: