Fix imports and isort to remove from Makefile deprecated options (#1891)

* Version

* Version 20.6.1

* Fix imports and isort to remove from Makefile deprecated options

* duplicate the mypy ignore hint across both lines

after splitting the `from trio import ...` statement onto two lines, need to duplicate the mypy ignore hint across both lines to keep mypy from complaining

Co-authored-by: Ashley Sommer <ashleysommer@gmail.com>
This commit is contained in:
Adam Hopkins 2020-07-07 16:13:03 +03:00 committed by GitHub
parent 71a08382d6
commit 26aa6d23c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 10 deletions

View File

@ -71,7 +71,7 @@ black:
black --config ./.black.toml sanic tests
fix-import: black
isort -rc sanic tests
isort sanic tests
docs-clean:

View File

@ -14,7 +14,8 @@ class Header(CIMultiDict):
use_trio = argv[0].endswith("hypercorn") and "trio" in argv
if use_trio:
from trio import open_file as open_async, Path # type: ignore
from trio import Path # type: ignore
from trio import open_file as open_async # type: ignore
def stat_async(path):
return Path(path).stat()

View File

@ -14,10 +14,10 @@ from sanic.helpers import has_message_body, remove_entity_headers
try:
from ujson import dumps as json_dumps
except ImportError:
from json import dumps
# This is done in order to ensure that the JSON response is
# kept consistent across both ujson and inbuilt json usage.
from json import dumps
json_dumps = partial(dumps, separators=(",", ":"))

View File

@ -5,7 +5,7 @@ import signal
import sys
import traceback
import gunicorn.workers.base as base # type: ignore
from gunicorn.workers import base as base # type: ignore
from sanic.server import HttpProtocol, Signal, serve, trigger_events
from sanic.websocket import WebSocketProtocol

View File

@ -1,7 +1,6 @@
# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker simple_server:main
""" Minimal helloworld application.
"""
import ujson
from wheezy.http import HTTPResponse, WSGIApplication
@ -39,6 +38,7 @@ main = WSGIApplication(
if __name__ == "__main__":
import sys
from wsgiref.simple_server import make_server
try:

View File

@ -1955,10 +1955,7 @@ 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") == f"http://my-server/foo"
app.config.SERVER_NAME = "https://my-server/path"
request, response = app.test_client.get("/foo")