Skip to content

Commit 7a10aac

Browse files
committed
enh: DBExtract.__iadd__ supports lists
1 parent bd7694f commit 7a10aac

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

dcoraid/dbmodel/extract.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ def __init__(self, datasets=None):
2525
def __add__(self, other):
2626
return DBExtract(self.datasets + other.datasets)
2727

28-
def __iadd__(self, other):
29-
self.add_datasets(other.datasets)
28+
def __iadd__(self, other: "DBExtract | list"):
29+
"""Add datasets from DBExtract instance or from list to self"""
30+
if isinstance(other, DBExtract):
31+
to_add = other.datasets
32+
else:
33+
to_add = other
34+
self.add_datasets(to_add)
3035
return self
3136

3237
def __contains__(self, item):

0 commit comments

Comments
 (0)