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 Apr 21, 2022
1 parent 998fb29 commit 84b7dc2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Removed
- All MongoDB database functionality, including the ``db`` subpackage, the ``connection``, ``crypt``, and ``host`` submodules in the ``common`` subpackage, and all associated configuration information (#576, #596).
- The ``JobSearchIndex`` class (#587).
- The ability to pass indexes to various ``Project`` methods (#599).
- The following ``JobsCursor`` methods: ``groupbydoc``, ``next`` (#601, #604).

Version 1
=========
Expand Down
21 changes: 0 additions & 21 deletions signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1956,27 +1956,6 @@ def __iter__(self):
self._project, self._project._find_job_ids(self._filter)
)

@deprecated(
deprecated_in="0.9.6",
removed_in="2.0",
current_version=__version__,
details="Use next(iter(...)) instead.",
)
def next(self):
"""Return the next element.
This function is deprecated. Users should use ``next(iter(...))`` instead.
.. deprecated:: 0.9.6
"""
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 @@ -330,24 +330,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 84b7dc2

Please sign in to comment.