Skip to content

Commit 79d9b5d

Browse files
authored
add spellcheck sphinx extension to docs build process (#123)
* add spellcheck sphinx extension to docs build process and kokoro
1 parent 7ed4fcd commit 79d9b5d

File tree

11 files changed

+136
-17
lines changed

11 files changed

+136
-17
lines changed

packages/google-cloud-ndb/.kokoro/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
# Need enchant for spell check
18+
sudo apt-get update
19+
sudo apt-get -y install dictionaries-common aspell aspell-en \
20+
hunspell-en-us libenchant1c2a enchant
21+
1722
set -eo pipefail
1823

1924
cd github/python-ndb

packages/google-cloud-ndb/docs/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# sys.path.insert(0, os.path.abspath('.'))
1818

1919
import google.cloud.ndb # ``ndb`` must be installed to build the docs.
20+
import sphinxcontrib.spelling.filters
2021

2122
# -- Project information -----------------------------------------------------
2223

@@ -67,6 +68,7 @@
6768
"sphinx.ext.coverage",
6869
"sphinx.ext.napoleon",
6970
"sphinx.ext.viewcode",
71+
"sphinxcontrib.spelling",
7072
]
7173

7274
# autodoc/autosummary flags
@@ -232,3 +234,7 @@
232234
napoleon_use_ivar = False
233235
napoleon_use_param = True
234236
napoleon_use_rtype = True
237+
238+
# spellcheck settings
239+
spelling_word_list_filename = "spelling_wordlist.txt"
240+
spelling_filters = [sphinxcontrib.spelling.filters.ContractionFilter]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Admin
2+
api
3+
App
4+
app
5+
Appengine
6+
appengine
7+
Args
8+
args
9+
auth
10+
backend
11+
Blobstore
12+
blobstore
13+
bool
14+
boolean
15+
builtin
16+
composable
17+
Datastore
18+
datastore
19+
deserialized
20+
Dict
21+
Django
22+
Expando
23+
expando
24+
fallback
25+
Firestore
26+
func
27+
google
28+
gRPC
29+
gql
30+
gVisor
31+
indices
32+
instantiation
33+
iter
34+
iterable
35+
lookups
36+
marshalling
37+
memcache
38+
Metaclass
39+
metaclass
40+
Metaclasses
41+
metaclasses
42+
Metadata
43+
metadata
44+
meth
45+
middleware
46+
MultiFuture
47+
multitenancy
48+
Namespace
49+
Namespaces
50+
namespace
51+
namespaces
52+
NDB
53+
ndb
54+
NoLongerImplementedError
55+
OAuth
56+
offline
57+
param
58+
polymorphism
59+
Pre
60+
pre
61+
prefetch
62+
protobuf
63+
proxied
64+
QueryOptions
65+
RequestHandler
66+
runtime
67+
schemas
68+
stackable
69+
subattribute
70+
subclassed
71+
subclasses
72+
subclassing
73+
subentities
74+
subentity
75+
subproperties
76+
subproperty
77+
superset
78+
Tasklet
79+
tasklet
80+
Tasklets
81+
tasklets
82+
timestamp
83+
Transactionally
84+
unary
85+
unicode
86+
unindexed
87+
unpickled
88+
unpickling
89+
urlsafe
90+
username
91+
UTF
92+
webapp
93+
websafe
94+
validator

