Enhanced complex concepts handling
This commit is contained in:
+10
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user