__slots__

This commit is contained in:
2018-10-13 08:13:32 -04:00
parent 51dab27374
commit 2acec68649
+22 -1
View File
@@ -18,7 +18,6 @@ from .status_codes import HTTP_200
class QueryDict(dict):
def __init__(self, query_string):
query_string = query_string
self.update(parse_qs(query_string))
def __getitem__(self, key):
@@ -87,6 +86,17 @@ class QueryDict(dict):
# TODO: add slots
class Request:
__slots__ = [
"_starlette",
"formats",
"headers",
"mimetype",
"method",
"full_url",
"url",
"params",
]
def __init__(self, scope, receive):
self._starlette = StarletteRequest(scope, receive)
self.formats = None
@@ -152,6 +162,17 @@ class Request:
class Response:
__slots__ = [
"req",
"status_code",
"text",
"content",
"encoding",
"media",
"headers",
"formats",
]
def __init__(self, req, *, formats):
self.req = req
self.status_code = HTTP_200 #: The HTTP Status Code to use for the Response.