Skip to content

Commit 2b7b7c7

Browse files
Provide example of google-styled docstring + ignore private methods.
1 parent f614c5e commit 2b7b7c7

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

datajoint/table.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,30 @@ def delete_quick(self, get_count=False):
459459
self._log(query[:255])
460460
return count
461461

462-
def delete(self, transaction=True, safemode=None, force_parts=False):
462+
def delete(
463+
self,
464+
transaction: bool = True,
465+
safemode: bool | None = None,
466+
force_parts: bool = False,
467+
) -> int:
463468
"""
464469
Deletes the contents of the table and its dependent tables, recursively.
465470
466-
:param transaction: if True, use the entire delete becomes an atomic transaction. This is the default and
467-
recommended behavior. Set to False if this delete is nested within another transaction.
468-
:param safemode: If True, prohibit nested transactions and prompt to confirm. Default is dj.config['safemode'].
469-
:param force_parts: Delete from parts even when not deleting from their masters.
470-
:return: number of deleted rows (excluding those from dependent tables)
471+
Args:
472+
transaction: If `True`, use of the entire delete becomes an atomic transaction.
473+
This is the default and recommended behavior. Set to `False` if this delete is
474+
nested within another transaction.
475+
safemode: If `True`, prohibit nested transactions and prompt to confirm. Default
476+
is `dj.config['safemode']`.
477+
force_parts: Delete from parts even when not deleting from their masters.
478+
479+
Returns:
480+
Number of deleted rows (excluding those from dependent tables).
481+
482+
Raises:
483+
DataJointError: Delete exceeds maximum number of delete attempts.
484+
DataJointError: When deleting within an existing transaction.
485+
DataJointError: Deleting a part table before its master.
471486
"""
472487
deleted = set()
473488

docs/mkdocs.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ plugins:
4545
"index.md": "getting_started/index.md"
4646
- mkdocstrings:
4747
default_handler: python
48+
handlers:
49+
python:
50+
selection:
51+
filters:
52+
- "!^_"
4853
- gen-files:
4954
scripts:
5055
- ./src/api/make_pages.py

0 commit comments

Comments
 (0)