Skip to content

Commit

Permalink
Remove JobsCursor.next. (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice authored and vyasr committed Jan 4, 2022
1 parent c19faf7 commit 7477a53
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
19 changes: 0 additions & 19 deletions signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1950,25 +1950,6 @@ def __iter__(self):
self._project, self._project._find_job_ids(self._filter)
)

def next(self):
"""Return the next element.
This function is deprecated. Users should use ``next(iter(..))`` instead.
.. deprecated:: 0.9.6
"""
warnings.warn(
"Calling next() directly on a JobsCursor is deprecated! Use next(iter(..)) instead.",
DeprecationWarning,
)
if self._next_iter is None:
self._next_iter = iter(self)
try:
return next(self._next_iter)
except StopIteration:
self._next_iter = None
raise

def groupby(self, key=None, default=None):
"""Group jobs according to one or more state point parameters.
Expand Down
18 changes: 0 additions & 18 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,24 +325,6 @@ def test_find_jobs_JobsCursor_contains(self):
for sp in statepoints:
assert self.project.open_job(sp) in cursor_doc

@pytest.mark.filterwarnings(
r"ignore:Calling next\(\) directly on a JobsCursor is deprecated!"
)
def test_find_jobs_next(self):
statepoints = [{"a": i} for i in range(5)]
for sp in statepoints:
self.project.open_job(sp).init()
jobs = self.project.find_jobs()
for i in range(2): # run this twice
jobs_ = set()
for i in range(len(self.project)):
job = jobs.next()
assert job in self.project
jobs_.add(job)
with pytest.raises(StopIteration):
job = jobs.next()
assert jobs_ == set(self.project)

def test_find_jobs_arithmetic_operators(self):
for i in range(10):
self.project.open_job(dict(a=i)).init()
Expand Down

0 comments on commit 7477a53

Please sign in to comment.