Skip to content

chore: fix UnsupportedDunder report in pyright#5474

Merged
Soulter merged 1 commit intoAstrBotDevs:masterfrom
Dt8333:fix-UnsupportedDunder
Feb 26, 2026
Merged

chore: fix UnsupportedDunder report in pyright#5474
Soulter merged 1 commit intoAstrBotDevs:masterfrom
Dt8333:fix-UnsupportedDunder

Conversation

@Dt8333
Copy link
Member

@Dt8333 Dt8333 commented Feb 26, 2026

修复静态检查中XXX is specified in __all__ but is not present in module的问题。

Modifications / 改动点

astrbot\core\pipeline_init_.py
添加了TYPE_CHECKING检查时导入模块。

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 26, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Dt8333, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a static analysis warning from Pyright concerning __all__ and module imports. It refactors the import statements within the astrbot/core/pipeline/__init__.py file to use conditional TYPE_CHECKING blocks, ensuring that type hints are correctly resolved during static analysis without introducing runtime import overhead or circular dependency issues. The change improves code maintainability and clarity for type checkers.

Highlights

  • Static Analysis Fix: Resolved a Pyright UnsupportedDunder report related to __all__ and module presence by introducing conditional TYPE_CHECKING imports.
  • Type Hinting Improvement: Enhanced type hinting accuracy and reduced potential import cycles by moving specific stage imports into a TYPE_CHECKING block.
Changelog
  • astrbot/core/pipeline/init.py
    • Added TYPE_CHECKING import from the typing module.
    • Introduced a if TYPE_CHECKING: block to conditionally import pipeline stage modules for static analysis purposes.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗨——我已经审查了你的更改,看起来非常不错!


Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进后续评审。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot
Copy link

dosubot bot commented Feb 26, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added the area:core The bug / feature is about astrbot's core, backend label Feb 26, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 旨在修复 pyright 静态检查报告的 __all__ 中指定的名称在模块中不存在的问题。通过在 if TYPE_CHECKING: 块中导入类型,该变更解决了此问题,这是一种在支持懒加载的同时满足类型检查器要求的标准做法。代码实现正确,没有发现问题。

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 26, 2026
@Soulter Soulter merged commit 10163ec into AstrBotDevs:master Feb 26, 2026
6 checks passed
@astrbot-doc-agent
Copy link

No docs changes were generated in this run (docs repo had no updates).

Docs repo: AstrBotDevs/AstrBot-docs
Trigger: PR merged


AI change summary (not committed):

根据对 PR #5474 的分析,这是一个内部代码质量改进的变更,不需要更新文档。

总结

  • PR 性质: 内部代码修复,解决 pyright 静态检查中的 UnsupportedDunder 警告
  • 变更内容: 在 astrbot/core/pipeline/__init__.py 中添加 TYPE_CHECKING 条件导入,使类型检查器能正确识别 __all__ 中声明的导出
  • 用户影响: 无。此变更不影响任何用户可见的功能、API 或使用方式
  • 文档更新: 不需要
    • 未发现 changelog/release-notes 文件
    • 此类内部类型检查修复不属于用户文档范畴
    • 文档仓库专注于用户指南、部署、配置和插件开发等面向用户的内容

结论: 此 PR 为纯内部代码质量改进,无需更新文档。


Experimental bot notice:

  • This output is generated by AstrBot-Doc-Agent for review only.
  • It does not represent the final documentation form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants