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

Remove JobsCursor.next. #604

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
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
19 changes: 0 additions & 19 deletions signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1947,25 +1947,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