Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster reading of ConfigSet that's yielded by ConfigSet.groups() #293

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions wfl/configset.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ def __iter__(self):
if self.items is None:
return

# special handling for ConfigSet generated by groups() iterator, which
# sets self._cur_at, self._file_loc, and self._open_reader
if self._file_loc is not None and len(self._file_loc) > 0 and self._cur_at[0] is not None:
assert self._open_reader is not None
while self._cur_at[0].info["_ConfigSet_loc"].startswith(self._file_loc):
yield self._cur_at[0]
try:
self._cur_at[0] = next(self._open_reader)
except StopIteration:
break
return

if isinstance(self.items, Path):
# yield Atoms from one file
## print("DEBUG __iter__ one file", self.items)
Expand Down
Loading