Added set of set handling (thru concept ISA)

This commit is contained in:
2020-02-17 21:07:06 +01:00
parent 7481b458e1
commit 86c2ff58d4
33 changed files with 635 additions and 232 deletions
+26 -1
View File
@@ -3,11 +3,12 @@ import ast
from core.builtin_concepts import ReturnValueConcept, ParserResultConcept
from core.concept import Concept
from core.sheerka.ExecutionContext import ExecutionContext
from parsers.BnfParser import BnfParser
from sdp.sheerkaDataProvider import Event
class BaseTest:
def get_sheerka(self):
def get_sheerka(self, **kwargs):
pass
def get_context(self, sheerka=None):
@@ -32,6 +33,30 @@ class BaseTest:
dump = dump.replace(to_remove, "")
return dump
def init_concepts(self, *concepts, **kwargs):
sheerka = self.get_sheerka(**kwargs)
context = self.get_context(sheerka)
result = []
for c in concepts:
if isinstance(c, str):
c = Concept(c)
c.init_key()
sheerka.set_id_if_needed(c, False)
# manage concepts with bnf definitions
if c.metadata.definition:
bnf_parser = BnfParser()
res = bnf_parser.parse(context, c.metadata.definition)
if res.status:
c.bnf = res.value.value
sheerka.create_new_concept(context, c)
sheerka.add_in_cache(c)
result.append(c)
return sheerka, context, *result
@staticmethod
def retval(obj, who="who", status=True):
"""ret_val"""