GlobalConfig新增find字段
This commit is contained in:
@@ -5,10 +5,35 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
import datetime
|
import datetime
|
||||||
import platform
|
try:
|
||||||
import time
|
|
||||||
import os
|
|
||||||
from colorama import Fore as ConsoleFrontColor, Back as ConsoleBackgroundColor, Style as ConsoleStyle
|
from colorama import Fore as ConsoleFrontColor, Back as ConsoleBackgroundColor, Style as ConsoleStyle
|
||||||
|
except:
|
||||||
|
print("colorama is not installed, using default colors")
|
||||||
|
class ConsoleFrontColor:
|
||||||
|
RED = ""
|
||||||
|
GREEN = ""
|
||||||
|
YELLOW = ""
|
||||||
|
BLUE = ""
|
||||||
|
MAGENTA = ""
|
||||||
|
CYAN = ""
|
||||||
|
WHITE = ""
|
||||||
|
RESET = ""
|
||||||
|
class ConsoleBackgroundColor:
|
||||||
|
RED = ""
|
||||||
|
GREEN = ""
|
||||||
|
YELLOW = ""
|
||||||
|
BLUE = ""
|
||||||
|
MAGENTA = ""
|
||||||
|
CYAN = ""
|
||||||
|
WHITE = ""
|
||||||
|
RESET = ""
|
||||||
|
class ConsoleStyle:
|
||||||
|
RESET = ""
|
||||||
|
BOLD = ""
|
||||||
|
DIM = ""
|
||||||
|
UNDERLINE = ""
|
||||||
|
REVERSE = ""
|
||||||
|
HIDDEN = ""
|
||||||
|
|
||||||
class NotImplementedError(Exception):
|
class NotImplementedError(Exception):
|
||||||
def __init__(self, message:Optional[str]=None) -> None:
|
def __init__(self, message:Optional[str]=None) -> None:
|
||||||
|
@@ -53,6 +53,7 @@ class GlobalConfig:
|
|||||||
|
|
||||||
# 检查配置文件,不存在则生成空配置
|
# 检查配置文件,不存在则生成空配置
|
||||||
self._data_pair: Dict[str, Any] = {}
|
self._data_pair: Dict[str, Any] = {}
|
||||||
|
self._data_find: Dict[str, Any] = {}
|
||||||
self._const_config_file = ConstConfigFile
|
self._const_config_file = ConstConfigFile
|
||||||
config_file = self.ConfigFile
|
config_file = self.ConfigFile
|
||||||
|
|
||||||
@@ -160,7 +161,8 @@ class GlobalConfig:
|
|||||||
"""保存配置到文件"""
|
"""保存配置到文件"""
|
||||||
config = self.ConfigFile
|
config = self.ConfigFile
|
||||||
config.SaveAsJson({
|
config.SaveAsJson({
|
||||||
"properties": self._data_pair
|
"properties": self._data_pair,
|
||||||
|
"find": self._data_find
|
||||||
})
|
})
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@@ -232,6 +234,7 @@ class GlobalConfig:
|
|||||||
return self._data_pair[key]
|
return self._data_pair[key]
|
||||||
else:
|
else:
|
||||||
self.LogPropertyNotFound(key, default=default)
|
self.LogPropertyNotFound(key, default=default)
|
||||||
|
self._data_find[key] = default
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@ import urllib.parse
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import asyncio
|
import asyncio
|
||||||
import aiohttp
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import *
|
from typing import *
|
||||||
|
Reference in New Issue
Block a user