From 4333b847e20574e344a7fecb103a4c125051b72e Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 7 Jul 2025 11:02:35 +0200 Subject: [PATCH] Fix typos and improve documentation --- docs/aiohttp.md | 2 +- docs/flask.md | 2 +- docs/sanic.md | 2 +- docs/webob.md | 2 +- src/graphql_server/channels/handlers/base.py | 6 +++--- src/graphql_server/http/sync_base_view.py | 2 +- .../protocols/graphql_transport_ws/handlers.py | 4 ++-- src/tests/http/test_graphql_over_http_spec.py | 4 ++-- src/tests/websockets/test_graphql_transport_ws.py | 6 +++--- src/tests/websockets/test_graphql_ws.py | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/aiohttp.md b/docs/aiohttp.md index b301855..ed64147 100644 --- a/docs/aiohttp.md +++ b/docs/aiohttp.md @@ -4,7 +4,7 @@ Adds GraphQL support to your aiohttp application. ## Installation -To install the integration with aiohttp, run the below command on your terminal. +To install the integration with aiohttp, run the following command in your terminal. `pip install graphql-server[aiohttp]` diff --git a/docs/flask.md b/docs/flask.md index dfe0aa7..af0297e 100644 --- a/docs/flask.md +++ b/docs/flask.md @@ -4,7 +4,7 @@ Adds GraphQL support to your Flask application. ## Installation -To install the integration with Flask, run the below command on your terminal. +To install the integration with Flask, run the following command in your terminal. `pip install graphql-server[flask]` diff --git a/docs/sanic.md b/docs/sanic.md index 102e38d..f319f52 100644 --- a/docs/sanic.md +++ b/docs/sanic.md @@ -4,7 +4,7 @@ Adds GraphQL support to your Sanic application. ## Installation -To install the integration with Sanic, run the below command on your terminal. +To install the integration with Sanic, run the following command in your terminal. `pip install graphql-server[sanic]` diff --git a/docs/webob.md b/docs/webob.md index 2f88a31..9c285f4 100644 --- a/docs/webob.md +++ b/docs/webob.md @@ -4,7 +4,7 @@ Adds GraphQL support to your WebOb (Pyramid, Pylons, ...) application. ## Installation -To install the integration with WebOb, run the below command on your terminal. +To install the integration with WebOb, run the following command in your terminal. `pip install graphql-server[webob]` diff --git a/src/graphql_server/channels/handlers/base.py b/src/graphql_server/channels/handlers/base.py index d4d8774..ec749ce 100644 --- a/src/graphql_server/channels/handlers/base.py +++ b/src/graphql_server/channels/handlers/base.py @@ -96,7 +96,7 @@ async def channel_listen( groups: An optional sequence of groups to receive messages from. When passing this parameter, the groups will be registered - using `self.channel_layer.group_add` at the beggining of the + using `self.channel_layer.group_add` at the beginning of the execution and then discarded using `self.channel_layer.group_discard` at the end of the execution. """ @@ -155,7 +155,7 @@ async def listen_to_channel( groups: An optional sequence of groups to receive messages from. When passing this parameter, the groups will be registered - using `self.channel_layer.group_add` at the beggining of the + using `self.channel_layer.group_add` at the beginning of the execution and then discarded using `self.channel_layer.group_discard` at the end of the execution. """ @@ -192,7 +192,7 @@ async def _listen_to_channel_generator( ) -> AsyncGenerator[Any, None]: """Generator for listen_to_channel method. - Seperated to allow user code to be run after subscribing to channels + Separated to allow user code to be run after subscribing to channels and before blocking to wait for incoming channel messages. """ while True: diff --git a/src/graphql_server/http/sync_base_view.py b/src/graphql_server/http/sync_base_view.py index 3b0b0d7..bee1c75 100644 --- a/src/graphql_server/http/sync_base_view.py +++ b/src/graphql_server/http/sync_base_view.py @@ -170,7 +170,7 @@ def parse_http_body( data = self.parse_multipart(request) elif self._is_multipart_subscriptions(content_type, params): raise HTTPException( - 400, "Multipart subcriptions are not supported in sync mode" + 400, "Multipart subscriptions are not supported in sync mode" ) else: raise HTTPException(400, "Unsupported content type") diff --git a/src/graphql_server/subscriptions/protocols/graphql_transport_ws/handlers.py b/src/graphql_server/subscriptions/protocols/graphql_transport_ws/handlers.py index b790d1e..481da12 100644 --- a/src/graphql_server/subscriptions/protocols/graphql_transport_ws/handlers.py +++ b/src/graphql_server/subscriptions/protocols/graphql_transport_ws/handlers.py @@ -162,7 +162,7 @@ async def handle_message(self, message: Message) -> None: async def handle_connection_init(self, message: ConnectionInitMessage) -> None: if self.connection_timed_out: - # No way to reliably excercise this case during testing + # No way to reliably exercise this case during testing return # pragma: no cover if self.connection_init_timeout_task: @@ -343,7 +343,7 @@ async def run_operation(self, operation: Operation[Context, RootValue]) -> None: def forget_id(self, id: str) -> None: # de-register the operation id making it immediately available - # for re-use + # for reuse del self.operations[id] async def handle_complete(self, message: CompleteMessage) -> None: diff --git a/src/tests/http/test_graphql_over_http_spec.py b/src/tests/http/test_graphql_over_http_spec.py index 1ce50ef..e2c76c4 100644 --- a/src/tests/http/test_graphql_over_http_spec.py +++ b/src/tests/http/test_graphql_over_http_spec.py @@ -179,7 +179,7 @@ async def test_423l(http_client): @pytest.mark.parametrize( "invalid", - [{"obj": "ect"}, 0, False, ["array"]], + [{"obj": "etc"}, 0, False, ["array"]], ids=["LKJ0", "LKJ1", "LKJ2", "LKJ3"], ) async def test_lkj_(http_client, invalid): @@ -222,7 +222,7 @@ async def test_13ee(http_client): @pytest.mark.parametrize( "invalid", - [{"obj": "ect"}, 0, False, ["array"]], + [{"obj": "etc"}, 0, False, ["array"]], ids=["6C00", "6C01", "6C02", "6C03"], ) async def test_6c0_(http_client, invalid): diff --git a/src/tests/websockets/test_graphql_transport_ws.py b/src/tests/websockets/test_graphql_transport_ws.py index dbfaa3b..4bf9816 100644 --- a/src/tests/websockets/test_graphql_transport_ws.py +++ b/src/tests/websockets/test_graphql_transport_ws.py @@ -422,8 +422,8 @@ async def test_duplicated_operation_ids(ws: WebSocketClient): async def test_reused_operation_ids(ws: WebSocketClient): - """Test that an operation id can be re-used after it has been - previously used for a completed operation. + """Test that an operation id can be reused after it has been + previously used for a completed operation. """ # Use sub1 as an id for an operation await ws.send_message( @@ -1126,7 +1126,7 @@ def on_init(_handler): assert connection_ack_message == {"type": "connection_ack"} await ws.close() - # the error hander should have been called + # the error handler should have been called assert handler errorhandler.assert_called_once() args = errorhandler.call_args diff --git a/src/tests/websockets/test_graphql_ws.py b/src/tests/websockets/test_graphql_ws.py index 4ae4438..3a939f2 100644 --- a/src/tests/websockets/test_graphql_ws.py +++ b/src/tests/websockets/test_graphql_ws.py @@ -311,8 +311,8 @@ async def test_sends_keep_alive(http_client_class: type[HttpClient]): ack_message: ConnectionAckMessage = await ws.receive_json() assert ack_message["type"] == "connection_ack" - # we can't be sure how many keep-alives exactly we - # get but they should be more than one. + # We can't be sure how many keep-alive messages exactly we + # get, but there should be more than one. keepalive_count = 0 while True: ka_or_data_message: Union[