fix lint errors
This commit is contained in:
parent
7353fe1df4
commit
cceb4c1dfb
@ -293,7 +293,7 @@ def generate_commit_message_base_diff(user_input, diff, issue):
|
|||||||
if (
|
if (
|
||||||
not response["content"]
|
not response["content"]
|
||||||
and response.get("error", None)
|
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)
|
print(model_token_limit_error)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -286,7 +286,7 @@ def generate_commit_message_base_diff(user_input, diff, issue):
|
|||||||
if (
|
if (
|
||||||
not response["content"]
|
not response["content"]
|
||||||
and response.get("error", None)
|
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)
|
print(model_token_limit_error)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -2,8 +2,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
|
|
||||||
|
|
||||||
from lib.chatmark import Form, TextEditor # 导入 ChatMark 组件
|
from lib.chatmark import Form, TextEditor # 导入 ChatMark 组件
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import requests
|
|||||||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
sys.path.append(ROOT_DIR)
|
sys.path.append(ROOT_DIR)
|
||||||
|
|
||||||
from api.utils import ( # noqa: E402
|
from api.utils import (
|
||||||
OPENAPI_URL,
|
OPENAPI_URL,
|
||||||
PROJECT_ID,
|
PROJECT_ID,
|
||||||
SERVER_URL,
|
SERVER_URL,
|
||||||
|
@ -22,9 +22,9 @@ class Form:
|
|||||||
components: components in the form, can be widgets (except Button) or strings
|
components: components in the form, can be widgets (except Button) or strings
|
||||||
title: title of the form
|
title: title of the form
|
||||||
"""
|
"""
|
||||||
assert (
|
assert any(isinstance(c, Button) for c in components) is False, (
|
||||||
any(isinstance(c, Button) for c in components) is False
|
"Button is not allowed in Form"
|
||||||
), "Button is not allowed in Form"
|
)
|
||||||
|
|
||||||
self._components = components
|
self._components = components
|
||||||
self._title = title
|
self._title = title
|
||||||
|
@ -189,8 +189,7 @@ class UnitTestsWorkflow:
|
|||||||
case_editor = TextEditor(
|
case_editor = TextEditor(
|
||||||
text="",
|
text="",
|
||||||
title=_i(
|
title=_i(
|
||||||
"You can add more test cases here\n"
|
"You can add more test cases here\n(Multiple cases can be separated by line breaks)"
|
||||||
"(Multiple cases can be separated by line breaks)"
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
ref_editor = TextEditor(
|
ref_editor = TextEditor(
|
||||||
@ -263,7 +262,7 @@ class UnitTestsWorkflow:
|
|||||||
|
|
||||||
lines.append(_i("\nTest cases:"))
|
lines.append(_i("\nTest cases:"))
|
||||||
width = len(str(len(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:
|
if not valid_files:
|
||||||
lines.append(
|
lines.append(
|
||||||
@ -276,7 +275,7 @@ class UnitTestsWorkflow:
|
|||||||
lines.append(_i("\nWill use the following reference files to generate tests."))
|
lines.append(_i("\nWill use the following reference files to generate tests."))
|
||||||
# lines.append(_i("\nValid reference files:"))
|
# lines.append(_i("\nValid reference files:"))
|
||||||
width = len(str(len(valid_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:
|
# if invalid_files:
|
||||||
# lines.append(_i("\nInvalid files:"))
|
# lines.append(_i("\nInvalid files:"))
|
||||||
@ -294,7 +293,7 @@ class UnitTestsWorkflow:
|
|||||||
width = len(str(len(contexts)))
|
width = len(str(len(contexts)))
|
||||||
lines.extend(
|
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)
|
for i, c in enumerate(contexts)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user