Skip to content

Commit 93584c9

Browse files
authored
Remove unneeded type ignores and asserts in base views (#3935)
* Replace unneeded type ignores * Remove unneded runtime assertions
1 parent 46457b8 commit 93584c9

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

strawberry/http/async_base_view.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ async def execute_operation(
198198
if not self.allow_queries_via_get and request_adapter.method == "GET":
199199
allowed_operation_types = allowed_operation_types - {OperationType.QUERY}
200200

201-
assert self.schema
202-
203201
if request_data.protocol == "multipart-subscription":
204202
return await self.schema.subscribe(
205203
request_data.query, # type: ignore
@@ -291,7 +289,7 @@ async def run(
291289
view=self,
292290
websocket=websocket,
293291
context=context,
294-
root_value=root_value, # type: ignore
292+
root_value=root_value,
295293
schema=self.schema,
296294
debug=self.debug,
297295
connection_init_wait_timeout=self.connection_init_wait_timeout,
@@ -301,7 +299,7 @@ async def run(
301299
view=self,
302300
websocket=websocket,
303301
context=context,
304-
root_value=root_value, # type: ignore
302+
root_value=root_value,
305303
schema=self.schema,
306304
debug=self.debug,
307305
keep_alive=self.keep_alive,

strawberry/http/sync_base_view.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ def execute_operation(
116116
if not self.allow_queries_via_get and request_adapter.method == "GET":
117117
allowed_operation_types = allowed_operation_types - {OperationType.QUERY}
118118

119-
assert self.schema
120-
121119
return self.schema.execute_sync(
122120
request_data.query,
123121
root_value=root_value,

strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353
view: AsyncBaseHTTPView[Any, Any, Any, Any, Any, Context, RootValue],
5454
websocket: AsyncWebSocketAdapter,
5555
context: Context,
56-
root_value: RootValue,
56+
root_value: Optional[RootValue],
5757
schema: BaseSchema,
5858
debug: bool,
5959
connection_init_wait_timeout: timedelta,

strawberry/subscriptions/protocols/graphql_ws/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
view: AsyncBaseHTTPView[Any, Any, Any, Any, Any, Context, RootValue],
4343
websocket: AsyncWebSocketAdapter,
4444
context: Context,
45-
root_value: RootValue,
45+
root_value: Optional[RootValue],
4646
schema: BaseSchema,
4747
debug: bool,
4848
keep_alive: bool,

0 commit comments

Comments
 (0)