Skip to content

Commit

Permalink
fix recursive imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cwiede committed Apr 27, 2020
1 parent 1e0cd3f commit 3deaff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nexxT/core/Exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
This module defines exceptions used in the nexxT framework.
"""

from nexxT.interface.Ports import InputPortInterface, OutputPortInterface
from nexxT.interface.Filters import FilterState

def _factoryToString(factory):
from nexxT.interface.Ports import InputPortInterface, OutputPortInterface
if isinstance(factory, str):
return factory
return "Input" if factory is InputPortInterface else ("Output" if factory is OutputPortInterface else "")
Expand Down Expand Up @@ -97,13 +95,15 @@ class UnexpectedFilterState(NexTRuntimeError):
raised when operations are performed in unexpected filter states
"""
def __init__(self, state, operation):
from nexxT.interface.Filters import FilterState
super().__init__("Operation '%s' cannot be performed in state %s" % (operation, FilterState.state2str(state)))

class FilterStateMachineError(UnexpectedFilterState):
"""
raised when a state transition is invalid.
"""
def __init__(self, oldState, newState):
from nexxT.interface.Filters import FilterState
super().__init__(oldState, "Transition to " + FilterState.state2str(newState))

class PropertyCollectionChildExists(NexTRuntimeError):
Expand Down
9 changes: 5 additions & 4 deletions nexxT/interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@
Port.make_shared(InputPortInterface(dynamic, name, environment, queueSizeSamples, queueSizeSeconds)))
else:
# pylint: enable=invalid-name
from nexxT.interface.Filters import Filter, FilterState
from nexxT.interface.DataSamples import DataSample
from nexxT.interface.Ports import Port
from nexxT.interface.Ports import OutputPortInterface
from nexxT.interface.Ports import InputPortInterface
from nexxT.interface.PropertyCollections import PropertyCollection
from nexxT.interface.Services import Services
# make sure that PortImpl is actually imported to correctly set up the factory functions
from nexxT.core import PortImpl
OutputPort = PortImpl.OutputPortImpl
InputPort = PortImpl.InputPortImpl
OutputPortInterface.setupDirectConnection = OutputPort.setupDirectConnection
OutputPortInterface.setupInterThreadConnection = OutputPort.setupInterThreadConnection
del PortImpl
from nexxT.interface.Filters import Filter, FilterState
from nexxT.interface.DataSamples import DataSample
from nexxT.interface.PropertyCollections import PropertyCollection
from nexxT.interface.Services import Services

del nexxT

0 comments on commit 3deaff4

Please sign in to comment.