ruff --fix
This commit is contained in:
parent
20fd58b8d7
commit
209840b771
|
@ -2,7 +2,7 @@
|
|||
import bottle
|
||||
import ujson
|
||||
|
||||
from bottle import route, run
|
||||
from bottle import route
|
||||
|
||||
|
||||
@route("/")
|
||||
|
|
|
@ -3,7 +3,6 @@ import os
|
|||
import sys
|
||||
import timeit
|
||||
|
||||
import asyncpg
|
||||
|
||||
from sanic.response import json
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import ujson
|
||||
|
||||
from wheezy.http import HTTPResponse, WSGIApplication
|
||||
from wheezy.http.response import json_response
|
||||
from wheezy.routing import url
|
||||
from wheezy.web.handlers import BaseHandler
|
||||
from wheezy.web.middleware import (
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
from collections import deque, namedtuple
|
||||
|
@ -12,7 +11,7 @@ from pytest import MonkeyPatch
|
|||
|
||||
from sanic import Sanic
|
||||
from sanic.application.state import Mode
|
||||
from sanic.asgi import ASGIApp, Lifespan, MockTransport
|
||||
from sanic.asgi import Lifespan, MockTransport
|
||||
from sanic.exceptions import BadRequest, Forbidden, ServiceUnavailable
|
||||
from sanic.request import Request
|
||||
from sanic.response import json, text
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import asyncio
|
||||
|
||||
from asyncio import CancelledError
|
||||
|
||||
import pytest
|
||||
|
||||
from sanic import Request, Sanic, json
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from unittest.mock import Mock
|
|||
import pytest
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from pytest import LogCaptureFixture, MonkeyPatch, WarningsRecorder
|
||||
from pytest import LogCaptureFixture, MonkeyPatch
|
||||
|
||||
from sanic import Sanic, handlers
|
||||
from sanic.exceptions import BadRequest, Forbidden, NotFound, ServerError
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import sys
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ from sanic_testing.testing import HOST, PORT
|
|||
from sanic import Blueprint, text
|
||||
from sanic.compat import use_context
|
||||
from sanic.log import logger
|
||||
from sanic.server.socket import configure_socket
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
|
|
|
@ -573,7 +573,7 @@ def test_streaming_echo():
|
|||
|
||||
async def client(app, reader, writer):
|
||||
# Unfortunately httpx does not support 2-way streaming, so do it by hand.
|
||||
host = f"host: localhost:8000\r\n".encode()
|
||||
host = "host: localhost:8000\r\n".encode()
|
||||
writer.write(
|
||||
b"POST /echo HTTP/1.1\r\n" + host + b"content-length: 2\r\n"
|
||||
b"content-type: text/plain; charset=utf-8\r\n"
|
||||
|
@ -581,7 +581,7 @@ def test_streaming_echo():
|
|||
)
|
||||
# Read response
|
||||
res = b""
|
||||
while not b"\r\n\r\n" in res:
|
||||
while b"\r\n\r\n" not in res:
|
||||
res += await reader.read(4096)
|
||||
assert res.startswith(b"HTTP/1.1 200 OK\r\n")
|
||||
assert res.endswith(b"\r\n\r\n")
|
||||
|
@ -589,7 +589,7 @@ def test_streaming_echo():
|
|||
|
||||
async def read_chunk():
|
||||
nonlocal buffer
|
||||
while not b"\r\n" in buffer:
|
||||
while b"\r\n" not in buffer:
|
||||
data = await reader.read(4096)
|
||||
assert data
|
||||
buffer += data
|
||||
|
|
|
@ -2011,11 +2011,11 @@ def test_server_name_and_url_for(app):
|
|||
app.config.SERVER_NAME = "my-server" # This means default port
|
||||
assert app.url_for("handler", _external=True) == "http://my-server/foo"
|
||||
request, response = app.test_client.get("/foo")
|
||||
assert request.url_for("handler") == f"http://my-server/foo"
|
||||
assert request.url_for("handler") == "http://my-server/foo"
|
||||
|
||||
app.config.SERVER_NAME = "https://my-server/path"
|
||||
request, response = app.test_client.get("/foo")
|
||||
url = f"https://my-server/path/foo"
|
||||
url = "https://my-server/path/foo"
|
||||
assert app.url_for("handler", _external=True) == url
|
||||
assert request.url_for("handler") == url
|
||||
|
||||
|
|
|
@ -769,7 +769,7 @@ def test_file_response_headers(
|
|||
assert (
|
||||
"cache-control" in headers
|
||||
and f"max-age={test_max_age}" in headers.get("cache-control")
|
||||
and f"public" in headers.get("cache-control")
|
||||
and "public" in headers.get("cache-control")
|
||||
)
|
||||
assert (
|
||||
"expires" in headers
|
||||
|
@ -800,14 +800,14 @@ def test_file_response_headers(
|
|||
|
||||
_, response = app.test_client.get(f"/files/no_cache/{file_name}")
|
||||
headers = response.headers
|
||||
assert "cache-control" in headers and f"no-cache" == headers.get(
|
||||
assert "cache-control" in headers and "no-cache" == headers.get(
|
||||
"cache-control"
|
||||
)
|
||||
assert response.status == 200
|
||||
|
||||
_, response = app.test_client.get(f"/files/no_store/{file_name}")
|
||||
headers = response.headers
|
||||
assert "cache-control" in headers and f"no-store" == headers.get(
|
||||
assert "cache-control" in headers and "no-store" == headers.get(
|
||||
"cache-control"
|
||||
)
|
||||
assert response.status == 200
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# flake8: noqa: E501
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
|
|
Loading…
Reference in New Issue
Block a user