First version of explain. Creating a new parser was a wrong approach. Need to reimplement

This commit is contained in:
2020-04-17 17:24:57 +02:00
parent 6c7c529016
commit d6ea2461a8
43 changed files with 2679 additions and 162 deletions
+19
View File
@@ -276,6 +276,10 @@ class Concept:
def to_dict(self, props_to_use=None):
"""
Returns a dict representing 'self'
to_dict() is used for serializing the definition of the concept
You will not that it does not dump the actual values of the properties, nor the body
If you need a dictionary version of the Concept, use to_bag()
:return:
"""
@@ -368,6 +372,7 @@ class Concept:
:return:
"""
self.values[metadata] = value
return self
def get_metadata_value(self, metadata: ConceptParts):
"""
@@ -407,6 +412,20 @@ class Concept:
def get_original_definition_hash(self):
return self.original_definition_hash
def to_bag(self):
"""
Creates a dictionary with the useful properties of the concept
It quicker to implement than creating the actual property mechanism with @property
And it removes the visibility from the other attributes/methods
"""
bag = {}
for prop in self.props:
bag[prop] = self.get_prop(prop)
bag["prop." + prop] = self.get_prop(prop)
for prop in ("id", "name", "key", "body"):
bag[prop] = getattr(self, prop)
return bag
class Property:
"""