Fixed some bugs

This commit is contained in:
2020-08-27 18:54:28 +02:00
parent 351c16f946
commit 37cd3ed757
27 changed files with 685 additions and 189 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ from core.sheerka.services.sheerka_service import BaseService
CONCEPTS_FILE = "_concepts_lite.txt"
CONCEPTS_FILE_ALL_CONCEPTS = "_concepts.txt"
CONCEPTS_FILE_TO_USE = CONCEPTS_FILE_ALL_CONCEPTS
class SheerkaAdmin(BaseService):
NAME = "Admin"
@@ -38,7 +38,7 @@ class SheerkaAdmin(BaseService):
return self.sheerka.cache_manager.caches[name].cache.copy()
def restore(self, concept_file=CONCEPTS_FILE):
def restore(self, concept_file=CONCEPTS_FILE_TO_USE):
"""
Restore the state with all previous valid concept definitions
:return:
+1
View File
@@ -47,6 +47,7 @@ class SheerkaDump(BaseService):
if not first:
self.sheerka.log.info("")
self.sheerka.log.info(f"id : {c.id}")
self.sheerka.log.info(f"name : {c.name}")
self.sheerka.log.info(f"key : {c.key}")
self.sheerka.log.info(f"definition : {c.metadata.definition}")
+29 -1
View File
@@ -5,8 +5,22 @@ import re
from core.tokenizer import TokenKind
default_debug_name = "*default*"
debug_activated = set()
def my_debug(*args, check_started=None):
if check_started and default_debug_name not in debug_activated:
return
if isinstance(check_started, str) and check_started not in debug_activated:
return
if isinstance(check_started, list):
for debug_name in check_started:
if debug_name not in debug_activated:
return
def my_debug(*args):
with open("debug.txt", "a") as f:
for arg in args:
if isinstance(arg, list):
@@ -16,6 +30,20 @@ def my_debug(*args):
f.write(f"{arg}\n")
def start_debug(msg=None, debug_name=default_debug_name):
debug_activated.add(debug_name)
if msg:
with open("debug.txt", "a") as f:
f.write(f"{msg}\n")
def stop_debug(msg=None, debug_name=default_debug_name):
if msg:
with open("debug.txt", "a") as f:
f.write(f"{msg}\n")
debug_activated.remove(debug_name)
def sysarg_to_string(argv):
"""
Transform a list of strings into a single string