Disentangle another reference to slipnet.
This commit is contained in:
@ -4,17 +4,6 @@ from slipnode import Slipnode
|
|||||||
from sliplink import Sliplink
|
from sliplink import Sliplink
|
||||||
|
|
||||||
|
|
||||||
def distinguishingDescriptor(descriptor):
|
|
||||||
"""Whether no other object of the same type has the same descriptor"""
|
|
||||||
if descriptor == slipnet.letter:
|
|
||||||
return False
|
|
||||||
if descriptor == slipnet.group:
|
|
||||||
return False
|
|
||||||
if descriptor in slipnet.numbers:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class SlipNet(object):
|
class SlipNet(object):
|
||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -58,6 +47,16 @@ class SlipNet(object):
|
|||||||
node.jump()
|
node.jump()
|
||||||
node.buffer = 0.0
|
node.buffer = 0.0
|
||||||
|
|
||||||
|
def isDistinguishingDescriptor(self, descriptor):
|
||||||
|
"""Whether no other object of the same type has the same descriptor"""
|
||||||
|
if descriptor == self.letter:
|
||||||
|
return False
|
||||||
|
if descriptor == self.group:
|
||||||
|
return False
|
||||||
|
if descriptor in self.numbers:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def __addInitialNodes(self):
|
def __addInitialNodes(self):
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
self.slipnodes = []
|
self.slipnodes = []
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import logging
|
|||||||
|
|
||||||
from description import Description
|
from description import Description
|
||||||
from formulas import weightedAverage
|
from formulas import weightedAverage
|
||||||
from slipnet import slipnet, distinguishingDescriptor
|
from slipnet import slipnet
|
||||||
from workspaceStructure import WorkspaceStructure
|
from workspaceStructure import WorkspaceStructure
|
||||||
|
|
||||||
|
|
||||||
@ -170,13 +170,12 @@ class WorkspaceObject(WorkspaceStructure):
|
|||||||
return objectOnMyRightIsRightmost and objectOnMyLeftIsLeftmost
|
return objectOnMyRightIsRightmost and objectOnMyLeftIsLeftmost
|
||||||
|
|
||||||
def distinguishingDescriptor(self, descriptor):
|
def distinguishingDescriptor(self, descriptor):
|
||||||
# pylint: disable=no-self-use
|
return slipnet.isDistinguishingDescriptor(descriptor)
|
||||||
return distinguishingDescriptor(descriptor)
|
|
||||||
|
|
||||||
def relevantDistinguishingDescriptors(self):
|
def relevantDistinguishingDescriptors(self):
|
||||||
return [d.descriptor
|
return [d.descriptor
|
||||||
for d in self.relevantDescriptions()
|
for d in self.relevantDescriptions()
|
||||||
if distinguishingDescriptor(d.descriptor)]
|
if slipnet.isDistinguishingDescriptor(d.descriptor)]
|
||||||
|
|
||||||
def getDescriptor(self, descriptionType):
|
def getDescriptor(self, descriptionType):
|
||||||
"""The description attached to this object of the description type."""
|
"""The description attached to this object of the description type."""
|
||||||
|
|||||||
Reference in New Issue
Block a user