Migrate linter from pylint to ruff (#1665)

This commit is contained in:
Simon Mo
2023-11-20 11:58:01 -08:00
committed by GitHub
parent 112627e8b2
commit 5ffc0d13a2
45 changed files with 122 additions and 607 deletions
+3 -5
View File
@@ -55,7 +55,7 @@ def create_error_response(status_code: HTTPStatus,
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc): # pylint: disable=unused-argument
async def validation_exception_handler(_, exc):
return create_error_response(HTTPStatus.BAD_REQUEST, str(exc))
@@ -124,10 +124,8 @@ async def check_length(
assert (not (prompt is None and prompt_ids is None)
and not (prompt is not None and prompt_ids is not None)
), "Either prompt or prompt_ids should be provided."
if prompt_ids is not None:
input_ids = prompt_ids
else:
input_ids = tokenizer(prompt).input_ids
input_ids = prompt_ids if prompt_ids is not None else tokenizer(
prompt).input_ids
token_num = len(input_ids)
if request.max_tokens is None: