refactor: 优化 NBPF 模块 - 缓存导入/合并重复方法/减少I/O
- crypto.py: 8个_imp_*方法改为_ModuleCache类缓存导入 - crypto.py: outer/inner加解密合并为_layer_encrypt/decrypt - crypto.py: 提取公共摘要计算方法,拆分长方法 - compiler.py: 删除_obfuscate_code中未使用的死代码 - loader.py: 3次ZIP扫描合并为1次缓存读取 - format.py: 更新为使用_ModuleCache - 合计减少205行代码(1707→1502)
This commit is contained in:
@@ -335,8 +335,8 @@ class PluginManager:
|
||||
result = ast.literal_eval(content)
|
||||
if isinstance(result, dict):
|
||||
return {k: v for k, v in result.items() if not k.startswith("_")}
|
||||
except (ValueError, SyntaxError):
|
||||
pass
|
||||
except (ValueError, SyntaxError) as e:
|
||||
print(f"[Manager] 配置解析错误: {e}")
|
||||
|
||||
config = {}
|
||||
for line in content.split('\n'):
|
||||
@@ -454,8 +454,8 @@ class PluginManager:
|
||||
try:
|
||||
if hasattr(self.plugins[plugin_name]["instance"], "stop"):
|
||||
self.plugins[plugin_name]["instance"].stop()
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(f"[Manager] 错误: {e}")
|
||||
# 从 sys.modules 中移除
|
||||
module_name = f"plugin.{plugin_name}"
|
||||
if module_name in sys.modules:
|
||||
|
||||
Reference in New Issue
Block a user