Fixed some bugs
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user