Fixed #68: Implement SheerkaQL

Fixed #70: SheerkaFilterManager : Pipe functions
Fixed #71: SheerkaFilterManager : filter_objects
Fixed #75: SheerkaMemory: Enhance memory() to use the filtering capabilities
Fixed #76: SheerkaEvaluateConcept: Concepts that modify the state of the system must not be evaluated during question
This commit is contained in:
2021-04-26 19:13:47 +02:00
parent bef5f3208c
commit 1059ce25c5
57 changed files with 5759 additions and 1302 deletions
+4 -4
View File
@@ -241,7 +241,7 @@ class DefConceptEvaluator(OneReturnValueEvaluator):
names = [str(t.value) for t in ret_value.tokens if t.type in (TokenKind.IDENTIFIER,
TokenKind.STRING,
TokenKind.KEYWORD)]
possible_vars = filter(lambda x: x in concept_name and context.sheerka.is_not_a_variable(x), names)
possible_vars = filter(lambda x: x in concept_name and context.sheerka.is_not_a_concept_name(x), names)
debugger.debug_var("names", names, hint="from NameNode")
debugger.debug_var("possible_vars", possible_vars, hint="from NameNode")
return [PossibleVariable(v) for v in possible_vars]
@@ -262,7 +262,7 @@ class DefConceptEvaluator(OneReturnValueEvaluator):
if len(concept_name) > 1:
visitor = UnreferencedVariablesVisitor(context)
names = visitor.get_names(python_node.ast_)
possible_vars = filter(lambda x: x in concept_name and context.sheerka.is_not_a_variable(x), names)
possible_vars = filter(lambda x: x in concept_name and context.sheerka.is_not_a_concept_name(x), names)
debugger.debug_var("names", names, hint="from python node")
debugger.debug_var("possible_vars", possible_vars, hint="from python node")
return [PossibleVariable(v) for v in possible_vars]
@@ -275,7 +275,7 @@ class DefConceptEvaluator(OneReturnValueEvaluator):
if (concept := get_inner_concept(ret_value.value)) is not None and len(concept_name) > 1:
# use the variables of the concept is any
names = [var_value or var_name for var_name, var_value in concept.get_metadata().variables]
possible_vars = filter(lambda x: context.sheerka.is_not_a_variable(x), names)
possible_vars = filter(lambda x: context.sheerka.is_not_a_concept_name(x), names)
debugger.debug_var("names", names, hint="from concept")
debugger.debug_var("possible_vars", possible_vars, hint="from concept")
return [PossibleVariable(v) for v in possible_vars]
@@ -296,7 +296,7 @@ class DefConceptEvaluator(OneReturnValueEvaluator):
else:
names.append(t.str_value)
possible_vars = filter(lambda x: context.sheerka.is_not_a_variable(x), names)
possible_vars = filter(lambda x: context.sheerka.is_not_a_concept_name(x), names)
debugger.debug_var("names", names, hint="from source")
debugger.debug_var("possible_vars", possible_vars, hint="from source")
return [PossibleVariable(v) for v in possible_vars]