remove overlapping slots from app.Sanic, fix broken slots inherit of HTTPResponse (#2387)
This commit is contained in:
parent
d4fb44e986
commit
7523e87937
|
@ -140,6 +140,7 @@ To maintain the code consistency, Sanic uses following tools.
|
|||
#. `isort <https://github.com/timothycrosley/isort>`_
|
||||
#. `black <https://github.com/python/black>`_
|
||||
#. `flake8 <https://github.com/PyCQA/flake8>`_
|
||||
#. `slotscheck <https://github.com/ariebovenberg/slotscheck>`_
|
||||
|
||||
isort
|
||||
*****
|
||||
|
@ -167,7 +168,13 @@ flake8
|
|||
#. pycodestyle
|
||||
#. Ned Batchelder's McCabe script
|
||||
|
||||
``isort``\ , ``black`` and ``flake8`` checks are performed during ``tox`` lint checks.
|
||||
slotscheck
|
||||
**********
|
||||
|
||||
``slotscheck`` ensures that there are no problems with ``__slots__``
|
||||
(e.g. overlaps, or missing slots in base classes).
|
||||
|
||||
``isort``\ , ``black``\ , ``flake8`` and ``slotscheck`` checks are performed during ``tox`` lint checks.
|
||||
|
||||
The **easiest** way to make your code conform is to run the following before committing.
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ class Sanic(BaseSanic, RunnerMixin, metaclass=TouchUpMeta):
|
|||
"error_handler",
|
||||
"go_fast",
|
||||
"listeners",
|
||||
"name",
|
||||
"named_request_middleware",
|
||||
"named_response_middleware",
|
||||
"request_class",
|
||||
|
|
|
@ -50,6 +50,16 @@ class BaseHTTPResponse:
|
|||
The base class for all HTTP Responses
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
"asgi",
|
||||
"body",
|
||||
"content_type",
|
||||
"stream",
|
||||
"status",
|
||||
"headers",
|
||||
"_cookies",
|
||||
)
|
||||
|
||||
_dumps = json_dumps
|
||||
|
||||
def __init__(self):
|
||||
|
@ -156,7 +166,7 @@ class HTTPResponse(BaseHTTPResponse):
|
|||
:type content_type: Optional[str]
|
||||
"""
|
||||
|
||||
__slots__ = ("body", "status", "content_type", "headers", "_cookies")
|
||||
__slots__ = ()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
1
setup.py
1
setup.py
|
@ -112,6 +112,7 @@ tests_require = [
|
|||
"docutils",
|
||||
"pygments",
|
||||
"uvicorn<0.15.0",
|
||||
"slotscheck>=0.8.0,<1",
|
||||
types_ujson,
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user