NandHyf 1 год назад
Родитель
Сommit
853b4e4f21
4 измененных файлов с 0 добавлено и 215 удалено
  1. 0 105
      archived_Stateful.py
  2. 0 56
      config.toml
  3. 0 54
      dev_config.toml
  4. BIN
      tableDesign_v2.0.png

+ 0 - 105
archived_Stateful.py

@@ -1,105 +0,0 @@
-import Alt, WithSqlite
-import tomlkit
-
-# uid related
-
-# Toml Methods
-def GetTomlDoc(tomlName):
-    try:
-        with open(tomlName, "rb") as t:
-            doc = tomlkit.load(t)
-
-            if doc == {}:
-                input("error 0: could not found correct config file") 
-                exit()
-
-            return doc
-        
-    except:
-        input("error 0: could not found correct config file") 
-        exit()
-    
-
-def MatchTomlKey(tomlName, key, table=None) -> str:
-    doc = GetTomlDoc(tomlName)
-
-    if table == None:
-        return str(doc.item(key))
-    
-    elif table != None:
-        d = doc.unwrap()
-        return str(d[table][key])
-
-
-# no differernt between ↑ MatchTomlKey() ↑ except receives and returns in list
-def MatchTomlKeys(tomlName, keys, table=None) -> list:
-    doc = GetTomlDoc(tomlName)
-
-    if table == None:
-        # rl == 'r'eturn 'l'ist
-        rl = []
-
-        for key in keys:
-            try:
-                rl.append(doc.item(key))
-            except:
-                pass
-
-        return rl
-    
-
-    elif table != None:
-        rl = []
-        d = doc.unwrap()
-
-        for key in keys:
-            try:
-                rl.append(d[table][key])
-            except:
-                pass
-
-        return rl
-
-
-# ----- Transit Command Handler -----
-def Handler(app_commands):
-    dbType = app_commands[-1]
-    dbPath = app_commands[-2]
-    # [todo 3] 检查dbPath是否对应dbType, 否的话报错并exit()
-
-    exec_commands = app_commands[0:-2]
-
-    if dbType == "sqlite3":
-        WithSqlite.Regular(dbPath, exec_commands)
-
-
-    elif dbType == "csv":
-        pass
-
-    elif dbType == "mongodb":
-        pass
-
-    elif dbType == "toml":
-        pass
-
-    elif dbType == "md":
-        pass
-
-    else:
-        input("error 1: could not found correct Data Base")
-        exit()
-
-
-# ----- Docker related -----
-
-
-
-if __name__ == "__main__":
-    
-    a_c = ['/', 'test.db', 'sqlite3']
-    a_c1 = ['add', 'board', 'testBoardName', 'test.db', 'sqlite3']
-    a_c2 = ['edit', 'board', 't_boardName', 'to', 't_newBoardName', 'test.db', 'sqlite3']
-    e_c = ['add', 'board']
-
-    # Operate_sqlite3("test.db", a_c1)
-    Handler(a_c2)

+ 0 - 56
config.toml

@@ -1,56 +0,0 @@
-# Choose between: zh_s/zh_f/en
-# zh_s == 简体中文; zh_f == 繁体中文(暫未支持)
-lang = "en"
-
-# tree/expand
-listStyle = "tree"
-
-# >>>need some guidance here<<<
-EnableGlobalCommand = false
-
-# Choose between: sqlite3/toml/md/csv/mongodb
-# However toml/md/csv/mongodb are not supported in v1.0
-DBType = "sqlite3"
-DBPath = "test.db"
-
-# 
-# utc/utc+-n (UTC-12 ~ UTC+14)
-# This will not effect the "uid related" time settings(UTC+0)
-displayTime = "UTC+8"
-
-
-# ----- App Command to DB Syntax Translation -----
-[sqlite3]
-list = "SELECT"
-add = "INSERT INTO"
-edit = "UPDATE"
-delete = "UPDATE" # change stauts to "deleted"
-
-
-[csv]
-
-
-[mongodb]
-
-
-[toml_as_DB]
-
-
-[md_as_DB]
-
-
-# ----- helps -----
-# 难道用asicⅡ然后根据系统语言转换?
-# 或者是单独的.toml/.txt 文本文件也行 <<< 采用这个方案
-[command-help]
-en = """
-Help texts in en
-"""
-
-zh-s = """
-Help texts in zh-s
-"""
-
-[could-not-find]
-en = "could not find"
-zh-s = "找不到"

+ 0 - 54
dev_config.toml

@@ -1,54 +0,0 @@
-# ----- DB Configuration -----
-# Just a better reference for dev.db, no functional use(yet)
-[Board]
-c1_p-k = "id INTEGER PRIMARY KEY ASC"
-c2 = "name"
-c1 = "status"
-
-[Class]
-c1_p-k = "id INTEGER PRIMARY KEY ASC"
-c2 = "name"
-c3 = "usingBoard"
-c4 = "status"
-
-[Event]
-c1_p-k = "id INTEGER PRIMARY KEY ASC"
-c2 = "name"
-c3 = "dscrp"
-c4 = "creator"
-c5 = "createdTime"
-c6 = "classCreated"
-c7 = "classCurrent"
-c8 = "status"
-
-[Stucked]
-c1_pk = "id INTEGER PRIMARY KEY ASC"
-c2 = "boardId"
-c3 = "eventId"
-c4 = "stuckedTime"
-c5 = "solvedTime"
-c6 = "status"
-
-
-# ----- App Configuration -----
-StrictMode = false
-LLM_callable = false
-
-DBType = "sqlite3"
-DBPath = "dev.db"
-
-Lang = "en"
-ListStyle = "tree"
-DisplayTimeZone = "utc+8"
-
-
-# ----- Some Notes -----
-# Set integer prime key: <columnName> INTEGER PRIMARY KEY ASC
-# status: alive/deleted/unclassified(event only)
-#                                           ↓ Don't foget to write the method(s) for it
-# ListStyle: tree/md_table/LLM_md_table/<customName>
-# [todo 4] StrickMode: 1. Have to be full length commands; 2. err when not exist
-
-
-# Explanation of abbreviations
-# 

BIN
tableDesign_v2.0.png