packages/google-cloud-ndb/noxfile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def blacken(session):
109109
def docs(session):
110110
# Install all dependencies.
111111
session.install("Sphinx")
112+
session.install("sphinxcontrib.spelling")
112113
session.install(".")
113114
# Building the docs.
114115
run_args = ["bash", "test_utils/test_utils/scripts/update_docs.sh"]
@@ -119,6 +120,7 @@ def docs(session):
119120
def doctest(session):
120121
# Install all dependencies.
121122
session.install("Sphinx")
123+
session.install("sphinxcontrib.spelling")
122124
session.install(".")
123125
# Run the script for building docs and running doctests.
124126
run_args = [

packages/google-cloud-ndb/src/google/cloud/ndb/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def set_memcache_timeout_policy(self, policy):
320320
:class:`~google.cloud.ndb.key.Key` instance as a single
321321
positional argument and returns an ``int`` indicating the
322322
timeout, in seconds, for the key. ``0`` implies the default
323-
timout. May be :data:`None`.
323+
timeout. May be :data:`None`.
324324
"""
325325
raise NotImplementedError
326326

packages/google-cloud-ndb/src/google/cloud/ndb/key.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Key:
175175
>>> ndb.Key(kind2, id2, parent=parent)
176176
Key('Parent', 'C', 'Child', 42)
177177
178-
You can also construct a Key from a "url-safe" encoded string:
178+
You can also construct a Key from a "urlsafe" encoded string:
179179
180180
.. doctest:: key-constructor-urlsafe
181181
@@ -219,7 +219,7 @@ class Key:
219219
>>> ndb.Key(kwargs)
220220
Key('Cheese', 'Cheddar', namespace='good')
221221
222-
The "url-safe" string is really a websafe-base64-encoded serialized
222+
The "urlsafe" string is really a websafe-base64-encoded serialized
223223
``Reference``, but it's best to think of it as just an opaque unique
224224
string.
225225

packages/google-cloud-ndb/src/google/cloud/ndb/model.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Person(Model):
4545
person = Person(name='Arthur Dent', age=42)
4646
key = person.put()
4747
48-
The return value from put() is a Key (see the documentation for ndb/key.py),
48+
The return value from put() is a Key (see the documentation for ``ndb/key.py``),
4949
which can be used to retrieve the same entity later::
5050
5151
person2 = key.get()
@@ -1900,7 +1900,7 @@ def _validate_key(value, entity=None):
19001900
class ModelKey(Property):
19011901
"""Special property to store a special "key" for a :class:`Model`.
19021902
1903-
This is intended to be used as a psuedo-:class:`Property` on each
1903+
This is intended to be used as a pseudo-:class:`Property` on each
19041904
:class:`Model` subclass. It is **not** intended for other usage in
19051905
application code.
19061906
@@ -2777,7 +2777,7 @@ def user_id(self):
27772777
27782778
Returns:
27792779
Optional[str]: A permanent unique identifying string or
2780-
:data:`None`. If the email address was set explicity, this will
2780+
:data:`None`. If the email address was set explicitly, this will
27812781
return :data:`None`.
27822782
"""
27832783
return self._user_id
@@ -2935,7 +2935,7 @@ class UserProperty(Property):
29352935
This was useful for tracking which user modifies a model instance.
29362936
auto_current_user_add (bool): Deprecated flag. When supported, if this
29372937
flag was set to :data:`True`, the property value would be set to
2938-
the urrently signed-in user he first time the model instance is
2938+
the currently signed-in user he first time the model instance is
29392939
stored in the datastore, unless the property has already been
29402940
assigned a value. This was useful for tracking which user creates
29412941
a model instance, which may not be the same user that modifies it
@@ -4640,7 +4640,7 @@ def _gql(cls, query_string, *args, **kwargs):
46404640
46414641
Args:
46424642
query_string (str): The WHERE part of a GQL query (including the
4643-
WHERE kwyword).
4643+
WHERE keyword).
46444644
args: if present, used to call bind() on the query.
46454645
kwargs: if present, used to call bind() on the query.
46464646
@@ -4964,7 +4964,7 @@ def _allocate_ids_async(
49644964
operation.
49654965
49664966
Returns:
4967-
tasklets.Future: Eventural result is ``tuple(key.Key)``: Keys for
4967+
tasklets.Future: Eventual result is ``tuple(key.Key)``: Keys for
49684968
the newly allocated IDs.
49694969
"""
49704970
if max:
@@ -5423,7 +5423,7 @@ def _populate(self, **kwargs):
54235423
provision for key, id, or parent are made.
54245424
54255425
Arguments:
5426-
**kwargs: Keyword arguments corresponding to poperties of this
5426+
**kwargs: Keyword arguments corresponding to properties of this
54275427
model class.
54285428
"""
54295429
self._set_attributes(kwargs)

packages/google-cloud-ndb/src/google/cloud/ndb/polymodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class PolyModel(model.Model):
144144
Properties that are defined in a given base class within a
145145
hierarchy are stored in Cloud Datastore for all subclasses only.
146146
So, if the Feline class had a property called `whiskers`, the Cat
147-
and Panther enties would also have whiskers, but not Animal,
147+
and Panther entities would also have whiskers, but not Animal,
148148
Canine, Dog or Wolf.
149149
150150
Polymorphic queries:

packages/google-cloud-ndb/src/google/cloud/ndb/query.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class Parameter(ParameterizedThing):
272272
"""Represents a bound variable in a GQL query.
273273
274274
``Parameter(1)`` corresponds to a slot labeled ``:1`` in a GQL query.
275-
``Parameter('xyz')`` corresponds to a slot labeled ``:xyz``.
275+
``Parameter('something')`` corresponds to a slot labeled ``:something``.
276276
277277
The value must be set (bound) separately.
278278
@@ -993,7 +993,7 @@ def resolve(self, bindings, used):
993993
994994
Returns:
995995
Node: The current node, if all nodes are already resolved.
996-
Otherwise returns a modifed :class:`ConjunctionNode` with
996+
Otherwise returns a modified :class:`ConjunctionNode` with
997997
each individual node resolved.
998998
"""
999999
resolved_nodes = [node.resolve(bindings, used) for node in self._nodes]
@@ -1076,7 +1076,7 @@ def resolve(self, bindings, used):
10761076
10771077
Returns:
10781078
Node: The current node, if all nodes are already resolved.
1079-
Otherwise returns a modifed :class:`DisjunctionNode` with
1079+
Otherwise returns a modified :class:`DisjunctionNode` with
10801080
each individual node resolved.
10811081
"""
10821082
resolved_nodes = [node.resolve(bindings, used) for node in self._nodes]
@@ -1543,7 +1543,7 @@ def bind(self, *positional, **keyword):
15431543
When a query is created using gql, any bound parameters
15441544
are created as ParameterNode instances. This method
15451545
receives values for both positional (:1, :2, etc.) or
1546-
keyword (:xyz, :abc, etc.) bound parameters, then sets the
1546+
keyword (:something, :other, etc.) bound parameters, then sets the
15471547
values accordingly. This mechanism allows easy reuse of a
15481548
parameterized query, by passing the values to bind here.
15491549
@@ -2086,7 +2086,7 @@ def count(
20862086
``len(q.fetch(limit, keys_only=True))``. We can also avoid
20872087
marshalling NDB key objects from the returned protocol buffers, but
20882088
this is a minor savings--most applications that use NDB will have
2089-
their perfomance bound by the Datastore backend, not the CPU.
2089+
their performance bound by the Datastore backend, not the CPU.
20902090
Generally, any claim of performance improvement using this versus
20912091
the equivalent call to ``fetch`` is exaggerated, at best.
20922092

packages/google-cloud-ndb/src/google/cloud/ndb/tasklets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def cancel(self):
240240
raise NotImplementedError
241241

242242
def cancelled(self):
243-
"""Get whether task for this future has been cancelled.
243+
"""Get whether task for this future has been canceled.
244244
245245
Returns:
246246
:data:`False`: Always.

0 commit comments

Comments
 (0)