STEP 2 ⚓ pyupgrade+ruff check --fix
修复了 #XYZ
Motivation
Modifications
pyupgrade + ruff check --fix 安全的修改
Check
- [ y] 我的 Commit Message 符合良好的规范
- [y ] 我新增/修复/优化的功能经过良好的测试
好的,这是翻译成中文的 pull request 总结:
Sourcery 总结
使用 pyupgrade 将 Python 类型注解和代码风格升级到 Python 3.10+
增强功能:
- 通过将
List和Dict替换为list和dict来实现类型注解的现代化 - 更新类型提示以使用新的 Python 3.10+ 联合类型语法
- 通过删除冗余的编码参数来简化文件打开操作
日常维护:
- 添加一个脚本来自动在整个项目中运行 pyupgrade
- 通过标准化类型注解来提高代码一致性
Original summary in English
Summary by Sourcery
Upgrade Python type annotations and code style to Python 3.10+ using pyupgrade
Enhancements:
- Modernize type annotations by replacing
ListandDictwithlistanddict - Update type hints to use the new Python 3.10+ syntax for union types
- Simplify file opening by removing redundant encoding parameters
Chores:
- Add a script to automatically run pyupgrade across the project
- Improve code consistency by standardizing type annotations
## Sourcery 审查者指南
此 Pull Request 应用了 pyupgrade 和 ruff,以自动更新代码库,使其与 Python 3.10+ 兼容。它将 `List`、`Dict`、`Tuple` 和 `Union` 等类型提示替换为它们的现代等价物(`list`、`dict`、`tuple` 和 `|`),并删除了文件打开操作中多余的编码规范。
#### ProviderMetaData 的更新类图
```mermaid
classDiagram
class ProviderMetaData {
desc: str
provider_type: ProviderType
cls_type: type
default_config_tmpl: dict
}
AssistantMessageSegment 的更新类图
classDiagram
class AssistantMessageSegment {
content: str
tool_calls: list[ChatCompletionMessageToolCall | dict]
role: str
to_dict()
}
ToolCallsResult 的更新类图
classDiagram
class ToolCallsResult {
tool_calls_info: AssistantMessageSegment
tool_calls_result: list[ToolCallMessageSegment]
to_openai_messages() list[dict]
}
ProviderRequest 的更新类图
classDiagram
class ProviderRequest {
prompt: str
session_id: str
image_urls: list[str]
func_tool: FuncCall
contexts: list
assemble_context() dict
_print_friendly_context()
}
LLMResponse 的更新类图
classDiagram
class LLMResponse {
role: str
result_chain: MessageChain
tools_call_args: list[dict[str, any]]
tools_call_name: list[str]
tools_call_ids: list[str]
raw_completion: ChatCompletion
_new_record: dict[str, any]
_completion_text: str
completion_text(value)
to_openai_tool_calls() list[dict]
}
FuncCall 的更新类图
classDiagram
class FuncCall {
func_list: list[FuncTool]
mcp_client_dict: dict[str, MCPClient]
mcp_client_event: dict[str, asyncio.Event]
empty() bool
register_tool(func_tool: FuncTool)
get_func_desc_anthropic_style() list
get_func_desc_google_genai_style() dict
}
Personality 的更新类图
classDiagram
class Personality {
prompt: str
name: str
begin_dialogs: list[str]
mood_imitation_dialogs: list[str]
_begin_dialogs_processed: list[dict]
_mood_imitation_dialogs_processed: str
}
BaseDatabase 的更新类图
classDiagram
class BaseDatabase {
update_llm_history(session_id: str, content: str, provider_type: str)
get_llm_history(session_id: str, provider_type: str) list[LLMHistory]
get_atri_vision_data() list[ATRIVision]
get_conversations(user_id: str) list[Conversation]
get_all_conversations(page: int, page_size: int) tuple[list[dict[str, Any]], int]
get_filtered_conversations(page: int, page_size: int, platforms: list[str], message_types: list[str], search_query: str, exclude_ids: list[str], exclude_platforms: list[str]) tuple[list[dict[str, Any]], int]
}
AstrMessageEvent 的更新类图
classDiagram
class AstrMessageEvent {
_outline_chain(chain: list[BaseMessageComponent]) str
get_messages() list[BaseMessageComponent]
chain_result(chain: list[BaseMessageComponent]) MessageEventResult
request_llm(prompt: str, func_tool_manager, session_id: str, image_urls: list[str], contexts: list, system_prompt: str, conversation: Conversation) ProviderRequest
get_group(group_id: str, **kwargs) Group | None
}
Context 的更新类图
classDiagram
class Context {
_register_tasks: list[Awaitable]
get_all_stars() list[StarMetadata]
get_all_providers() list[Provider]
get_all_tts_providers() list[TTSProvider]
get_all_stt_providers() list[STTProvider]
get_platform(platform_type: PlatformAdapterType | str) Platform
send_message(session: str | MessageSesion, message_chain: MessageChain) bool
}
MessageChain 的更新类图
classDiagram
class MessageChain {
chain: list[BaseMessageComponent]
use_t2i_: bool | None
}
KnowledgeDBManager 的更新类图
classDiagram
class KnowledgeDBManager {
store_insts: dict[str, Store]
list_knowledge_db() list[str]
create_knowledge_db(name: str, config: dict)
retrive_records(name: str, query: str, top_n: int) list[str]
_fixed_chunk(text: str, chunk_size: int, chunk_overlap: int) list[str]
}
CommandFilter 的更新类图
classDiagram
class CommandFilter {
parent_command_names: list[str]
custom_filter_list: list[CustomFilter]
validate_and_convert_params(params: list[Any], param_type: dict[str, type]) dict[str, Any]
}
StarManager 的更新类图
classDiagram
class StarManager {
_get_plugin_modules() list[dict]
}
TextMeasurer 的更新类图
classDiagram
class TextMeasurer {
get_text_size(text: str, font: ImageFont.FreeTypeFont) tuple[int, int]
split_text_to_fit_width(text: str, font: ImageFont.FreeTypeFont, max_width: int) list[str]
}
CodeBlockElement 的更新类图
classDiagram
class CodeBlockElement {
content: list[str]
}
registered_stages 的更新类图
classDiagram
class Stage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
class registered_stages {
List[Stage]
}
ChromaVectorStore 的更新类图
classDiagram
class ChromaVectorStore {
query(query: str, top_n=3, metadata_filter: dict) list[str]
}
Stats 的更新类图
classDiagram
class Stats {
platform: list[Platform]
command: list[Command]
llm: list[Provider]
}
StarTools 的更新类图
classDiagram
class StarTools {
send_message(session: str | MessageSesion, message_chain: MessageChain) bool
create_message(session_id: str, message_id: str, sender: MessageMember, message: list[BaseMessageComponent], message_str: str, raw_message: object, group_id: str) AstrBotMessage
get_data_dir(plugin_name: str | None) Path
}
CoreLifecycle 的更新类图
classDiagram
class CoreLifecycle {
curr_tasks: list[asyncio.Task]
load_platform() list[asyncio.Task]
}
ProcessStage 的更新类图
classDiagram
class ProcessStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
RespondStage 的更新类图
classDiagram
class RespondStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
OpenAIEmbedding 的更新类图
classDiagram
class OpenAIEmbedding {
get_embedding(text) list[float]
}
LogBroker 的更新类图
classDiagram
class LogBroker {
subscribers: list[Queue]
}
PlatformAdapterTypeFilter 的更新类图
classDiagram
class PlatformAdapterTypeFilter {
__init__(platform_adapter_type_or_str: PlatformAdapterType | str)
}
ConfigRoute 的更新类图
classDiagram
class ConfigRoute {
validate_config(data, schema: dict, is_core: bool) tuple[list[str], dict]
}
SQLitePluginStorage 的更新类图
classDiagram
class SQLitePluginStorage {
__new__(cls)
}
ContentSafetyStage 的更新类图
classDiagram
class ContentSafetyStage {
process(event: AstrMessageEvent, check_text: str) None | AsyncGenerator[None, None]
}
ContentSafetyStrategy 的更新类图
classDiagram
class ContentSafetyStrategy {
check(content: str) tuple[bool, str]
}
PlatformCompatibilityStage 的更新类图
classDiagram
class PlatformCompatibilityStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
PreprocessStage 的更新类图
classDiagram
class PreprocessStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
RateLimitCheckStage 的更新类图
classDiagram
class RateLimitCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
ResultDecorateStage 的更新类图
classDiagram
class ResultDecorateStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
WakingCheckStage 的更新类图
classDiagram
class WakingCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
WhitelistCheckStage 的更新类图
classDiagram
class WhitelistCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
LarkEvent 的更新类图
classDiagram
class LarkEvent {
_convert_to_lark(message: MessageChain, lark_client: lark.Client) list
}
文件级别变更
| 变更 | 详情 | 文件 |
|---|---|---|
将 Type 替换为 type 以进行类型提示。 |
|
astrbot/core/provider/entities.py |
将 List 替换为 list 以进行类型提示。 |
|
astrbot/core/provider/entities.pyastrbot/core/provider/sources/gemini_source.pyastrbot/core/provider/sources/openai_source.pyastrbot/core/provider/sources/anthropic_source.pyastrbot/core/provider/provider.pyastrbot/core/db/__init__.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/filter/command.pyastrbot/core/star/filter/command_group.pyastrbot/core/star/star_handler.pyastrbot/core/message/message_event_result.pyastrbot/core/utils/session_waiter.pyastrbot/core/log.pyastrbot/core/pipeline/content_safety_check/strategies/strategy.pyastrbot/core/rag/store/chroma_db.pyastrbot/core/db/sqlite.pyastrbot/core/db/po.pyastrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.pyastrbot/core/platform/sources/lark/lark_event.pyastrbot/core/utils/t2i/local_strategy.pyastrbot/core/star/star.pyastrbot/core/core_lifecycle.py |
将 Dict 替换为 dict 以进行类型提示。 |
|
astrbot/core/provider/entities.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/filter/command.pyastrbot/core/star/star_handler.pyastrbot/core/rag/store/chroma_db.pyastrbot/core/rag/knowledge_db_mgr.pyastrbot/core/utils/dify_api_client.pyastrbot/core/star/star.pyastrbot/core/config/astrbot_config.pyastrbot/dashboard/routes/config.py |
将 Tuple 替换为 tuple 以进行类型提示。 |
|
astrbot/core/db/sqlite.pyastrbot/core/utils/t2i/local_strategy.pyastrbot/core/pipeline/content_safety_check/strategies/strategy.pyastrbot/dashboard/routes/config.py |
将 Optional[str] 替换为 `str |
None` 以进行类型提示。 |
|
将 Union 替换为 ` |
` 以进行类型提示。 |
|
将 AsyncGenerator[None, None] 替换为 AsyncGenerator[None]。 |
|
astrbot/core/pipeline/stage.pyastrbot/core/pipeline/process_stage/method/llm_request.pyastrbot/core/pipeline/process_stage/method/star_request.pyastrbot/core/pipeline/process_stage/stage.pyastrbot/core/pipeline/respond/stage.pyastrbot/core/pipeline/content_safety_check/stage.pyastrbot/core/pipeline/platform_compatibility/stage.pyastrbot/core/pipeline/preprocess_stage/stage.pyastrbot/core/pipeline/rate_limit_check/stage.pyastrbot/core/pipeline/result_decorate/stage.pyastrbot/core/pipeline/waking_check/stage.pyastrbot/core/pipeline/whitelist_check/stage.py |
将 Optional 替换为 ` |
None` 以进行类型提示。 |
|
在 open 调用中删除了多余或不必要的编码规范。 |
|
astrbot/core/db/sqlite.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/star_manager.pyastrbot/core/utils/t2i/network_strategy.py |
更改了 load_config 函数的返回类型注解。 |
|
bool`。 |
提示和命令
与 Sourcery 互动
- 触发新的审查: 在 Pull Request 上评论
@sourcery-ai review。 - 继续讨论: 直接回复 Sourcery 的审查评论。
- 从审查评论生成 GitHub Issue: 通过回复审查评论,要求 Sourcery 从该评论创建一个 Issue。您也可以回复评论并使用
@sourcery-ai issue来创建 Issue。 - 生成 Pull Request 标题: 在 Pull Request 标题中的任何位置写入
@sourcery-ai,以随时生成标题。您也可以在 Pull Request 上评论@sourcery-ai title以随时(重新)生成标题。 - 生成 Pull Request 摘要: 在 Pull Request 正文中的任何位置写入
@sourcery-ai summary,以在您想要的任何位置随时生成 PR 摘要。您也可以在 Pull Request 上评论@sourcery-ai summary以随时(重新)生成摘要。 - 生成审查者指南: 在 Pull Request 上评论
@sourcery-ai guide以随时(重新)生成审查者指南。 - 解决所有 Sourcery 评论: 在 Pull Request 上评论
@sourcery-ai resolve以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这将非常有用。 - 驳回所有 Sourcery 审查: 在 Pull Request 上评论
@sourcery-ai dismiss以驳回所有现有的 Sourcery 审查。如果您想重新开始新的审查,这将特别有用 - 不要忘记评论@sourcery-ai review以触发新的审查! - 为 Issue 生成行动计划: 在 Issue 上评论
@sourcery-ai plan以为其生成行动计划。
自定义您的体验
访问您的 仪表板 以:
- 启用或禁用审查功能,例如 Sourcery 生成的 Pull Request 摘要、审查者指南等。
- 更改审查语言。
- 添加、删除或编辑自定义审查说明。
- 调整其他审查设置。
获取帮助
Original review guide in English
Reviewer's Guide by Sourcery
This pull request applies pyupgrade and ruff to automatically modernize the codebase to be compatible with Python 3.10+. It replaces type hints like List, Dict, Tuple, and Union with their modern equivalents (list, dict, tuple, and |), and removes redundant encoding specifications in file opening operations.
Updated class diagram for ProviderMetaData
classDiagram
class ProviderMetaData {
desc: str
provider_type: ProviderType
cls_type: type
default_config_tmpl: dict
}
Updated class diagram for AssistantMessageSegment
classDiagram
class AssistantMessageSegment {
content: str
tool_calls: list[ChatCompletionMessageToolCall | dict]
role: str
to_dict()
}
Updated class diagram for ToolCallsResult
classDiagram
class ToolCallsResult {
tool_calls_info: AssistantMessageSegment
tool_calls_result: list[ToolCallMessageSegment]
to_openai_messages() list[dict]
}
Updated class diagram for ProviderRequest
classDiagram
class ProviderRequest {
prompt: str
session_id: str
image_urls: list[str]
func_tool: FuncCall
contexts: list
assemble_context() dict
_print_friendly_context()
}
Updated class diagram for LLMResponse
classDiagram
class LLMResponse {
role: str
result_chain: MessageChain
tools_call_args: list[dict[str, any]]
tools_call_name: list[str]
tools_call_ids: list[str]
raw_completion: ChatCompletion
_new_record: dict[str, any]
_completion_text: str
completion_text(value)
to_openai_tool_calls() list[dict]
}
Updated class diagram for FuncCall
classDiagram
class FuncCall {
func_list: list[FuncTool]
mcp_client_dict: dict[str, MCPClient]
mcp_client_event: dict[str, asyncio.Event]
empty() bool
register_tool(func_tool: FuncTool)
get_func_desc_anthropic_style() list
get_func_desc_google_genai_style() dict
}
Updated class diagram for Personality
classDiagram
class Personality {
prompt: str
name: str
begin_dialogs: list[str]
mood_imitation_dialogs: list[str]
_begin_dialogs_processed: list[dict]
_mood_imitation_dialogs_processed: str
}
Updated class diagram for BaseDatabase
classDiagram
class BaseDatabase {
update_llm_history(session_id: str, content: str, provider_type: str)
get_llm_history(session_id: str, provider_type: str) list[LLMHistory]
get_atri_vision_data() list[ATRIVision]
get_conversations(user_id: str) list[Conversation]
get_all_conversations(page: int, page_size: int) tuple[list[dict[str, Any]], int]
get_filtered_conversations(page: int, page_size: int, platforms: list[str], message_types: list[str], search_query: str, exclude_ids: list[str], exclude_platforms: list[str]) tuple[list[dict[str, Any]], int]
}
Updated class diagram for AstrMessageEvent
classDiagram
class AstrMessageEvent {
_outline_chain(chain: list[BaseMessageComponent]) str
get_messages() list[BaseMessageComponent]
chain_result(chain: list[BaseMessageComponent]) MessageEventResult
request_llm(prompt: str, func_tool_manager, session_id: str, image_urls: list[str], contexts: list, system_prompt: str, conversation: Conversation) ProviderRequest
get_group(group_id: str, **kwargs) Group | None
}
Updated class diagram for Context
classDiagram
class Context {
_register_tasks: list[Awaitable]
get_all_stars() list[StarMetadata]
get_all_providers() list[Provider]
get_all_tts_providers() list[TTSProvider]
get_all_stt_providers() list[STTProvider]
get_platform(platform_type: PlatformAdapterType | str) Platform
send_message(session: str | MessageSesion, message_chain: MessageChain) bool
}
Updated class diagram for MessageChain
classDiagram
class MessageChain {
chain: list[BaseMessageComponent]
use_t2i_: bool | None
}
Updated class diagram for KnowledgeDBManager
classDiagram
class KnowledgeDBManager {
store_insts: dict[str, Store]
list_knowledge_db() list[str]
create_knowledge_db(name: str, config: dict)
retrive_records(name: str, query: str, top_n: int) list[str]
_fixed_chunk(text: str, chunk_size: int, chunk_overlap: int) list[str]
}
Updated class diagram for CommandFilter
classDiagram
class CommandFilter {
parent_command_names: list[str]
custom_filter_list: list[CustomFilter]
validate_and_convert_params(params: list[Any], param_type: dict[str, type]) dict[str, Any]
}
Updated class diagram for StarManager
classDiagram
class StarManager {
_get_plugin_modules() list[dict]
}
Updated class diagram for TextMeasurer
classDiagram
class TextMeasurer {
get_text_size(text: str, font: ImageFont.FreeTypeFont) tuple[int, int]
split_text_to_fit_width(text: str, font: ImageFont.FreeTypeFont, max_width: int) list[str]
}
Updated class diagram for CodeBlockElement
classDiagram
class CodeBlockElement {
content: list[str]
}
Updated class diagram for registered_stages
classDiagram
class Stage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
class registered_stages {
List[Stage]
}
Updated class diagram for ChromaVectorStore
classDiagram
class ChromaVectorStore {
query(query: str, top_n=3, metadata_filter: dict) list[str]
}
Updated class diagram for Stats
classDiagram
class Stats {
platform: list[Platform]
command: list[Command]
llm: list[Provider]
}
Updated class diagram for StarTools
classDiagram
class StarTools {
send_message(session: str | MessageSesion, message_chain: MessageChain) bool
create_message(session_id: str, message_id: str, sender: MessageMember, message: list[BaseMessageComponent], message_str: str, raw_message: object, group_id: str) AstrBotMessage
get_data_dir(plugin_name: str | None) Path
}
Updated class diagram for CoreLifecycle
classDiagram
class CoreLifecycle {
curr_tasks: list[asyncio.Task]
load_platform() list[asyncio.Task]
}
Updated class diagram for ProcessStage
classDiagram
class ProcessStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for RespondStage
classDiagram
class RespondStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for OpenAIEmbedding
classDiagram
class OpenAIEmbedding {
get_embedding(text) list[float]
}
Updated class diagram for LogBroker
classDiagram
class LogBroker {
subscribers: list[Queue]
}
Updated class diagram for PlatformAdapterTypeFilter
classDiagram
class PlatformAdapterTypeFilter {
__init__(platform_adapter_type_or_str: PlatformAdapterType | str)
}
Updated class diagram for ConfigRoute
classDiagram
class ConfigRoute {
validate_config(data, schema: dict, is_core: bool) tuple[list[str], dict]
}
Updated class diagram for SQLitePluginStorage
classDiagram
class SQLitePluginStorage {
__new__(cls)
}
Updated class diagram for ContentSafetyStage
classDiagram
class ContentSafetyStage {
process(event: AstrMessageEvent, check_text: str) None | AsyncGenerator[None, None]
}
Updated class diagram for ContentSafetyStrategy
classDiagram
class ContentSafetyStrategy {
check(content: str) tuple[bool, str]
}
Updated class diagram for PlatformCompatibilityStage
classDiagram
class PlatformCompatibilityStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for PreprocessStage
classDiagram
class PreprocessStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for RateLimitCheckStage
classDiagram
class RateLimitCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for ResultDecorateStage
classDiagram
class ResultDecorateStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for WakingCheckStage
classDiagram
class WakingCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for WhitelistCheckStage
classDiagram
class WhitelistCheckStage {
process(event: AstrMessageEvent) None | AsyncGenerator[None, None]
}
Updated class diagram for LarkEvent
classDiagram
class LarkEvent {
_convert_to_lark(message: MessageChain, lark_client: lark.Client) list
}
File-Level Changes
| Change | Details | Files |
|---|---|---|
Replaced Type with type for type hinting. |
|
astrbot/core/provider/entities.py |
Replaced List with list for type hinting. |
|
astrbot/core/provider/entities.pyastrbot/core/provider/sources/gemini_source.pyastrbot/core/provider/sources/openai_source.pyastrbot/core/provider/sources/anthropic_source.pyastrbot/core/provider/provider.pyastrbot/core/db/__init__.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/filter/command.pyastrbot/core/star/filter/command_group.pyastrbot/core/star/star_handler.pyastrbot/core/message/message_event_result.pyastrbot/core/utils/session_waiter.pyastrbot/core/log.pyastrbot/core/pipeline/content_safety_check/strategies/strategy.pyastrbot/core/rag/store/chroma_db.pyastrbot/core/db/sqlite.pyastrbot/core/db/po.pyastrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.pyastrbot/core/platform/sources/lark/lark_event.pyastrbot/core/utils/t2i/local_strategy.pyastrbot/core/star/star.pyastrbot/core/core_lifecycle.py |
Replaced Dict with dict for type hinting. |
|
astrbot/core/provider/entities.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/filter/command.pyastrbot/core/star/star_handler.pyastrbot/core/rag/store/chroma_db.pyastrbot/core/rag/knowledge_db_mgr.pyastrbot/core/utils/dify_api_client.pyastrbot/core/star/star.pyastrbot/core/config/astrbot_config.pyastrbot/dashboard/routes/config.py |
Replaced Tuple with tuple for type hinting. |
|
astrbot/core/db/sqlite.pyastrbot/core/utils/t2i/local_strategy.pyastrbot/core/pipeline/content_safety_check/strategies/strategy.pyastrbot/dashboard/routes/config.py |
Replaced Optional[str] with `str |
None` for type hinting. |
|
Replaced Union with ` |
` for type hinting. |
|
Replaced AsyncGenerator[None, None] with AsyncGenerator[None]. |
|
astrbot/core/pipeline/stage.pyastrbot/core/pipeline/process_stage/method/llm_request.pyastrbot/core/pipeline/process_stage/method/star_request.pyastrbot/core/pipeline/process_stage/stage.pyastrbot/core/pipeline/respond/stage.pyastrbot/core/pipeline/content_safety_check/stage.pyastrbot/core/pipeline/platform_compatibility/stage.pyastrbot/core/pipeline/preprocess_stage/stage.pyastrbot/core/pipeline/rate_limit_check/stage.pyastrbot/core/pipeline/result_decorate/stage.pyastrbot/core/pipeline/waking_check/stage.pyastrbot/core/pipeline/whitelist_check/stage.py |
Replaced Optional with ` |
None` for type hinting. |
|
Removed encoding specification in open calls where it was redundant or unnecessary. |
|
astrbot/core/db/sqlite.pyastrbot/core/provider/func_tool_manager.pyastrbot/core/star/star_manager.pyastrbot/core/utils/t2i/network_strategy.py |
Changed the return type annotation for load_config function. |
|
boolinload_config` function. |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review! - Generate a plan of action for an issue: Comment
@sourcery-ai planon an issue to generate a plan of action for it.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
不推荐通过新增脚本实现自动更新。更优的做法是将更新逻辑集成到 pre-commit hook 中,以确保代码提交前自动执行相关检查。
例:
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py310-plus]
不推荐通过新增脚本实现自动更新。更优的做法是将更新逻辑集成到 pre-commit hook 中,以确保代码提交前自动执行相关检查。
例:
- repo: https://github.com/asottile/pyupgrade rev: v3.19.1 hooks: - id: pyupgrade args: [--py310-plus]
对,这个脚本文件取消上传了 按你这个来
等合并后,我再进一步修改