try memory profile
This commit is contained in:
parent
419eea20c8
commit
242c2ca9a7
10
DR.py
10
DR.py
@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
"""
|
||||
writen by shenjackyuanjie
|
||||
email: 3695888@qq.com
|
||||
"""
|
||||
@ -23,7 +22,8 @@ error_format = {
|
||||
'error.happen': '游戏出现了一个报错!正在处理'
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def main() -> None:
|
||||
start_time_ns = time.time_ns()
|
||||
start_time_perf_ns = time.perf_counter_ns()
|
||||
print(f'{__file__=}')
|
||||
@ -79,3 +79,7 @@ if __name__ == '__main__':
|
||||
crash.record_thread = False
|
||||
print(crash.all_thread)
|
||||
print(crash.all_process)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -132,7 +132,6 @@ class _DR_runtime(Options):
|
||||
f'Builtin version {relationship} than true version')
|
||||
|
||||
|
||||
|
||||
DR_option = _DR_option()
|
||||
DR_runtime = _DR_runtime()
|
||||
|
||||
|
@ -42,7 +42,7 @@ file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name:
|
||||
def load_file(file_name: str,
|
||||
stack: Union[str, list, dict] = None,
|
||||
raise_error: bool = True,
|
||||
encoding: str = 'utf-8') -> Union[dict, list, ElementTree.ElementTree]:
|
||||
encoding: str = 'utf-8') -> Union[dict, ElementTree.ElementTree]:
|
||||
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
||||
get_file = NotImplementedError('解析失败,请检查文件类型/文件内容/文件是否存在!')
|
||||
try:
|
||||
|
@ -162,8 +162,17 @@ class Tr:
|
||||
self.default_config = config.set('source', self) if config is not None else TranslateConfig(source=self)
|
||||
self.translates_cache = Translates(value=self.translates, config=self.default_config.copy())
|
||||
|
||||
def init_translate(self):
|
||||
self.translates: Dict[str, Union[str, Dict]] = tools.load_file(f'configs/lang/{self.language_name}.toml')
|
||||
self.default_translate: Dict = tools.load_file(f'configs/lang/{DR_runtime.default_language}.toml')
|
||||
self.translates_cache = Translates(value=self.translates, config=self.default_config.copy())
|
||||
|
||||
def update_lang(self) -> bool:
|
||||
if
|
||||
if DR_runtime.language != self.language_name:
|
||||
self.language_name = DR_runtime.language
|
||||
self.init_translate()
|
||||
return True
|
||||
return False
|
||||
|
||||
def default(self, items: Union[str, List[str]]) -> Translates:
|
||||
if isinstance(items, list):
|
||||
|
Loading…
Reference in New Issue
Block a user