diff --git a/src/heurams/__main__.py b/src/heurams/__main__.py index 3fc9cb8..ca087c5 100644 --- a/src/heurams/__main__.py +++ b/src/heurams/__main__.py @@ -1,7 +1,7 @@ -prompt = """HeurAMS 已经被成功地安装在系统中. +prompt = """HeurAMS 已经被成功地安装在系统中. 但 HeurAMS 被设计为一个带有辅助记忆调度器功能的软件包, 无法直接被执行, 但可被其他 Python 程序调用. 若您想启动内置的基本用户界面, 请运行 python -m heurams.interface, 或者 python -m heurams.interface.__main__ 注意: 一个常见的误区是, 执行 interface 下的 __main__.py 运行基本用户界面, 这会导致 Python 上下文环境异常, 请不要这样做.""" -print(prompt) \ No newline at end of file +print(prompt) diff --git a/src/heurams/kernel/particles/atom.py b/src/heurams/kernel/particles/atom.py index 914cd1c..c012b8e 100644 --- a/src/heurams/kernel/particles/atom.py +++ b/src/heurams/kernel/particles/atom.py @@ -16,7 +16,7 @@ logger = get_logger(__name__) class AtomRegister_runtime(TypedDict): locked: bool # 只读锁定标识符 min_rate: int # 最低评分 - newact: bool # 新激活 + newact: bool # 新激活 class AtomRegister(TypedDict): @@ -68,9 +68,9 @@ class Atom: self.registry[key] = value logger.debug("键 '%s' 已链接, 触发 do_eval", key) self.do_eval() - if key == 'electron': - if self.registry['electron'].is_activated() == 0: - self.registry['runtime']['newact'] = True + if key == "electron": + if self.registry["electron"].is_activated() == 0: + self.registry["runtime"]["newact"] = True else: logger.error("尝试链接不受支持的键: '%s'", key) raise ValueError("不受支持的原子元数据链接操作") @@ -104,7 +104,10 @@ class Atom: """ if self.registry["runtime"]["locked"]: logger.debug(f"允许总评分: {self.registry['runtime']['min_rate']}") - self.registry["electron"].revisor(self.registry["runtime"]["min_rate"], is_new_activation=self.registry["runtime"]["newact"]) + self.registry["electron"].revisor( + self.registry["runtime"]["min_rate"], + is_new_activation=self.registry["runtime"]["newact"], + ) else: logger.debug("禁止总评分") diff --git a/tests/interface/test_dashboard.py b/tests/interface/test_dashboard.py index bec0c77..685ac27 100644 --- a/tests/interface/test_dashboard.py +++ b/tests/interface/test_dashboard.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -DashboardScreen 的测试, 包括单元测试和 pilot 测试. +DashboardScreen 的测试, 包括单元测试和 pilot 测试. """ import unittest import tempfile @@ -16,10 +16,10 @@ from heurams.interface.screens.dashboard import DashboardScreen class TestDashboardScreenUnit(unittest.TestCase): - """DashboardScreen 的单元测试(不启动完整应用). """ + """DashboardScreen 的单元测试(不启动完整应用).""" def setUp(self): - """在每个测试之前运行, 设置临时目录和配置. """ + """在每个测试之前运行, 设置临时目录和配置.""" # 创建临时目录用于测试数据 self.temp_dir = tempfile.TemporaryDirectory() self.temp_path = pathlib.Path(self.temp_dir.name) @@ -53,12 +53,12 @@ class TestDashboardScreenUnit(unittest.TestCase): self.config_ctx.__enter__() def tearDown(self): - """在每个测试之后清理. """ + """在每个测试之后清理.""" self.config_ctx.__exit__(None, None, None) self.temp_dir.cleanup() def test_compose(self): - """测试 compose 方法返回正确的部件. """ + """测试 compose 方法返回正确的部件.""" screen = DashboardScreen() # 手动调用 compose 并收集部件 from textual.app import ComposeResult @@ -84,7 +84,7 @@ class TestDashboardScreenUnit(unittest.TestCase): self.assertEqual(list_view.__class__.__name__, "ListView") def test_item_desc_generator(self): - """测试 item_desc_generator 函数. """ + """测试 item_desc_generator 函数.""" screen = DashboardScreen() # 模拟一个文件名 filename = "test.toml" @@ -100,10 +100,10 @@ class TestDashboardScreenUnit(unittest.TestCase): @unittest.skip("Pilot 测试需要进一步配置, 暂不运行") class TestDashboardScreenPilot(unittest.TestCase): - """使用 Textual Pilot 的集成测试. """ + """使用 Textual Pilot 的集成测试.""" def setUp(self): - """配置临时目录和配置. """ + """配置临时目录和配置.""" self.temp_dir = tempfile.TemporaryDirectory() self.temp_path = pathlib.Path(self.temp_dir.name) @@ -134,7 +134,7 @@ class TestDashboardScreenPilot(unittest.TestCase): self.temp_dir.cleanup() def test_dashboard_loads_with_pilot(self): - """使用 Pilot 测试 DashboardScreen 加载. """ + """使用 Pilot 测试 DashboardScreen 加载.""" with patch("heurams.interface.__main__.environment_check"): app = HeurAMSApp() # 注意: Pilot 在 Textual 6.9.0 中的用法可能不同