Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

feat(i18n): 翻译完整性检查#841

Merged
baiyao105 merged 4 commits into
mainfrom
re-i18n.scan
Aug 11, 2025
Merged

feat(i18n): 翻译完整性检查#841
baiyao105 merged 4 commits into
mainfrom
re-i18n.scan

Conversation

@baiyao105

@baiyao105 baiyao105 commented Aug 11, 2025

Copy link
Copy Markdown
Member

笑点解析: 发布分支发布到upsteam了

@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown

🧪 静态检查结果

检查已完成(16874612050) - [🔄 PR检查],以下为结果

🕒 检查时间:2025-08-11 08:18:44 UTC / 2025-08-11 16:18:44 UTC+8
📝 触发提交信息ea65ab0: "移植。"
📁 检查的文件数:2 个 - i18n_manager.py,menu.py


🚨 严重错误

❌ PyLint 严重错误(点我展开)
menu.py:1281:30: E1136: Value 'list' is unsubscriptable (unsubscriptable-object)
❌ MyPy 严重错误(点我展开)
generate_speech.py:119: error: Returning Any from function declared to return "Optional[str]"  [no-any-return]
generate_speech.py:502: error: Call to untyped function "EdgeTTSProvider" in typed context  [no-untyped-call]
generate_speech.py:503: error: Call to untyped function "Pyttsx3Provider" in typed context  [no-untyped-call]
generate_speech.py:688: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
generate_speech.py:693: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]
generate_speech.py:771: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]
generate_speech.py:776: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]
file.py:198: error: Incompatible default for argument "old_section" (default has type "None", argument has type "str")  [assignment]
file.py:198: error: Incompatible default for argument "old_key" (default has type "None", argument has type "str")  [assignment]
file.py:198: error: Incompatible default for argument "new_section" (default has type "None", argument has type "str")  [assignment]
file.py:199: error: Incompatible default for argument "new_key" (default has type "None", argument has type "str")  [assignment]
list_.py:117: error: Need type annotation for "not_exist_themes" (hint: "not_exist_themes: List[<type>] = ...")  [var-annotated]
list_.py:210: error: Missing return statement  [return]
list_.py:227: error: Returning Any from function declared to return "str"  [no-any-return]
list_.py:313: error: Argument 1 to "len" has incompatible type "Optional[Any]"; expected "Sized"  [arg-type]
list_.py:365: error: Returning Any from function declared to return "List[str]"  [no-any-return]
utils.py:77: error: Item "None" of "Optional[SingleInstanceGuard]" has no attribute "release"  [union-attr]
utils.py:116: error: Item "None" of "Optional[SingleInstanceGuard]" has no attribute "release"  [union-attr]
utils.py:241: error: Unsupported operand types for < ("datetime" and "float")  [operator]
utils.py:242: error: Unsupported operand types for >= ("datetime" and "float")  [operator]
utils.py:245: error: Argument "seconds" to "timedelta" has incompatible type "Union[float, datetime]"; expected "float"  [arg-type]
utils.py:524: error: Incompatible return value type (got "float", expected "int")  [return-value]
utils.py:598: error: Incompatible types in assignment (expression has type "datetime", variable has type "Optional[float]")  [assignment]
utils.py:632: error: Unsupported operand types for - ("float" and "None")  [operator]
utils.py:633: error: Returning Any from function declared to return "datetime"  [no-any-return]
utils.py:633: error: Unsupported operand types for + ("float" and "timedelta")  [operator]
utils.py:658: error: Incompatible return value type (got "float", expected "int")  [return-value]
utils.py:693: error: Incompatible return value type (got "Optional[float]", expected "Optional[datetime]")  [return-value]
utils.py:727: error: Unexpected keyword argument "config" for "TimeManagerInterface"  [call-arg]
conf.py:80: error: Returning Any from function declared to return "Optional[Dict[str, Any]]"  [no-any-return]
conf.py:88: error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "update"  [union-attr]
conf.py:99: error: Incompatible types in assignment (expression has type "Dict[str, List[Any]]", variable has type "List[Any]")  [assignment]
conf.py:128: error: Argument 1 to "Path" has incompatible type "Optional[str]"; expected "Union[str, PathLike[str]]"  [arg-type]
conf.py:173: error: Incompatible types in assignment (expression has type "Path", variable has type "str")  [assignment]
conf.py:174: error: Incompatible types in assignment (expression has type "Union[Path, str]", variable has type "str")  [assignment]
conf.py:177: error: Argument 1 to "Path" has incompatible type "Optional[str]"; expected "Union[str, PathLike[str]]"  [arg-type]
conf.py:180: error: "str" has no attribute "stem"  [attr-defined]
conf.py:187: error: "str" has no attribute "parent"  [attr-defined]
conf.py:193: error: Argument 1 to "join" has incompatible type "Optional[str]"; expected "str"  [arg-type]
conf.py:206: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]
conf.py:293: error: Need type annotation for "plugin_dict" (hint: "plugin_dict: Dict[<type>, <type>] = ...")  [var-annotated]
play_audio.py:71: error: Module "conf" does not explicitly export attribute "base_directory"  [attr-defined]
play_audio.py:97: error: Module "conf" does not explicitly export attribute "base_directory"  [attr-defined]
play_audio.py:107: error: Module "conf" does not explicitly export attribute "base_directory"  [attr-defined]
play_audio.py:181: error: Call to untyped function "AudioManager" in typed context  [no-untyped-call]
plugin.py:25: error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "get"  [union-attr]
plugin.py:26: error: Unsupported right operand type for in ("Optional[Dict[str, Any]]")  [operator]
plugin.py:27: error: Value of type "Optional[Dict[str, Any]]" is not indexable  [index]
plugin.py:30: error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "get"  [union-attr]
plugin.py:31: error: Value of type "Optional[Dict[str, Any]]" is not indexable  [index]

