feat: 开一些集控相关的洞#4
Open
IsHPDuwu wants to merge 1 commit into
Open
Conversation
RinLit-233-shiroko
requested changes
Jul 17, 2026
Comment on lines
+118
to
+123
| def list_schedules(self) -> List[Dict[str, str]]: ... | ||
|
|
||
| def set_schedule_readonly(self, readonly: bool) -> None: ... | ||
| @property | ||
| def schedule_readonly(self) -> bool: ... | ||
|
|
Member
There was a problem hiding this comment.
R118到R123 这部分不太优雅,可以考虑优化为:
def set_readonly(self, readonly: bool) -> None: ... # 以及最好返回结果(ps之前的也帮忙顺便改吧)
@property
def readonly(self) -> bool: ...并且由于 ScheduleAPI 这个类名本身已经是单数,并且目前其方法也是对单个正在使用的课程表文件的修改。在这里增加的 list_schedules 与 switch 方法我认为算是违反单一职责的;我推荐可以开个新的API类来专门管理多个课程表
Comment on lines
+197
to
+198
| def get_global(self, key: str, default: Any = ...) -> Any: ... | ||
| def set_global(self, key: str, value: Any) -> None: ... |
Member
There was a problem hiding this comment.
同上,方法命名不简洁。推荐改为 get() 、set() ,这个global若是指向的全局设置,那我觉得不加反而更好。
Comment on lines
+200
to
+201
| def lock_config_keys(self, keys: List[str]) -> None: ... | ||
| def unlock_config_keys(self, keys: List[str]) -> None: ... |
Member
There was a problem hiding this comment.
也同上,这个 config 是不是多余了?
Comment on lines
+199
to
+204
|
|
||
| def lock_config_keys(self, keys: List[str]) -> None: ... | ||
| def unlock_config_keys(self, keys: List[str]) -> None: ... | ||
| def is_key_locked(self, key: str) -> bool: ... | ||
| @property | ||
| def locked_keys(self) -> List[str]: ... |
Member
There was a problem hiding this comment.
并且对于这些无法一眼通过方法名就能了解的函数,我希望可以增加 docstring 通过文字注解补充含义,也能方便后期的文档制作。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
别忘了 bump ))