Skip to content

Commit 32047ea

Browse files
Fix .rst parsing issues, add a docker command reference to assist in dev, update structure to show tree on nav, display api doc for module by default/home.
1 parent e751a42 commit 32047ea

File tree

6 files changed

+42
-44
lines changed

6 files changed

+42
-44
lines changed

datajoint/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
that any use of DataJoint leading to a publication be acknowledged in the publication.
1111
1212
Please cite:
13-
http://biorxiv.org/content/early/2015/11/14/031658
14-
http://dx.doi.org/10.1101/031658
13+
14+
- http://biorxiv.org/content/early/2015/11/14/031658
15+
- http://dx.doi.org/10.1101/031658
1516
"""
1617

1718
__author__ = "DataJoint Contributors"

datajoint/connection.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
This module contains the Connection class that manages the connection to the database,
3-
and the `conn` function that provides access to a persistent connection in datajoint.
2+
This module contains the Connection class that manages the connection to the database, and
3+
the ``conn`` function that provides access to a persistent connection in datajoint.
44
"""
55
import warnings
66
from contextlib import contextmanager
@@ -109,11 +109,9 @@ def conn(
109109
:param password: mysql password
110110
:param init_fun: initialization function
111111
:param reset: whether the connection should be reset or not
112-
:param use_tls: TLS encryption option. Valid options are: True (required),
113-
False (required no TLS), None (TLS prefered, default),
114-
dict (Manually specify values per
115-
https://dev.mysql.com/doc/refman/5.7/en/connection-options.html
116-
#encrypted-connection-options).
112+
:param use_tls: TLS encryption option. Valid options are: True (required), False
113+
(required no TLS), None (TLS prefered, default), dict (Manually specify values per
114+
https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#encrypted-connection-options).
117115
"""
118116
if not hasattr(conn, "connection") or reset:
119117
host = host if host is not None else config["database.host"]

datajoint/table.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,20 @@ def external(self):
276276

277277
def update1(self, row):
278278
"""
279-
update1 updates one existing entry in the table.
280-
Caution: In DataJoint the primary modes for data manipulation is to ``insert`` and ``delete``
281-
entire records since referential integrity works on the level of records, not fields.
282-
Therefore, updates are reserved for corrective operations outside of main workflow.
283-
Use UPDATE methods sparingly with full awareness of potential violations of assumptions.
279+
``update1`` updates one existing entry in the table.
280+
Caution: In DataJoint the primary modes for data manipulation is to ``insert`` and
281+
``delete`` entire records since referential integrity works on the level of records,
282+
not fields. Therefore, updates are reserved for corrective operations outside of main
283+
workflow. Use UPDATE methods sparingly with full awareness of potential violations of
284+
assumptions.
284285
285286
:param row: a ``dict`` containing the primary key values and the attributes to update.
286-
Setting an attribute value to None will reset it to the default value (if any)
287+
Setting an attribute value to None will reset it to the default value (if any).
288+
287289
The primary key attributes must always be provided.
290+
288291
Examples:
292+
289293
>>> table.update1({'id': 1, 'value': 3}) # update value in record with id=1
290294
>>> table.update1({'id': 1, 'value': None}) # reset value to default
291295
"""
@@ -326,7 +330,7 @@ def insert1(self, row, **kwargs):
326330
Insert one data record into the table. For ``kwargs``, see ``insert()``.
327331
328332
:param row: a numpy record, a dict-like object, or an ordered sequence to be inserted
329-
as one row.
333+
as one row.
330334
"""
331335
self.insert((row,), **kwargs)
332336

@@ -339,16 +343,18 @@ def insert(
339343
allow_direct_insert=None,
340344
):
341345
"""
342-
Insert a collection of rows.
343-
344-
:param rows: An iterable where an element is a numpy record, a dict-like object, a pandas.DataFrame, a sequence,
345-
or a query expression with the same heading as self.
346-
:param replace: If True, replaces the existing tuple.
347-
:param skip_duplicates: If True, silently skip duplicate inserts.
348-
:param ignore_extra_fields: If False, fields that are not in the heading raise error.
349-
:param allow_direct_insert: applies only in auto-populated tables.
350-
If False (default), insert are allowed only from inside the make callback.
351-
Example::
346+
Insert a collection of rows.
347+
348+
:param rows: An iterable where an element is a numpy record, a dict-like object, a
349+
pandas.DataFrame, a sequence, or a query expression with the same heading as self.
350+
:param replace: If True, replaces the existing tuple.
351+
:param skip_duplicates: If True, silently skip duplicate inserts.
352+
:param ignore_extra_fields: If False, fields that are not in the heading raise error.
353+
:param allow_direct_insert: applies only in auto-populated tables. If False (default),
354+
insert are allowed only from inside the make callback.
355+
356+
Example:
357+
352358
>>> relation.insert([
353359
>>> dict(subject_id=7, species="mouse", date_of_birth="2014-09-01"),
354360
>>> dict(subject_id=8, species="mouse", date_of_birth="2014-09-02")])

docs-api/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# HOST_UID=1000 docker-compose -f ./docs-api/docker-compose.yaml up --build
2+
# docker exec -it docs-api_docs-builder_1 bash -c "pip install -U /main/datajoint-python && rm -R build && make html"
23
version: '2.4'
34
services:
45
# example how to build

docs-api/source/index.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
Welcome to DataJoint's API Documentation!
77
=========================================
88

9+
datajoint module
10+
----------------
11+
12+
.. automodule:: datajoint
13+
:members:
14+
:undoc-members:
15+
:show-inheritance:
16+
917
.. toctree::
1018
:maxdepth: 2
11-
:caption: Contents:
19+
:caption: Submodules:
1220

13-
datajoint
14-
15-
21+
submodules
1622

1723
Indices and tables
1824
==================

docs-api/source/datajoint.rst renamed to docs-api/source/submodules.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
datajoint package
2-
=================
3-
4-
Submodules
5-
----------
6-
71
datajoint.admin module
82
----------------------
93

@@ -211,11 +205,3 @@ datajoint.version module
211205
:members:
212206
:undoc-members:
213207
:show-inheritance:
214-
215-
Module contents
216-
---------------
217-
218-
.. automodule:: datajoint
219-
:members:
220-
:undoc-members:
221-
:show-inheritance:

0 commit comments

Comments
 (0)