Skip to content

Commit

Permalink
Removed circular imports for python 3.4 - fixes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
TD22057 committed Dec 22, 2017
1 parent 2d006bf commit 6eb6afe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion insteon_mqtt/handler/DeviceDbGet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
#===========================================================================
# pylint: disable=too-many-return-statements
from .. import db
from .. import log
from .. import message as Msg
from .Base import Base
Expand Down Expand Up @@ -54,6 +53,10 @@ def msg_received(self, protocol, msg):
Msg.CONTINUE if we handled the message and expect more.
Msg.FINISHED if we handled the message and are done.
"""
# Import here - at file scope this makes a circular import
# which is ok in Python>=3.5 but not 3.4.
from .. import db

# Probably an echo back of our sent message. See if the
# message matches the address we sent to and assume it's the
# ACK/NAK message. These seem to be either extended or
Expand Down
5 changes: 4 additions & 1 deletion insteon_mqtt/handler/ModemAllLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Modem all link mode handler.
#
#===========================================================================
from .. import db
from .. import log
from .. import message as Msg
from .Base import Base
Expand Down Expand Up @@ -85,6 +84,10 @@ def msg_received(self, protocol, msg):
Msg.FINISHED if we handled the message and are done.
"""
# Import here - at file scope this makes a circular import
# which is ok in Python>=3.5 but not 3.4.
from .. import db

# Message is an ACK of the all link activation.
if isinstance(msg, Msg.OutAllLinkStart):
# If we get a NAK, then an error occured.
Expand Down
5 changes: 4 additions & 1 deletion insteon_mqtt/handler/ModemDbGet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Modem get all link database handler.
#
#===========================================================================
from .. import db
from .. import log
from .. import message as Msg
from .Base import Base
Expand Down Expand Up @@ -53,6 +52,10 @@ def msg_received(self, protocol, msg):
Msg.CONTINUE if we handled the message and expect more.
Msg.FINISHED if we handled the message and are done.
"""
# Import here - at file scope this makes a circular import
# which is ok in Python>=3.5 but not 3.4.
from .. import db

# Message is an ACK/NAK of the record request.
if isinstance(msg, (Msg.OutAllLinkGetFirst, Msg.OutAllLinkGetNext)):
# If we get a NAK, then there are no more db records.
Expand Down

0 comments on commit 6eb6afe

Please sign in to comment.