diff --git a/community/github/commit/commit.py b/community/github/commit/commit.py index d9843e4..affd22f 100644 --- a/community/github/commit/commit.py +++ b/community/github/commit/commit.py @@ -293,7 +293,7 @@ def generate_commit_message_base_diff(user_input, diff, issue): if ( not response["content"] and response.get("error", None) - and f'{response["error"]}'.find("This model's maximum context length is") > 0 + and f"{response['error']}".find("This model's maximum context length is") > 0 ): print(model_token_limit_error) sys.exit(0) diff --git a/community/gitlab/commit/commit.py b/community/gitlab/commit/commit.py index 8f0d57c..308caec 100644 --- a/community/gitlab/commit/commit.py +++ b/community/gitlab/commit/commit.py @@ -286,7 +286,7 @@ def generate_commit_message_base_diff(user_input, diff, issue): if ( not response["content"] and response.get("error", None) - and f'{response["error"]}'.find("This model's maximum context length is") > 0 + and f"{response['error']}".find("This model's maximum context length is") > 0 ): print(model_token_limit_error) sys.exit(0) diff --git a/community/test/api/config/command.py b/community/test/api/config/command.py index c2761bb..5d35dc4 100644 --- a/community/test/api/config/command.py +++ b/community/test/api/config/command.py @@ -2,8 +2,6 @@ import json import os import sys -sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) - from lib.chatmark import Form, TextEditor # 导入 ChatMark 组件 diff --git a/community/test/api/upload/command.py b/community/test/api/upload/command.py index b5aa69d..622a34d 100755 --- a/community/test/api/upload/command.py +++ b/community/test/api/upload/command.py @@ -8,7 +8,7 @@ import requests ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(ROOT_DIR) -from api.utils import ( # noqa: E402 +from api.utils import ( OPENAPI_URL, PROJECT_ID, SERVER_URL, diff --git a/lib/chatmark/form.py b/lib/chatmark/form.py index facbf62..48cedc4 100644 --- a/lib/chatmark/form.py +++ b/lib/chatmark/form.py @@ -22,9 +22,9 @@ class Form: components: components in the form, can be widgets (except Button) or strings title: title of the form """ - assert ( - any(isinstance(c, Button) for c in components) is False - ), "Button is not allowed in Form" + assert any(isinstance(c, Button) for c in components) is False, ( + "Button is not allowed in Form" + ) self._components = components self._title = title diff --git a/merico/unit_tests/ut_workflow.py b/merico/unit_tests/ut_workflow.py index 423ede1..b670413 100644 --- a/merico/unit_tests/ut_workflow.py +++ b/merico/unit_tests/ut_workflow.py @@ -189,8 +189,7 @@ class UnitTestsWorkflow: case_editor = TextEditor( text="", title=_i( - "You can add more test cases here\n" - "(Multiple cases can be separated by line breaks)" + "You can add more test cases here\n(Multiple cases can be separated by line breaks)" ), ) ref_editor = TextEditor( @@ -263,7 +262,7 @@ class UnitTestsWorkflow: lines.append(_i("\nTest cases:")) width = len(str(len(cases))) - lines.extend([f"{(i+1):>{width}}. {c}" for i, c in enumerate(cases)]) + lines.extend([f"{(i + 1):>{width}}. {c}" for i, c in enumerate(cases)]) if not valid_files: lines.append( @@ -276,7 +275,7 @@ class UnitTestsWorkflow: lines.append(_i("\nWill use the following reference files to generate tests.")) # lines.append(_i("\nValid reference files:")) width = len(str(len(valid_files))) - lines.extend([f"{(i+1):>{width}}. {f}" for i, f in enumerate(valid_files)]) + lines.extend([f"{(i + 1):>{width}}. {f}" for i, f in enumerate(valid_files)]) # if invalid_files: # lines.append(_i("\nInvalid files:")) @@ -294,7 +293,7 @@ class UnitTestsWorkflow: width = len(str(len(contexts))) lines.extend( [ - f"{(i+1):>{width}}. {c.file_path}:{c.range.start.line+1}-{c.range.end.line+1}" + f"{(i + 1):>{width}}. {c.file_path}:{c.range.start.line + 1}-{c.range.end.line + 1}" for i, c in enumerate(contexts) ] )