Skip to content

Commit f39eca5

Browse files
committed
docs(autopopulate): fix stale finally-comment; document upstream in class Attributes
Two post-#1499 docstring/comment updates on autopopulate.py: 1. The finally-block comment in _populate_one attributed the 'raises a clear error' behavior to `self._upstream = None`, but post-#1499 that line only invalidates the memoized Diagram. The actual guard is `self._upstream_key = None` (via the `upstream` property at :135-140). Reworded to attribute each line to its role. 2. AutoPopulate class docstring's Attributes section listed only `key_source` and `jobs`, omitting `upstream` - which after #1473 is a public property and the recommended read surface inside make(). Added it alongside the others. Docs-only.
1 parent 5f49c76 commit f39eca5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/datajoint/autopopulate.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ class AutoPopulate:
8989
Query yielding keys to be populated. Default is join of FK parents.
9090
jobs : Job
9191
Job table (``~~table_name``) for distributed processing.
92+
upstream : Diagram
93+
Pre-restricted ancestor view for the current ``make(self, key)`` call
94+
(property). Available only inside ``make()``; built lazily on first
95+
access and memoized for the call. See the property docstring for
96+
details.
9297
9398
Notes
9499
-----
@@ -736,9 +741,11 @@ def _populate1(
736741
return True
737742
finally:
738743
self.__class__._allow_insert = False
739-
# Clear the per-make() upstream view so subsequent attribute
740-
# access raises a clear error rather than silently using a
741-
# stale trace from the previous make() call.
744+
# Clear the per-make() upstream state: `_upstream = None` invalidates
745+
# the memoized Diagram; `_upstream_key = None` restores the "outside
746+
# make()" state so subsequent `self.upstream` access raises a clear
747+
# error via the property guard rather than silently returning a stale
748+
# trace from the previous call.
742749
self._upstream = None
743750
self._upstream_key = None
744751

0 commit comments

Comments
 (0)