.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,
|
log,
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
from .flows import Flume
|
|
||||||
from .validate import (
|
from .validate import (
|
||||||
FeedInit,
|
FeedInit,
|
||||||
validate_backend,
|
validate_backend,
|
||||||
|
|
@ -77,6 +76,7 @@ from ._sampling import (
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from .flows import Flume
|
||||||
from tractor._addr import Address
|
from tractor._addr import Address
|
||||||
from tractor.msg.types import Aid
|
from tractor.msg.types import Aid
|
||||||
|
|
||||||
|
|
@ -362,6 +362,8 @@ async def allocate_persistent_feed(
|
||||||
)
|
)
|
||||||
await some_data_ready.wait()
|
await some_data_ready.wait()
|
||||||
|
|
||||||
|
# XXX, avoid cycle; it imports this mod.
|
||||||
|
from .flows import Flume
|
||||||
flume = Flume(
|
flume = Flume(
|
||||||
|
|
||||||
# TODO: we have to use this for now since currently the
|
# TODO: we have to use this for now since currently the
|
||||||
|
|
@ -500,7 +502,6 @@ async def open_feed_bus(
|
||||||
sub_registered = trio.Event()
|
sub_registered = trio.Event()
|
||||||
|
|
||||||
flumes: dict[str, Flume] = {}
|
flumes: dict[str, Flume] = {}
|
||||||
|
|
||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
|
|
||||||
# if no cached feed for this symbol has been created for this
|
# if no cached feed for this symbol has been created for this
|
||||||
|
|
@ -684,6 +685,7 @@ class Feed(Struct):
|
||||||
'''
|
'''
|
||||||
mods: dict[str, ModuleType] = {}
|
mods: dict[str, ModuleType] = {}
|
||||||
portals: dict[ModuleType, tractor.Portal] = {}
|
portals: dict[ModuleType, tractor.Portal] = {}
|
||||||
|
|
||||||
flumes: dict[
|
flumes: dict[
|
||||||
str, # FQME
|
str, # FQME
|
||||||
Flume,
|
Flume,
|
||||||
|
|
@ -951,6 +953,8 @@ async def open_feed(
|
||||||
|
|
||||||
assert len(feed.mods) == len(feed.portals)
|
assert len(feed.mods) == len(feed.portals)
|
||||||
|
|
||||||
|
# XXX, avoid cycle; it imports this mod.
|
||||||
|
from .flows import Flume
|
||||||
async with (
|
async with (
|
||||||
trionics.gather_contexts(bus_ctxs) as ctxs,
|
trionics.gather_contexts(bus_ctxs) as ctxs,
|
||||||
):
|
):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue