diff --git a/astrbot/core/star/filter/command.py b/astrbot/core/star/filter/command.py index 7d3cabbfa..32373db37 100755 --- a/astrbot/core/star/filter/command.py +++ b/astrbot/core/star/filter/command.py @@ -18,8 +18,8 @@ class CommandFilter(HandlerFilter): def __init__( self, command_name: str, - alias: set = None, - handler_md: StarHandlerMetadata = None, + alias: set | None = None, + handler_md: StarHandlerMetadata | None = None, parent_command_names: List[str] = [""], ): self.command_name = command_name diff --git a/astrbot/core/utils/t2i/network_strategy.py b/astrbot/core/utils/t2i/network_strategy.py index 3bd8e15fd..03db6d5e7 100644 --- a/astrbot/core/utils/t2i/network_strategy.py +++ b/astrbot/core/utils/t2i/network_strategy.py @@ -11,7 +11,7 @@ ASTRBOT_T2I_DEFAULT_ENDPOINT = "https://t2i.soulter.top/text2img" class NetworkRenderStrategy(RenderStrategy): - def __init__(self, base_url: str = ASTRBOT_T2I_DEFAULT_ENDPOINT) -> None: + def __init__(self, base_url: str | None = None) -> None: super().__init__() if not base_url: base_url = ASTRBOT_T2I_DEFAULT_ENDPOINT @@ -38,7 +38,7 @@ class NetworkRenderStrategy(RenderStrategy): tmpl_str: str, tmpl_data: dict, return_url: bool = True, - options: dict = None, + options: dict | None = None, ) -> str: """使用自定义文转图模板""" default_options = {"full_page": True, "type": "jpeg", "quality": 40} diff --git a/astrbot/core/utils/t2i/renderer.py b/astrbot/core/utils/t2i/renderer.py index ddfd2d0da..9e423be15 100644 --- a/astrbot/core/utils/t2i/renderer.py +++ b/astrbot/core/utils/t2i/renderer.py @@ -6,7 +6,7 @@ logger = LogManager.GetLogger(log_name="astrbot") class HtmlRenderer: - def __init__(self, endpoint_url: str = None): + def __init__(self, endpoint_url: str | None = None): self.network_strategy = NetworkRenderStrategy(endpoint_url) self.local_strategy = LocalRenderStrategy() @@ -20,7 +20,7 @@ class HtmlRenderer: tmpl_str: str, tmpl_data: dict, return_url: bool = False, - options: dict = None, + options: dict | None = None, ): """使用自定义文转图模板。该方法会通过网络调用 t2i 终结点图文渲染API。 @param tmpl_str: HTML Jinja2 模板。