From 967bbd184906d12fd03a9ece9033c7aed4fc7989 Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 00:31:40 +0100 Subject: [PATCH 1/7] Adding nitpick option -n to make docs --- docs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index d4bb2cbb..747126b3 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -3,7 +3,7 @@ # You can set these variables from the command line, and also # from the environment for the first two. -SPHINXOPTS ?= +SPHINXOPTS ?= -n SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build From 1f8bc4b93bcd654139fbdbf970a7a03f8f0a4cba Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 00:39:10 +0100 Subject: [PATCH 2/7] Adding intersphinx_mapping configuration --- docs/conf.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index db6e7c5f..c537ce94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -34,6 +34,7 @@ extensions = [ 'sphinxarg.ext', 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', 'sphinx_rtd_theme' ] @@ -77,3 +78,14 @@ 'show-inheritance': True } autosummary_generate = True + +# -- Intersphinx configuration --------------------------------------------- +intersphinx_mapping = { + 'aiohttp': ('https://docs.aiohttp.org/en/stable/', None), + 'graphql': ('https://graphql-core-3.readthedocs.io/en/latest/', None), + 'multidict': ('https://multidict.readthedocs.io/en/stable/', None), + 'python': ('https://docs.python.org/3/', None), + 'requests': ('https://requests.readthedocs.io/en/latest/', None), + 'websockets': ('https://websockets.readthedocs.io/en/11.0.3/', None), + 'yarl': ('https://yarl.readthedocs.io/en/stable/', None), +} From 8ed49cd97d229fe1019d77e0bde1bc728667b56b Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 00:42:15 +0100 Subject: [PATCH 3/7] Replace GraphQLError to graphql.error.GraphQLError --- gql/dsl.py | 2 +- gql/gql.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gql/dsl.py b/gql/dsl.py index 536a8b8b..be2b5a7e 100644 --- a/gql/dsl.py +++ b/gql/dsl.py @@ -347,7 +347,7 @@ def select( :type \**fields_with_alias: DSLSelectable :raises TypeError: if an argument is not an instance of :class:`DSLSelectable` - :raises GraphQLError: if an argument is not a valid field + :raises graphql.error.GraphQLError: if an argument is not a valid field """ # Concatenate fields without and with alias added_fields: Tuple["DSLSelectable", ...] = DSLField.get_aliased_fields( diff --git a/gql/gql.py b/gql/gql.py index e35c8045..e9705947 100644 --- a/gql/gql.py +++ b/gql/gql.py @@ -13,7 +13,7 @@ def gql(request_string: str | Source) -> DocumentNode: :class:`async session ` or by a :class:`sync session ` - :raises GraphQLError: if a syntax error is encountered. + :raises graphql.error.GraphQLError: if a syntax error is encountered. """ if isinstance(request_string, Source): source = request_string From f7b2ecb7a08d6f74656e90b240a6a11d57611b56 Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 01:05:13 +0100 Subject: [PATCH 4/7] Replace Request by requests.Session.request --- gql/transport/requests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gql/transport/requests.py b/gql/transport/requests.py index fd9759ed..9d2718e0 100644 --- a/gql/transport/requests.py +++ b/gql/transport/requests.py @@ -54,9 +54,9 @@ def __init__( """Initialize the transport with the given request parameters. :param url: The GraphQL server URL. - :param headers: Dictionary of HTTP Headers to send with the :class:`Request` + :param headers: Dictionary of HTTP Headers to send with :meth:`requests.Session.request` (Default: None). - :param cookies: Dict or CookieJar object to send with the :class:`Request` + :param cookies: Dict or CookieJar object to send with :meth:`requests.Session.request` (Default: None). :param auth: Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth (Default: None). From 5fe3f58915496a578b36264da0a08278469642a7 Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 01:16:58 +0100 Subject: [PATCH 5/7] Fix appsync_auth.py references --- gql/transport/appsync_auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gql/transport/appsync_auth.py b/gql/transport/appsync_auth.py index 5ce93d4e..f2c34e62 100644 --- a/gql/transport/appsync_auth.py +++ b/gql/transport/appsync_auth.py @@ -18,7 +18,7 @@ class AppSyncAuthentication(ABC): """AWS authentication abstract base class All AWS authentication class should have a - :meth:`get_headers ` + :meth:`get_headers ` method which defines the headers used in the authentication process.""" def get_auth_url(self, url: str) -> str: @@ -91,7 +91,7 @@ class AppSyncIAMAuthentication(AppSyncAuthentication): .. note:: There is no need for you to use this class directly, you could instead - intantiate the :class:`gql.transport.appsync.AppSyncWebsocketsTransport` + intantiate the :class:`gql.transport.appsync_websockets.AppSyncWebsocketsTransport` without an auth argument. During initialization, this class will use botocore to attempt to From d7329c44f76c173eb8a4b6f053821ba9cfcbc878 Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 01:44:57 +0100 Subject: [PATCH 6/7] Adding nitpick_ignore for currently unfixable references --- docs/conf.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index c537ce94..94daf942 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -89,3 +89,41 @@ 'websockets': ('https://websockets.readthedocs.io/en/11.0.3/', None), 'yarl': ('https://yarl.readthedocs.io/en/stable/', None), } + +nitpick_ignore = [ + # graphql-core: should be fixed + ('py:class', 'graphql.execution.execute.ExecutionResult'), + ('py:class', 'Source'), + ('py:class', 'GraphQLSchema'), + + # asyncio: should be fixed + ('py:class', 'asyncio.locks.Event'), + + # aiohttp: should be fixed + ('py:class', 'aiohttp.client_reqrep.Fingerprint'), + ('py:class', 'aiohttp.helpers.BasicAuth'), + + # multidict: should be fixed + ('py:class', 'multidict._multidict.CIMultiDictProxy'), + ('py:class', 'multidict._multidict.CIMultiDict'), + ('py:class', 'multidict._multidict.istr'), + + # websockets: first bump websockets version + ('py:class', 'websockets.datastructures.SupportsKeysAndGetItem'), + ('py:class', 'websockets.typing.Subprotocol'), + + # httpx: no sphinx docs yet https://github.com/encode/httpx/discussions/3091 + ('py:class', 'httpx.AsyncClient'), + ('py:class', 'httpx.Client'), + ('py:class', 'httpx.Headers'), + + # botocore: no sphinx docs + ('py:class', 'botocore.auth.BaseSigner'), + ('py:class', 'botocore.awsrequest.AWSRequest'), + ('py:class', 'botocore.credentials.Credentials'), + ('py:class', 'botocore.session.Session'), + + # gql: ignore private classes + ('py:class', 'gql.transport.httpx._HTTPXTransport'), + ('py:class', 'gql.client._CallableT'), +] From a78ece9d9835a9187b3560fc602586fa603954fe Mon Sep 17 00:00:00 2001 From: Leszek Hanusz Date: Thu, 12 Dec 2024 01:49:50 +0100 Subject: [PATCH 7/7] Fix lint with 'make check' --- docs/code_examples/fastapi_async.py | 1 + gql/transport/appsync_auth.py | 2 +- gql/transport/requests.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/code_examples/fastapi_async.py b/docs/code_examples/fastapi_async.py index 80920252..3bedd187 100644 --- a/docs/code_examples/fastapi_async.py +++ b/docs/code_examples/fastapi_async.py @@ -10,6 +10,7 @@ from fastapi import FastAPI, HTTPException from fastapi.responses import HTMLResponse + from gql import Client, gql from gql.transport.aiohttp import AIOHTTPTransport diff --git a/gql/transport/appsync_auth.py b/gql/transport/appsync_auth.py index f2c34e62..1eb51b4e 100644 --- a/gql/transport/appsync_auth.py +++ b/gql/transport/appsync_auth.py @@ -91,7 +91,7 @@ class AppSyncIAMAuthentication(AppSyncAuthentication): .. note:: There is no need for you to use this class directly, you could instead - intantiate the :class:`gql.transport.appsync_websockets.AppSyncWebsocketsTransport` + intantiate :class:`gql.transport.appsync_websockets.AppSyncWebsocketsTransport` without an auth argument. During initialization, this class will use botocore to attempt to diff --git a/gql/transport/requests.py b/gql/transport/requests.py index 9d2718e0..bd370908 100644 --- a/gql/transport/requests.py +++ b/gql/transport/requests.py @@ -54,10 +54,10 @@ def __init__( """Initialize the transport with the given request parameters. :param url: The GraphQL server URL. - :param headers: Dictionary of HTTP Headers to send with :meth:`requests.Session.request` - (Default: None). - :param cookies: Dict or CookieJar object to send with :meth:`requests.Session.request` - (Default: None). + :param headers: Dictionary of HTTP Headers to send with + :meth:`requests.Session.request` (Default: None). + :param cookies: Dict or CookieJar object to send with + :meth:`requests.Session.request` (Default: None). :param auth: Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth (Default: None). :param use_json: Send request body as JSON instead of form-urlencoded