Added basic implementation for Python code evaluation

This commit is contained in:
2019-11-07 17:18:07 +01:00
parent b818c992ec
commit 448ebc696a
18 changed files with 501 additions and 156 deletions
+23
View File
@@ -0,0 +1,23 @@
from evaluators.BaseEvaluator import BaseEvaluator
from parsers.DefaultParser import DefConceptNode
import logging
log = logging.getLogger(__name__)
class AddConceptEvaluator(BaseEvaluator):
"""
Used to add a new concept
"""
def __init__(self):
super().__init__("Add new Concept", 50)
def matches(self, context, items):
return len(items) == 1 and items[0].status and isinstance(items[0].value, DefConceptNode)
def eval(self, context, items):
log.debug("Adding a new concept")
node = items[0].value
sheerka = context.sheerka
return sheerka.add_concept(context, node)