.data.feed: move `Flume` import to avoid cycle
Move `Flume` to `TYPE_CHECKING` and add runtime imports in `allocate_persistent_feed()` + `open_feed()` to avoid cycle with `.flows` mod. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codetpt_closed_and_finally_footguns
parent
9d01b5367b
commit
d0eb6b479d
|
|
@ -62,7 +62,6 @@ from ._util import (
|
|||
log,
|
||||
get_console_log,
|
||||
)
|
||||
from .flows import Flume
|
||||
from .validate import (
|
||||
FeedInit,
|
||||
validate_backend,
|
||||
|
|
@ -77,6 +76,7 @@ from ._sampling import (
|
|||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .flows import Flume
|
||||
from tractor._addr import Address
|
||||
from tractor.msg.types import Aid
|
||||
|
||||
|
|
@ -362,6 +362,8 @@ async def allocate_persistent_feed(
|
|||
)
|
||||
await some_data_ready.wait()
|
||||
|
||||
# XXX, avoid cycle; it imports this mod.
|
||||
from .flows import Flume
|
||||
flume = Flume(
|
||||
|
||||
# TODO: we have to use this for now since currently the
|
||||
|
|
@ -500,7 +502,6 @@ async def open_feed_bus(
|
|||
sub_registered = trio.Event()
|
||||
|
||||
flumes: dict[str, Flume] = {}
|
||||
|
||||
for symbol in symbols:
|
||||
|
||||
# if no cached feed for this symbol has been created for this
|
||||
|
|
@ -684,6 +685,7 @@ class Feed(Struct):
|
|||
'''
|
||||
mods: dict[str, ModuleType] = {}
|
||||
portals: dict[ModuleType, tractor.Portal] = {}
|
||||
|
||||
flumes: dict[
|
||||
str, # FQME
|
||||
Flume,
|
||||
|
|
@ -951,6 +953,8 @@ async def open_feed(
|
|||
|
||||
assert len(feed.mods) == len(feed.portals)
|
||||
|
||||
# XXX, avoid cycle; it imports this mod.
|
||||
from .flows import Flume
|
||||
async with (
|
||||
trionics.gather_contexts(bus_ctxs) as ctxs,
|
||||
):
|
||||
|
|
|
|||
Loading…
Reference in New Issue