Skip to content

Commit

Permalink
Explicitly disable iteration over DataCollection and SourceData
Browse files Browse the repository at this point in the history
  • Loading branch information
philsmt committed Dec 19, 2024
1 parent f8bd995 commit 14e1c48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extra_data/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ def __contains__(self, item):

return False

__iter__ = None # Disable iteration

def _ipython_key_completions_(self):
return list(self.all_sources)

Expand Down
2 changes: 2 additions & 0 deletions extra_data/sourcedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __contains__(self, key):
res = self._has_exact_key(key + '.value')
return res

__iter__ = None # Disable iteration

def __getitem__(self, key):
if (
isinstance(key, (by_id, by_index, list, np.ndarray, slice)) or
Expand Down

0 comments on commit 14e1c48

Please sign in to comment.