Skip to content

Commit 6ce1444

Browse files
committed
Add datastore.__init__ to docs.
This in turn required a fix in verify_included_modules to turn `__init__.py` files into the correct module / package name.
1 parent 94aa18c commit 6ce1444

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed

datastore/google/cloud/datastore/__init__.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,40 @@
1414

1515
"""Shortcut methods for getting set up with Google Cloud Datastore.
1616
17-
You'll typically use these to get started with the API::
17+
You'll typically use these to get started with the API:
1818
19-
>>> from google.cloud import datastore
20-
>>>
21-
>>> client = datastore.Client()
22-
>>> key = client.key('EntityKind', 1234)
23-
>>> entity = datastore.Entity(key)
24-
>>> query = client.query(kind='EntityKind')
19+
.. code-block:: python
20+
21+
from google.cloud import datastore
22+
23+
client = datastore.Client()
24+
key = client.key('EntityKind', 1234)
25+
entity = datastore.Entity(key)
26+
query = client.query(kind='EntityKind')
2527
2628
The main concepts with this API are:
2729
28-
- :class:`google.cloud.datastore.connection.Connection`
30+
- :class:`~google.cloud.datastore.connection.Connection`
2931
which represents a connection between your machine and the Cloud Datastore
3032
API.
3133
32-
- :class:`google.cloud.datastore.client.Client`
34+
- :class:`~google.cloud.datastore.client.Client`
3335
which represents a project (string) and namespace (string) bundled with
3436
a connection and has convenience methods for constructing objects with that
3537
project / namespace.
3638
37-
- :class:`google.cloud.datastore.entity.Entity`
39+
- :class:`~google.cloud.datastore.entity.Entity`
3840
which represents a single entity in the datastore
3941
(akin to a row in relational database world).
4042
41-
- :class:`google.cloud.datastore.key.Key`
43+
- :class:`~google.cloud.datastore.key.Key`
4244
which represents a pointer to a particular entity in the datastore
4345
(akin to a unique identifier in relational database world).
4446
45-
- :class:`google.cloud.datastore.query.Query`
47+
- :class:`~google.cloud.datastore.query.Query`
4648
which represents a lookup or search over the rows in the datastore.
4749
48-
- :class:`google.cloud.datastore.transaction.Transaction`
50+
- :class:`~google.cloud.datastore.transaction.Transaction`
4951
which represents an all-or-none transaction and enables consistency
5052
when race conditions may occur.
5153
"""

docs/datastore-usage.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Using the API
2+
=============
3+
4+
.. automodule:: google.cloud.datastore
5+
:members:
6+
:show-inheritance:

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:hidden:
1515
:caption: Datastore
1616

17+
datastore-usage
1718
Client <datastore-client>
1819
datastore-entities
1920
datastore-keys

scripts/verify_included_modules.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,29 @@
3030
DOCS_DIR = os.path.join(PROJECT_ROOT, 'docs')
3131
IGNORED_PREFIXES = ('test_', '_')
3232
IGNORED_MODULES = frozenset([
33-
'google.cloud.__init__',
34-
'google.cloud.bigquery.__init__',
35-
'google.cloud.bigtable.__init__',
36-
'google.cloud.datastore.__init__',
37-
'google.cloud.dns.__init__',
38-
'google.cloud.error_reporting.__init__',
39-
'google.cloud.language.__init__',
40-
'google.cloud.logging.__init__',
41-
'google.cloud.logging.handlers.__init__',
42-
'google.cloud.logging.handlers.transports.__init__',
43-
'google.cloud.monitoring.__init__',
44-
'google.cloud.pubsub.__init__',
45-
'google.cloud.resource_manager.__init__',
46-
'google.cloud.speech.__init__',
47-
'google.cloud.storage.__init__',
48-
'google.cloud.streaming.__init__',
33+
'google.cloud',
34+
'google.cloud.bigquery',
35+
'google.cloud.bigtable',
36+
'google.cloud.dns',
37+
'google.cloud.error_reporting',
38+
'google.cloud.language',
39+
'google.cloud.logging',
40+
'google.cloud.logging.handlers',
41+
'google.cloud.logging.handlers.transports',
42+
'google.cloud.monitoring',
43+
'google.cloud.pubsub',
44+
'google.cloud.resource_manager',
45+
'google.cloud.speech',
46+
'google.cloud.storage',
47+
'google.cloud.streaming',
4948
'google.cloud.streaming.buffered_stream',
5049
'google.cloud.streaming.exceptions',
5150
'google.cloud.streaming.http_wrapper',
5251
'google.cloud.streaming.stream_slice',
5352
'google.cloud.streaming.transfer',
5453
'google.cloud.streaming.util',
55-
'google.cloud.translate.__init__',
56-
'google.cloud.vision.__init__',
54+
'google.cloud.translate',
55+
'google.cloud.vision',
5756
'google.cloud.vision.fixtures',
5857
])
5958
PACKAGES = (
@@ -131,7 +130,11 @@ def get_public_modules(path, base_package=None):
131130
if base_package is not None:
132131
rel_path = os.path.join(base_package, rel_path)
133132
# Turn into a Python module rather than a file path.
134-
result.append(rel_path.replace(os.path.sep, '.'))
133+
rel_path = rel_path.replace(os.path.sep, '.')
134+
if mod_name == '__init__':
135+
result.append(rel_path[:-len('.__init__')])
136+
else:
137+
result.append(rel_path)
135138

136139
return result
137140

0 commit comments

Comments
 (0)