diff --git a/copycat/sliplink.py b/copycat/sliplink.py index 3814dd2..a21b61b 100644 --- a/copycat/sliplink.py +++ b/copycat/sliplink.py @@ -1,5 +1,3 @@ -#from slipnode import Slipnode - class Sliplink(object): def __init__(self, source, destination, label=None, length=0.0): diff --git a/copycat/slipnet.py b/copycat/slipnet.py index eff1a8d..07166a6 100644 --- a/copycat/slipnet.py +++ b/copycat/slipnet.py @@ -265,7 +265,7 @@ class SlipNet(object): self.__addSlipLink(destination, source, label=self.opposite) def __addNode(self, name, depth, length=0): - slipnode = Slipnode(name, depth, length) + slipnode = Slipnode(self, name, depth, length) self.slipnodes += [slipnode] return slipnode diff --git a/copycat/slipnode.py b/copycat/slipnode.py index ddb0a02..23a0f70 100644 --- a/copycat/slipnode.py +++ b/copycat/slipnode.py @@ -13,10 +13,11 @@ def jump_threshold(): class Slipnode(object): # pylint: disable=too-many-instance-attributes - def __init__(self, name, depth, length=0.0): + def __init__(self, slipnet, name, depth, length=0.0): + self.slipnet = slipnet + self.name = name self.conceptualDepth = depth self.usualConceptualDepth = depth - self.name = name self.intrinsicLinkLength = length self.shrunkLinkLength = length * 0.4 @@ -111,9 +112,7 @@ class Slipnode(object): If no linked node is found, return None """ - from slipnet import slipnet - - if relation == slipnet.identity: + if relation == self.slipnet.identity: return self destinations = [l.destination for l in self.outgoingLinks if l.label == relation] @@ -126,11 +125,9 @@ class Slipnode(object): If it does not exist return None """ - from slipnet import slipnet - result = None if self == destination: - result = slipnet.identity + result = self.slipnet.identity else: for link in self.outgoingLinks: if link.destination == destination: