Skip to content

Commit

Permalink
Bulk changes
Browse files Browse the repository at this point in the history
  • Loading branch information
desiena committed Dec 23, 2024
1 parent 945b26c commit 0d29e2d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions fmdata/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_errors_iterator(self,

return (msg for msg in self.messages
if int(msg.code) not in int_exclude_codes and (
int_include_codes is None or (int(msg.code) in int_include_codes)))
int_include_codes is None or (int(msg.code) in int_include_codes)))

def raise_exception_if_has_error(self,
include_codes: Optional[List[FMErrorEnum | int]] = None,
Expand Down Expand Up @@ -626,7 +626,7 @@ class RepositoryRecord(Data):
client: object
layout: str

def edit_record(self, check_mod_id: bool, **kwargs):
def edit_record(self, check_mod_id: bool = False, **kwargs):
mod_id = self.mod_id if check_mod_id else None

return self.client.edit_record(
Expand All @@ -653,6 +653,24 @@ def __getitem__(self, index: int) -> RepositoryRecord:
def __iter__(self) -> Iterator[RepositoryRecord]:
return super().__iter__()

def edit_records(self, check_mod_id: bool = False, limit: Optional[int] = None, **kwargs):
count = 0
for record in self:
if limit is not None and count >= limit:
break

record.edit_record(check_mod_id=check_mod_id, **kwargs)
count += 1

def delete_records(self, limit: Optional[int] = None, **kwargs):
count = 0
for record in self:
if limit is not None and count >= limit:
break

record.delete_record(**kwargs)
count += 1


@dataclass(frozen=True)
class Page:
Expand Down

0 comments on commit 0d29e2d

Please sign in to comment.