From a0ed0b87c35bdcc0d82471342a940bbc84f415d1 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Wed, 18 Aug 2021 17:09:53 -0500 Subject: [PATCH] Remove JobsCursor.next. (#604) --- changelog.txt | 1 + signac/contrib/project.py | 21 --------------------- tests/test_project.py | 18 ------------------ 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3fbbd16da..86b073d17 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 ========= diff --git a/signac/contrib/project.py b/signac/contrib/project.py index d0c9199a0..d2569f353 100644 --- a/signac/contrib/project.py +++ b/signac/contrib/project.py @@ -1972,27 +1972,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 or document parameters. diff --git a/tests/test_project.py b/tests/test_project.py index 75fc9ad03..b8935701a 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -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()