Clean Up Black and Isort Config (#2449)

Co-authored-by: Adam Hopkins <adam@amhopkins.com>
This commit is contained in:
Zhiwei 2022-05-26 04:48:32 -05:00 committed by GitHub
parent c249004c30
commit 49789b7841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 32 deletions

View File

@ -1,2 +0,0 @@
[tool.black]
line-length = 79

View File

@ -66,15 +66,15 @@ ifdef include_tests
isort -rc sanic tests isort -rc sanic tests
else else
$(info Sorting Imports) $(info Sorting Imports)
isort -rc sanic tests --profile=black isort -rc sanic tests
endif endif
endif endif
black: black:
black --config ./.black.toml sanic tests black sanic tests
isort: isort:
isort sanic tests --profile=black isort sanic tests
pretty: black isort pretty: black isort

View File

@ -1,3 +1,18 @@
[build-system] [build-system]
requires = ["setuptools<60.0", "wheel"] requires = ["setuptools<60.0", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.black]
line-length = 79
[tool.isort]
atomic = true
default_section = "THIRDPARTY"
include_trailing_comma = true
known_first_party = "sanic"
known_third_party = "pytest"
line_length = 79
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3
profile = "black"

View File

@ -1,13 +1,2 @@
[flake8] [flake8]
ignore = E203, W503 ignore = E203, W503
[isort]
atomic = true
default_section = THIRDPARTY
include_trailing_comma = true
known_first_party = sanic
known_third_party = pytest
line_length = 79
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3

View File

@ -9,7 +9,7 @@ import uvicorn
from sanic import Sanic from sanic import Sanic
from sanic.application.state import Mode from sanic.application.state import Mode
from sanic.asgi import MockTransport from sanic.asgi import MockTransport
from sanic.exceptions import Forbidden, BadRequest, ServiceUnavailable from sanic.exceptions import BadRequest, Forbidden, ServiceUnavailable
from sanic.request import Request from sanic.request import Request
from sanic.response import json, text from sanic.response import json, text
from sanic.server.websockets.connection import WebSocketConnection from sanic.server.websockets.connection import WebSocketConnection

View File

@ -3,12 +3,7 @@ from pytest import raises
from sanic.app import Sanic from sanic.app import Sanic
from sanic.blueprint_group import BlueprintGroup from sanic.blueprint_group import BlueprintGroup
from sanic.blueprints import Blueprint from sanic.blueprints import Blueprint
from sanic.exceptions import ( from sanic.exceptions import BadRequest, Forbidden, SanicException, ServerError
Forbidden,
BadRequest,
SanicException,
ServerError,
)
from sanic.request import Request from sanic.request import Request
from sanic.response import HTTPResponse, text from sanic.response import HTTPResponse, text

View File

@ -7,12 +7,7 @@ import pytest
from sanic.app import Sanic from sanic.app import Sanic
from sanic.blueprints import Blueprint from sanic.blueprints import Blueprint
from sanic.constants import HTTP_METHODS from sanic.constants import HTTP_METHODS
from sanic.exceptions import ( from sanic.exceptions import BadRequest, NotFound, SanicException, ServerError
BadRequest,
NotFound,
SanicException,
ServerError,
)
from sanic.request import Request from sanic.request import Request
from sanic.response import json, text from sanic.response import json, text

View File

@ -10,7 +10,7 @@ from bs4 import BeautifulSoup
from pytest import LogCaptureFixture, MonkeyPatch from pytest import LogCaptureFixture, MonkeyPatch
from sanic import Sanic, handlers from sanic import Sanic, handlers
from sanic.exceptions import Forbidden, BadRequest, NotFound, ServerError from sanic.exceptions import BadRequest, Forbidden, NotFound, ServerError
from sanic.handlers import ErrorHandler from sanic.handlers import ErrorHandler
from sanic.request import Request from sanic.request import Request
from sanic.response import stream, text from sanic.response import stream, text

View File

@ -19,8 +19,8 @@ commands =
[testenv:lint] [testenv:lint]
commands = commands =
flake8 sanic flake8 sanic
black --config ./.black.toml --check --verbose sanic/ black --check --verbose sanic/
isort --check-only sanic --profile=black isort --check-only sanic
slotscheck --verbose -m sanic slotscheck --verbose -m sanic
[testenv:type-checking] [testenv:type-checking]