From 1f50f43ee32a8ea079d9874b80183c9919c9de95 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Thu, 8 Apr 2021 15:40:51 +0200 Subject: [PATCH] Docs: some language cleanup Replicates graphql/graphql-js@11505d72b4332f936f2feea1742bc05441e692cf --- README.md | 16 ++++++++-------- docs/intro.rst | 4 ++-- src/graphql/language/source.py | 3 +-- src/graphql/language/visitor.py | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fff29d6f..96c1c0f8 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ examples. ## Getting started -An overview of GraphQL in general is available in the +A general overview of GraphQL is available in the [README](https://github.com/graphql/graphql-spec/blob/main/README.md) for the [Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview describes a simple set of GraphQL examples that exist as [tests](tests) in this @@ -46,20 +46,20 @@ README and the corresponding tests in parallel. GraphQL-core 3 can be installed from PyPI using the built-in pip command: - python -m pip install "graphql-core>=3" + python -m pip install graphql-core -Alternatively, you can also use [pipenv](https://docs.pipenv.org/) for installation in a +You can also use [pipenv](https://docs.pipenv.org/) for installation in a virtual environment: - pipenv install "graphql-core>=3" + pipenv install graphql-core ## Usage -GraphQL-core provides two important capabilities: building a type schema, and +GraphQL-core provides two important capabilities: building a type schema and serving queries against that type schema. -First, build a GraphQL type schema which maps to your code base: +First, build a GraphQL type schema which maps to your codebase: ```python from graphql import ( @@ -75,7 +75,7 @@ schema = GraphQLSchema( })) ``` -This defines a simple schema with one type and one field, that resolves to a fixed +This defines a simple schema, with one type and one field, that resolves to a fixed value. The `resolve` function can return a value, a co-routine object or a list of these. It takes two positional arguments; the first one provides the root or the resolved parent field, the second one provides a `GraphQLResolveInfo` object which @@ -89,7 +89,7 @@ where the context is passed separately and arguments are passed as a single obje Also note that GraphQL fields must be passed as a `GraphQLField` object explicitly. Similarly, GraphQL arguments must be passed as `GraphQLArgument` objects. -A more complex example is included in the top level [tests](tests) directory. +A more complex example is included in the top-level [tests](tests) directory. Then, serve the result of a query against that type schema. diff --git a/docs/intro.rst b/docs/intro.rst index 3bd83837..2ac64258 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -31,11 +31,11 @@ Getting started You can install GraphQL-core 3 using pip_:: - pip install "graphql-core>=3" + pip install graphql-core You can also install GraphQL-core 3 with pipenv_, if you prefer that:: - pipenv install "graphql-core>=3" + pipenv install graphql-core Now you can start using GraphQL-core 3 by importing from the top-level :mod:`graphql` package. Nearly everything defined in the sub-packages diff --git a/src/graphql/language/source.py b/src/graphql/language/source.py index 1d193a4a..4f92f08b 100644 --- a/src/graphql/language/source.py +++ b/src/graphql/language/source.py @@ -19,10 +19,9 @@ def __init__( ) -> None: """Initialize source input. - ``name`` and ``location_offset`` are optional. They are useful for clients who store GraphQL documents in source files; for example, if the GraphQL input - starts at line 40 in a file named Foo.graphql, it might be useful for name + starts at line 40 in a file named Foo.graphql, it might be useful for ``name`` to be "Foo.graphql" and location to be ``(40, 0)``. line and column in location_offset are 1-indexed diff --git a/src/graphql/language/visitor.py b/src/graphql/language/visitor.py index 2378e27b..1b530560 100644 --- a/src/graphql/language/visitor.py +++ b/src/graphql/language/visitor.py @@ -221,7 +221,7 @@ def visit( ) -> Any: """Visit each node in an AST. - :func:`~.visit` will walk through an AST using a depth first traversal, calling the + :func:`~.visit` will walk through an AST using a depth-first traversal, calling the visitor's enter methods at each node in the traversal, and calling the leave methods after visiting that node and all of its child nodes.