Skip to content

Commit 3778b9f

Browse files
Merge branch 'docs-styling' into json
2 parents 8008a7a + d456d3c commit 3778b9f

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

datajoint/table.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
UnknownAttributeError,
2424
IntegrityError,
2525
)
26+
from typing import Union
2627
from .version import __version__ as version
2728

2829
logger = logging.getLogger(__name__.split(".")[0])
@@ -460,15 +461,30 @@ def delete_quick(self, get_count=False):
460461
self._log(query[:255])
461462
return count
462463

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

docs/mkdocs.yaml

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

0 commit comments

Comments
 (0)