Skip to content

Commit

Permalink
Move the instantiation of Machine from __init__() to start()
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Dec 7, 2023
1 parent 7ee66bd commit 99dd19a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions nextline/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,15 @@ def __init__(
trace_modules: bool = False,
timeout_on_exit: float = 3,
):
self._continuous = Continuous(self)

self._init_options = InitOptions(
statement=statement,
run_no_start_from=run_no_start_from,
trace_threads=trace_threads,
trace_modules=trace_modules,
)

logger = getLogger(__name__)
logger.debug(f'self._init_options: {self._init_options}')

self._continuous = Continuous(self)
self._registry = PubSub[Any, Any]()
self._machine = Machine(
init_options=self._init_options, registry=self._registry
)
self._timeout_on_exit = timeout_on_exit

self._started = False
self._closed = False

Expand All @@ -88,6 +79,11 @@ async def start(self) -> None:
if self._started:
return
self._started = True
logger = getLogger(__name__)
logger.debug(f'self._init_options: {self._init_options}')
self._machine = Machine(
init_options=self._init_options, registry=self._registry
)
await self._continuous.start()
await self._machine.initialize() # type: ignore

Expand Down

0 comments on commit 99dd19a

Please sign in to comment.