From 3b9848fd2010ea6565b62a3794e6eeee50b9f687 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 27 Jun 2022 16:51:14 +0800 Subject: [PATCH] aaaaa --- Difficult_Rocket/__init__.py | 2 +- Difficult_Rocket/api/Exp/__init__.py | 18 +--- Difficult_Rocket/api/Exp/command.py | 41 +-------- Difficult_Rocket/api/Exp/main.py | 8 +- Difficult_Rocket/api/Exp/threading.py | 9 ++ Difficult_Rocket/api/Exp/unsupport.py | 25 +---- Difficult_Rocket/api/__init__.py | 2 +- Difficult_Rocket/api/calculation.py | 2 +- Difficult_Rocket/api/delivery.py | 2 +- Difficult_Rocket/api/scientific_unit.py | 2 +- Difficult_Rocket/api/types/SR1/ship.py | 2 +- Difficult_Rocket/api/types/__init__.py | 2 +- Difficult_Rocket/api/types/data_type.py | 2 +- Difficult_Rocket/client/__init__.py | 2 +- Difficult_Rocket/client/fps/__init__.py | 2 +- Difficult_Rocket/client/fps/fps_log.py | 2 +- Difficult_Rocket/client/screen.py | 2 +- Difficult_Rocket/command/__init__.py | 2 +- Difficult_Rocket/command/api.py | 2 +- Difficult_Rocket/command/line.py | 2 +- Difficult_Rocket/command/tree.py | 2 +- Difficult_Rocket/crash/__init__.py | 2 +- Difficult_Rocket/crash/crash.py | 2 +- Difficult_Rocket/exception/__init__.py | 111 +++++++++++++++++++++++ Difficult_Rocket/guis/__init__.py | 2 +- Difficult_Rocket/guis/format/html.py | 2 +- Difficult_Rocket/guis/label.py | 2 +- Difficult_Rocket/guis/widgets.py | 2 +- Difficult_Rocket/main.py | 2 +- Difficult_Rocket/mods/__init__.py | 2 +- Difficult_Rocket/mods/api/__init__.py | 2 +- Difficult_Rocket/mods/api/client.py | 2 +- Difficult_Rocket/mods/loader/__init__.py | 2 +- Difficult_Rocket/server/__init__.py | 2 +- Difficult_Rocket/utils/__init__.py | 2 +- Difficult_Rocket/utils/new_thread.py | 3 +- Difficult_Rocket/utils/thread.py | 2 +- Difficult_Rocket/utils/tools.py | 2 +- Difficult_Rocket/utils/translate.py | 2 +- libs/msdnicrosoft_logger/shenjack.py | 17 +++- 40 files changed, 171 insertions(+), 125 deletions(-) create mode 100644 Difficult_Rocket/api/Exp/threading.py create mode 100644 Difficult_Rocket/exception/__init__.py diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index b847804..7387b63 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/Exp/__init__.py b/Difficult_Rocket/api/Exp/__init__.py index 051d51a..d8ea0c9 100644 --- a/Difficult_Rocket/api/Exp/__init__.py +++ b/Difficult_Rocket/api/Exp/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- @@ -12,19 +12,3 @@ gitee: @shenjackyuanjie """ from Difficult_Rocket.api.Exp.main import Error -from Difficult_Rocket.api.Exp.command import CommandError, CommandParseError, CommandQMarkPosError, \ - CommandQMarkConflict, CommandQMarkMissing, CommandQMarkPreMissing, CommandQMarkSufMissing -from Difficult_Rocket.api.Exp.unsupport import NoMoreJson5, Nope418ImTeapot, ThinkError, BrainError, \ - BrainTimeoutError, BigBrainError - - -class TexturesError(Error): - """材质相关 error""" - - -class LanguageError(Error): - """语言相关 error""" - - -class TestError(Error): - """就像名字一样 用于测试的 error""" diff --git a/Difficult_Rocket/api/Exp/command.py b/Difficult_Rocket/api/Exp/command.py index fe6c6e6..9929aec 100644 --- a/Difficult_Rocket/api/Exp/command.py +++ b/Difficult_Rocket/api/Exp/command.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- @@ -13,42 +13,3 @@ gitee: @shenjackyuanjie from . import Error - -class CommandError(Error): - """命令解析相关 error""" - - -class CommandParseError(CommandError): - """命令解析时出现错误""" - - -# QMark -> Quotation marks -# Pos -> Position - -class CommandQMarkPosError(CommandParseError): - """命令中,引号位置不正确 - 例如: /command "aabcc "awdawd""" - - -class CommandQMarkMissing(CommandParseError): - """命令中引号缺失 - 例如: /command "aawwdawda awdaw """ - - -class CommandQMarkConflict(CommandParseError): - """命令中引号位置冲突 - 例如: /command "aaaa "aaaa aaaa""" - first_qmark_pos = None - conflict_qmark_pos = None - - -class CommandQMarkPreMissing(CommandQMarkMissing): - """命令中 前面的引号缺失 - 例如: /command aaaa" aaaaaa""" - suf_qmark_pos = None - - -class CommandQMarkSufMissing(CommandQMarkMissing): - """命令中 后面的引号缺失(引号未闭合) - 例如: /command "aaaawaa some command""" - pre_qmark_pos = None diff --git a/Difficult_Rocket/api/Exp/main.py b/Difficult_Rocket/api/Exp/main.py index 9840a5d..a192dd5 100644 --- a/Difficult_Rocket/api/Exp/main.py +++ b/Difficult_Rocket/api/Exp/main.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- @@ -11,9 +11,3 @@ github: @shenjackyuanjie gitee: @shenjackyuanjie """ - -class Error(Exception): - """基础 Exception""" - - def __bool__(self): - return False diff --git a/Difficult_Rocket/api/Exp/threading.py b/Difficult_Rocket/api/Exp/threading.py new file mode 100644 index 0000000..6f4a333 --- /dev/null +++ b/Difficult_Rocket/api/Exp/threading.py @@ -0,0 +1,9 @@ +# ------------------------------- +# Difficult Rocket +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com +# All rights reserved +# ------------------------------- + +from Difficult_Rocket.api.Exp import Error + + diff --git a/Difficult_Rocket/api/Exp/unsupport.py b/Difficult_Rocket/api/Exp/unsupport.py index 93c7583..c5bfcbc 100644 --- a/Difficult_Rocket/api/Exp/unsupport.py +++ b/Difficult_Rocket/api/Exp/unsupport.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- @@ -13,26 +13,3 @@ gitee: @shenjackyuanjie from Difficult_Rocket.api.Exp.main import Error - -class NoMoreJson5(Error): - """说什么我也不用Json5了!""" - - -class Nope418ImTeapot(Error): - """我只是个茶壶而已,我不能煮咖啡!""" - - -class ThinkError(Error): - """进不去,进不去,怎么想都进不去!""" - - -class BrainError(Error): - """clever brain.png""" - - -class BigBrainError(BrainError): - """bigbrain.png""" - - -class BrainTimeoutError(BrainError, ThinkError): - """脑子····超时·······················啦!""" diff --git a/Difficult_Rocket/api/__init__.py b/Difficult_Rocket/api/__init__.py index d6d1ec6..aab182b 100644 --- a/Difficult_Rocket/api/__init__.py +++ b/Difficult_Rocket/api/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/calculation.py b/Difficult_Rocket/api/calculation.py index 0fdf9d1..d93b2d1 100644 --- a/Difficult_Rocket/api/calculation.py +++ b/Difficult_Rocket/api/calculation.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/delivery.py b/Difficult_Rocket/api/delivery.py index 1604b23..c64638f 100644 --- a/Difficult_Rocket/api/delivery.py +++ b/Difficult_Rocket/api/delivery.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/scientific_unit.py b/Difficult_Rocket/api/scientific_unit.py index 26e5bda..75c32a1 100644 --- a/Difficult_Rocket/api/scientific_unit.py +++ b/Difficult_Rocket/api/scientific_unit.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/types/SR1/ship.py b/Difficult_Rocket/api/types/SR1/ship.py index 250fd9d..469734b 100644 --- a/Difficult_Rocket/api/types/SR1/ship.py +++ b/Difficult_Rocket/api/types/SR1/ship.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/types/__init__.py b/Difficult_Rocket/api/types/__init__.py index e9da2fb..653f717 100644 --- a/Difficult_Rocket/api/types/__init__.py +++ b/Difficult_Rocket/api/types/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/api/types/data_type.py b/Difficult_Rocket/api/types/data_type.py index c634917..8d8e037 100644 --- a/Difficult_Rocket/api/types/data_type.py +++ b/Difficult_Rocket/api/types/data_type.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index ee4c736..34dfbbc 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/client/fps/__init__.py b/Difficult_Rocket/client/fps/__init__.py index 43badfc..fc7a7cc 100644 --- a/Difficult_Rocket/client/fps/__init__.py +++ b/Difficult_Rocket/client/fps/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/client/fps/fps_log.py b/Difficult_Rocket/client/fps/fps_log.py index 180511f..4052ac0 100644 --- a/Difficult_Rocket/client/fps/fps_log.py +++ b/Difficult_Rocket/client/fps/fps_log.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/client/screen.py b/Difficult_Rocket/client/screen.py index 5dfcfc2..2738e98 100644 --- a/Difficult_Rocket/client/screen.py +++ b/Difficult_Rocket/client/screen.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/command/__init__.py b/Difficult_Rocket/command/__init__.py index dd06d09..3492384 100644 --- a/Difficult_Rocket/command/__init__.py +++ b/Difficult_Rocket/command/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/command/api.py b/Difficult_Rocket/command/api.py index 1b0b633..dd025b0 100644 --- a/Difficult_Rocket/command/api.py +++ b/Difficult_Rocket/command/api.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/command/line.py b/Difficult_Rocket/command/line.py index d8fa9d0..d08054a 100644 --- a/Difficult_Rocket/command/line.py +++ b/Difficult_Rocket/command/line.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/command/tree.py b/Difficult_Rocket/command/tree.py index 99c018f..8f51617 100644 --- a/Difficult_Rocket/command/tree.py +++ b/Difficult_Rocket/command/tree.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/crash/__init__.py b/Difficult_Rocket/crash/__init__.py index a313aa9..ec616a0 100644 --- a/Difficult_Rocket/crash/__init__.py +++ b/Difficult_Rocket/crash/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/crash/crash.py b/Difficult_Rocket/crash/crash.py index 1041e39..c0d572c 100644 --- a/Difficult_Rocket/crash/crash.py +++ b/Difficult_Rocket/crash/crash.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/exception/__init__.py b/Difficult_Rocket/exception/__init__.py new file mode 100644 index 0000000..baafbc4 --- /dev/null +++ b/Difficult_Rocket/exception/__init__.py @@ -0,0 +1,111 @@ +# ------------------------------- +# Difficult Rocket +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com +# All rights reserved +# ------------------------------- + +""" +main.py +""" + + +class Error(Exception): + """基础 Exception""" + + def __bool__(self): + return False + + +class TexturesError(Error): + """材质相关 error""" + + +class LanguageError(Error): + """语言相关 error""" + + +class TestError(Error): + """就像名字一样 用于测试的 error""" + + +""" +unsupport.py +""" + + +class NoMoreJson5(Error): + """说什么我也不用Json5了!""" + + +class Nope418ImATeapot(Error): + """我只是个茶壶而已,我不能煮咖啡!""" + + +class ThinkError(Error): + """进不去,进不去,怎么想都进不去!""" + + +class BrainError(Error): + """clever brain.png""" + + +class BigBrainError(BrainError): + """bigbrain.png""" + + +class BrainTimeoutError(BrainError, ThinkError): + """脑子····超时·······················啦!""" + + +""" +command.py +""" + + +class CommandError(Error): + """命令解析相关 error""" + + +class CommandParseError(CommandError): + """命令解析时出现错误""" + + +# QMark -> Quotation marks +# Pos -> Position + +class CommandQMarkPosError(CommandParseError): + """命令中,引号位置不正确 + 例如: /command "aabcc "awdawd""" + + +class CommandQMarkMissing(CommandParseError): + """命令中引号缺失 + 例如: /command "aawwdawda awdaw """ + + +class CommandQMarkConflict(CommandParseError): + """命令中引号位置冲突 + 例如: /command "aaaa "aaaa aaaa""" + first_qmark_pos = None + conflict_qmark_pos = None + + +class CommandQMarkPreMissing(CommandQMarkMissing): + """命令中 前面的引号缺失 + 例如: /command aaaa" aaaaaa""" + suf_qmark_pos = None + + +class CommandQMarkSufMissing(CommandQMarkMissing): + """命令中 后面的引号缺失(引号未闭合) + 例如: /command "aaaawaa some command""" + pre_qmark_pos = None + + +""" +threading.py +""" + + +class LockTimeOutError(Error): + """没有特殊指定的 ”某个“ 锁超时了""" diff --git a/Difficult_Rocket/guis/__init__.py b/Difficult_Rocket/guis/__init__.py index 43badfc..fc7a7cc 100644 --- a/Difficult_Rocket/guis/__init__.py +++ b/Difficult_Rocket/guis/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/guis/format/html.py b/Difficult_Rocket/guis/format/html.py index f054374..e5d6987 100644 --- a/Difficult_Rocket/guis/format/html.py +++ b/Difficult_Rocket/guis/format/html.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/guis/label.py b/Difficult_Rocket/guis/label.py index e0628ce..6b7608b 100644 --- a/Difficult_Rocket/guis/label.py +++ b/Difficult_Rocket/guis/label.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/guis/widgets.py b/Difficult_Rocket/guis/widgets.py index 39cf026..d4796aa 100644 --- a/Difficult_Rocket/guis/widgets.py +++ b/Difficult_Rocket/guis/widgets.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/main.py b/Difficult_Rocket/main.py index 97f3618..800ce44 100644 --- a/Difficult_Rocket/main.py +++ b/Difficult_Rocket/main.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/mods/__init__.py b/Difficult_Rocket/mods/__init__.py index 4f22fac..d14eff3 100644 --- a/Difficult_Rocket/mods/__init__.py +++ b/Difficult_Rocket/mods/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/mods/api/__init__.py b/Difficult_Rocket/mods/api/__init__.py index 43badfc..fc7a7cc 100644 --- a/Difficult_Rocket/mods/api/__init__.py +++ b/Difficult_Rocket/mods/api/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/mods/api/client.py b/Difficult_Rocket/mods/api/client.py index fc29504..530321f 100644 --- a/Difficult_Rocket/mods/api/client.py +++ b/Difficult_Rocket/mods/api/client.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/mods/loader/__init__.py b/Difficult_Rocket/mods/loader/__init__.py index 43badfc..fc7a7cc 100644 --- a/Difficult_Rocket/mods/loader/__init__.py +++ b/Difficult_Rocket/mods/loader/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/server/__init__.py b/Difficult_Rocket/server/__init__.py index ee083df..562c538 100644 --- a/Difficult_Rocket/server/__init__.py +++ b/Difficult_Rocket/server/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/utils/__init__.py b/Difficult_Rocket/utils/__init__.py index 9c1851b..8a1fe49 100644 --- a/Difficult_Rocket/utils/__init__.py +++ b/Difficult_Rocket/utils/__init__.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/utils/new_thread.py b/Difficult_Rocket/utils/new_thread.py index 4668ba8..d2a58a5 100644 --- a/Difficult_Rocket/utils/new_thread.py +++ b/Difficult_Rocket/utils/new_thread.py @@ -1,9 +1,8 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- -# 本文件以 GNU Lesser General Public License v3.0(GNU LGPL v3) 开源协议进行授权 (谢谢狐狸写出这么好的MCDR) import functools import inspect diff --git a/Difficult_Rocket/utils/thread.py b/Difficult_Rocket/utils/thread.py index 5380e87..b106d7f 100644 --- a/Difficult_Rocket/utils/thread.py +++ b/Difficult_Rocket/utils/thread.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/utils/tools.py b/Difficult_Rocket/utils/tools.py index f42be48..6b0168c 100644 --- a/Difficult_Rocket/utils/tools.py +++ b/Difficult_Rocket/utils/tools.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/Difficult_Rocket/utils/translate.py b/Difficult_Rocket/utils/translate.py index 7700c08..617986d 100644 --- a/Difficult_Rocket/utils/translate.py +++ b/Difficult_Rocket/utils/translate.py @@ -1,6 +1,6 @@ # ------------------------------- # Difficult Rocket -# Copyright © 2021-2022 by shenjackyuanjie +# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com # All rights reserved # ------------------------------- diff --git a/libs/msdnicrosoft_logger/shenjack.py b/libs/msdnicrosoft_logger/shenjack.py index 59d132b..084dabd 100644 --- a/libs/msdnicrosoft_logger/shenjack.py +++ b/libs/msdnicrosoft_logger/shenjack.py @@ -3,6 +3,8 @@ import threading from time import strftime from typing import Optional +from Difficult_Rocket.api.Exp.threading import + color_reset_suffix = "\033[0m" @@ -11,7 +13,7 @@ class LogFileCache: def __init__(self, file_name: str = 'logs//log.log', flush_time: Optional[int, float] = 1, cache_entries_num: int = 10): # 配置相关 - self.log_file_name = file_name # log 文件名称 + self._logfile_name = file_name # log 文件名称 self.flush_time = flush_time # 缓存刷新时长 self.cache_entries_num = cache_entries_num # 写入缓存数 @@ -19,8 +21,17 @@ class LogFileCache: # 日志缓存表 self.log_caches = [] # 同步锁 - self.thread_log = threading.Lock + self.thread_lock = threading.Lock() + @property + def logfile_name(self) -> str: + return self._logfile_name + + @logfile_name.setter + def logfile_name(self, value: str) -> None: + self.thread_lock.acquire(timeout=1/60) + if not self.thread_lock.locked(): + ... def _log_file_time_write(self) -> None: """使用 threading.Timer 调用的定时写入日志文件的函数""" @@ -30,7 +41,7 @@ class LogFileCache: def make_log(self, string: str, wait_for_cache: bool = True) -> None: if wait_for_cache: - with open(file=self.log_file_name, encoding='utf-8', mode='a') as log_file: + with open(file=self.logfile_name, encoding='utf-8', mode='a') as log_file: log_file.writelines(self.log_caches) log_file.write(string) ...