Enhanced complex concepts handling

This commit is contained in:
2020-01-11 08:03:35 +01:00
parent a62c1f0f13
commit 40416ac337
24 changed files with 1647 additions and 961 deletions
+10 -1
View File
@@ -129,6 +129,15 @@ class Concept:
def __hash__(self):
return hash(self.metadata.name)
def __getattr__(self, item):
# I have this complicated implementation because of the usage of Pickle
if 'props' in vars(self) and item in self.props:
return self.props[item].value
name = self.name if 'metadata' in vars(self) else 'Concept'
raise AttributeError(f"'{name}' concept has no attribute '{item}'")
@property
def name(self):
return self.metadata.name
@@ -166,7 +175,7 @@ class Concept:
if token.type == TokenKind.WHITESPACE:
continue
if not first:
key += " "
key += " " # spaces are normalized
if variables is not None and token.value in variables:
key += VARIABLE_PREFIX + str(variables.index(token.value))
else: