Skip to content

Commit d35471e

Browse files
committed
Populate() can take kwargs that are passed down to each make() call.
1 parent 72c8fea commit d35471e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

datajoint/autopopulate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _jobs_to_do(self, restrictions):
9696

9797
def populate(self, *restrictions, suppress_errors=False, return_exception_objects=False,
9898
reserve_jobs=False, order="original", limit=None, max_calls=None,
99-
display_progress=False):
99+
display_progress=False, **kwargs):
100100
"""
101101
rel.populate() calls rel.make(key) for every primary key in self.key_source
102102
for which there is not already a tuple in rel.
@@ -108,6 +108,7 @@ def populate(self, *restrictions, suppress_errors=False, return_exception_object
108108
:param display_progress: if True, report progress_bar
109109
:param limit: if not None, checks at most that many keys
110110
:param max_calls: if not None, populates at max that many keys
111+
:param kwargs: additional custom keyword arguments that will be passed down to each make() call
111112
"""
112113
if self.connection.in_transaction:
113114
raise DataJointError('Populate cannot be called during a transaction.')
@@ -150,7 +151,10 @@ def handler(signum, frame):
150151
call_count += 1
151152
self.__class__._allow_insert = True
152153
try:
153-
make(dict(key))
154+
if kwargs:
155+
make(dict(key), **kwargs)
156+
else:
157+
make(dict(key))
154158
except (KeyboardInterrupt, SystemExit, Exception) as error:
155159
try:
156160
self.connection.cancel_transaction()

0 commit comments

Comments
 (0)