From f39eca50b5929e07d9f42c81585738b6df3e2b91 Mon Sep 17 00:00:00 2001 From: MilagrosMarin Date: Mon, 20 Jul 2026 16:20:31 +0200 Subject: [PATCH] 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. --- src/datajoint/autopopulate.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/datajoint/autopopulate.py b/src/datajoint/autopopulate.py index baf050840..ed2493714 100644 --- a/src/datajoint/autopopulate.py +++ b/src/datajoint/autopopulate.py @@ -89,6 +89,11 @@ class AutoPopulate: Query yielding keys to be populated. Default is join of FK parents. jobs : Job Job table (``~~table_name``) for distributed processing. + upstream : Diagram + Pre-restricted ancestor view for the current ``make(self, key)`` call + (property). Available only inside ``make()``; built lazily on first + access and memoized for the call. See the property docstring for + details. Notes ----- @@ -736,9 +741,11 @@ def _populate1( return True finally: self.__class__._allow_insert = False - # Clear the per-make() upstream view so subsequent attribute - # access raises a clear error rather than silently using a - # stale trace from the previous make() call. + # Clear the per-make() upstream state: `_upstream = None` invalidates + # the memoized Diagram; `_upstream_key = None` restores the "outside + # make()" state so subsequent `self.upstream` access raises a clear + # error via the property guard rather than silently returning a stale + # trace from the previous call. self._upstream = None self._upstream_key = None