📋 其他检查

🔍 PyLint 提示(点我展开)
************* Module i18n_manager
i18n_manager.py:30:0: C0325: Unnecessary parens after ':=' keyword (superfluous-parens)
i18n_manager.py:57:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:131:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:145:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:153:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:191:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:204:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:224:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:227:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:229:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:237:0: C0303: Trailing whitespace (trailing-whitespace)
i18n_manager.py:262:0: C0304: Final newline missing (missing-final-newline)
i18n_manager.py:30:20: W0622: Redefining built-in 'dir' (redefined-builtin)
i18n_manager.py:38:11: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:74:15: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:66:16: W0612: Unused variable 'theme_name' (unused-variable)
i18n_manager.py:95:15: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:159:12: W0621: Redefining name 'app' from outer scope (line 260) (redefined-outer-name)
i18n_manager.py:158:12: W0621: Redefining name 'Path' from outer scope (line 6) (redefined-outer-name)
i18n_manager.py:207:15: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:158:12: W0404: Reimport 'Path' (imported line 6) (reimported)
i18n_manager.py:158:12: C0415: Import outside toplevel (pathlib.Path) (import-outside-toplevel)
i18n_manager.py:198:12: C0415: Import outside toplevel (list_) (import-outside-toplevel)
i18n_manager.py:199:12: C0415: Import outside toplevel (importlib) (import-outside-toplevel)
i18n_manager.py:225:15: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:217:16: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
i18n_manager.py:232:8: W0621: Redefining name 'app' from outer scope (line 260) (redefined-outer-name)
i18n_manager.py:250:15: W0718: Catching too general exception Exception (broad-exception-caught)
i18n_manager.py:185:16: W0201: Attribute 'current_language_widgets' defined outside __init__ (attribute-defined-outside-init)
i18n_manager.py:5:0: C0411: standard import "os" should be placed before third party imports "qfluentwidgets.FluentTranslator", "PyQt5.QtCore.QLocale", "PyQt5.QtWidgets.QApplication" (wrong-import-order)
i18n_manager.py:6:0: C0411: standard import "pathlib.Path" should be placed before third party imports "qfluentwidgets.FluentTranslator", "PyQt5.QtCore.QLocale", "PyQt5.QtWidgets.QApplication" (wrong-import-order)
i18n_manager.py:8:0: C0411: standard import "sys" should be placed before third party imports "qfluentwidgets.FluentTranslator", "PyQt5.QtCore.QLocale", "PyQt5.QtWidgets.QApplication", "loguru.logger" (wrong-import-order)
i18n_manager.py:9:0: C0411: standard import "json" should be placed before third party imports "qfluentwidgets.FluentTranslator", "PyQt5.QtCore.QLocale", "PyQt5.QtWidgets.QApplication", "loguru.logger" (wrong-import-order)
i18n_manager.py:10:0: C0411: standard import "datetime.datetime" should be placed before third party imports "qfluentwidgets.FluentTranslator", "PyQt5.QtCore.QLocale", "PyQt5.QtWidgets.QApplication", "loguru.logger" (wrong-import-order)
i18n_manager.py:10:0: W0611: Unused datetime imported from datetime (unused-import)
************* Module menu
menu.py:35:100: C0303: Trailing whitespace (trailing-whitespace)
menu.py:43:109: C0303: Trailing whitespace (trailing-whitespace)
menu.py:44:109: C0303: Trailing whitespace (trailing-whitespace)
menu.py:45:101: C0303: Trailing whitespace (trailing-whitespace)
menu.py:60:29: C0303: Trailing whitespace (trailing-whitespace)
menu.py:61:86: C0303: Trailing whitespace (trailing-whitespace)
menu.py:129:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:132:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:139:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:169:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:174:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:182:0: C0303: Trailing whitespace (trailing-whitespace)
menu.py:219:0: C0303: Trailing whitespace (trailing-whitespace)
🔍 MyPy 提示(点我展开)
file.py:198: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
file.py:198: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
file.py:199: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
file.py:199: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
utils.py:241: note: Right operand is of type "Union[float, datetime]"
utils.py:242: note: Right operand is of type "Union[float, datetime]"
utils.py:632: note: Right operand is of type "Optional[float]"
.venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/builtins.pyi:110: note: "TimeManagerInterface" defined here
weather.py:684: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
weather.py:684: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
weather.py:1715: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
weather.py:1715: note: Consider using "Mapping" instead, which is covariant in the value type
weather.py:1715: note: Perhaps you need a type annotation for "result"? Suggestion: "Dict[str, Optional[str]]"
weather.py:1718: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
weather.py:1718: note: Consider using "Mapping" instead, which is covariant in the value type
weather.py:1718: note: Perhaps you need a type annotation for "result"? Suggestion: "Dict[str, Optional[str]]"
weather.py:2296: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
weather.py:2296: note: Consider using "Mapping" instead, which is covariant in the value type
weather.py:2296: note: Perhaps you need a type annotation for "aqi_data"? Suggestion: "Dict[str, Optional[str]]"
weather.py:2338: note: "Dict" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
weather.py:2338: note: Consider using "Mapping" instead, which is covariant in the value type
weather.py:2338: note: Perhaps you need a type annotation for "aqi_data"? Suggestion: "Dict[str, Optional[str]]"
network_thread.py:460: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
network_thread.py:460: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
menu.py:1623: note: Possible overload variants:
menu.py:1623: note:     def setParent(self, parent: QWidget) -> None
menu.py:1623: note:     def setParent(self, parent: QWidget, f: Union[WindowFlags, WindowType]) -> None
menu.py:3371: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
menu.py:3371: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
menu.py:3380: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
menu.py:3380: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
Found 720 errors in 14 files (checked 2 source files)

@baiyao105

Copy link
Copy Markdown
Member Author

@IsHPDuwu 如果你觉得Scripts/i18n还有用建议改下

@baiyao105 baiyao105 requested a review from IsHPDuwu August 11, 2025 08:25
@IsHPDuwu

Copy link
Copy Markdown
Member

@IsHPDuwu 如果你觉得Scripts/i18n还有用建议改下

你看要不要留,可以删了

@baiyao105 baiyao105 merged commit 8dcac84 into main Aug 11, 2025
8 of 9 checks passed
@baiyao105 baiyao105 deleted the re-i18n.scan branch August 11, 2025 08:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants