Skip to content

Commit

Permalink
Use a private _add method to enforce no_check use
Browse files Browse the repository at this point in the history
  • Loading branch information
bpiwowar committed Mar 4, 2024
1 parent fc5974c commit d315686
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/datamaestro/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, *items: Union[Items, T], no_check=False):
self.items = items[0]
else:
for item in items:
self.add(item, update_only=True)
self._add(item, update_only=True)

# Check if the record is constructured
if not no_check:
Expand Down Expand Up @@ -101,9 +101,12 @@ def __getitem__(self, key: Type[T]) -> T:
return entry

def add(self, *entries: T, update_only=False, no_check=False) -> "Record":
"""Update the record with this new entry, returns a new record if
it exists"""
"""Update the record with these new items, and returns a new record if
any item already exists"""
return self._add(*entries, update_only=update_only)

def _add(self, *entries: T, update_only=False, no_check=False) -> "Record":
"""Internal method for updating records"""
for entry in entries:
# Returns a new record if the item exists
base = entry.__get_base__()
Expand Down

0 comments on commit d315686

Please sign in to comment.