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:
parent
71a08382d6
commit
26aa6d23c7
2
Makefile
2
Makefile
|
@ -71,7 +71,7 @@ black:
|
||||||
black --config ./.black.toml sanic tests
|
black --config ./.black.toml sanic tests
|
||||||
|
|
||||||
fix-import: black
|
fix-import: black
|
||||||
isort -rc sanic tests
|
isort sanic tests
|
||||||
|
|
||||||
|
|
||||||
docs-clean:
|
docs-clean:
|
||||||
|
|
|
@ -14,7 +14,8 @@ class Header(CIMultiDict):
|
||||||
use_trio = argv[0].endswith("hypercorn") and "trio" in argv
|
use_trio = argv[0].endswith("hypercorn") and "trio" in argv
|
||||||
|
|
||||||
if use_trio:
|
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):
|
def stat_async(path):
|
||||||
return Path(path).stat()
|
return Path(path).stat()
|
||||||
|
|
|
@ -14,10 +14,10 @@ from sanic.helpers import has_message_body, remove_entity_headers
|
||||||
try:
|
try:
|
||||||
from ujson import dumps as json_dumps
|
from ujson import dumps as json_dumps
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from json import dumps
|
|
||||||
|
|
||||||
# This is done in order to ensure that the JSON response is
|
# This is done in order to ensure that the JSON response is
|
||||||
# kept consistent across both ujson and inbuilt json usage.
|
# kept consistent across both ujson and inbuilt json usage.
|
||||||
|
from json import dumps
|
||||||
|
|
||||||
json_dumps = partial(dumps, separators=(",", ":"))
|
json_dumps = partial(dumps, separators=(",", ":"))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
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.server import HttpProtocol, Signal, serve, trigger_events
|
||||||
from sanic.websocket import WebSocketProtocol
|
from sanic.websocket import WebSocketProtocol
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker simple_server:main
|
# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker simple_server:main
|
||||||
""" Minimal helloworld application.
|
""" Minimal helloworld application.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
from wheezy.http import HTTPResponse, WSGIApplication
|
from wheezy.http import HTTPResponse, WSGIApplication
|
||||||
|
@ -39,6 +38,7 @@ main = WSGIApplication(
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from wsgiref.simple_server import make_server
|
from wsgiref.simple_server import make_server
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1955,10 +1955,7 @@ def test_server_name_and_url_for(app):
|
||||||
app.config.SERVER_NAME = "my-server" # This means default port
|
app.config.SERVER_NAME = "my-server" # This means default port
|
||||||
assert app.url_for("handler", _external=True) == "http://my-server/foo"
|
assert app.url_for("handler", _external=True) == "http://my-server/foo"
|
||||||
request, response = app.test_client.get("/foo")
|
request, response = app.test_client.get("/foo")
|
||||||
assert (
|
assert request.url_for("handler") == f"http://my-server/foo"
|
||||||
request.url_for("handler")
|
|
||||||
== f"http://my-server/foo"
|
|
||||||
)
|
|
||||||
|
|
||||||
app.config.SERVER_NAME = "https://my-server/path"
|
app.config.SERVER_NAME = "https://my-server/path"
|
||||||
request, response = app.test_client.get("/foo")
|
request, response = app.test_client.get("/foo")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user