Skip to content

Commit

Permalink
feat: iterate by objects
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander committed Nov 24, 2021
1 parent 0cd24f4 commit 71cc489
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pascal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,21 @@ def __str__(self):
s = f"<annotation>{head}{objects}\n</annotation>"
return s

def __iter__(self):
self.n = 0
return self

def __len__(self):
return len(self.objects)

def __next__(self):
if self.n < len(self):
obj = self.objects[self.n]
self.n += 1
return obj
else:
raise StopIteration

def to_xml(self, drop_path: bool = False,
drop_folder: bool = False,
drop_source: bool = False,
Expand Down

0 comments on commit 71cc489

Please sign in to comment.