From ceea353b1ac07b0f10de480220ed9b27ee1eeb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 16 Oct 2023 19:54:40 +0200 Subject: [PATCH] use yield from (ruff UP028) --- pyscf/agf2/dfragf2.py | 3 +-- pyscf/agf2/mpi_helper.py | 3 +-- pyscf/pbc/lib/kpts.py | 3 +-- pyscf/tdscf/common_slow.py | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pyscf/agf2/dfragf2.py b/pyscf/agf2/dfragf2.py index 6b515e2eba..09a3beb056 100644 --- a/pyscf/agf2/dfragf2.py +++ b/pyscf/agf2/dfragf2.py @@ -306,8 +306,7 @@ def prange(self, start=None, stop=None, step=None): if stop is None: stop = self.get_naoaux() if step is None: step = self.blockdim - for p0, p1 in mpi_helper.prange(start, stop, step): - yield p0, p1 + yield from mpi_helper.prange(start, stop, step) class _ChemistsERIs(ragf2._ChemistsERIs): diff --git a/pyscf/agf2/mpi_helper.py b/pyscf/agf2/mpi_helper.py index 1cb20e7675..a37f40d029 100644 --- a/pyscf/agf2/mpi_helper.py +++ b/pyscf/agf2/mpi_helper.py @@ -130,8 +130,7 @@ def nrange(start, stop=None, step=1): if stop is None: start, stop = 0, start - for i in range(start+rank, stop, step*size): - yield i + yield from range(start+rank, stop, step*size) def prange(start, stop, step): diff --git a/pyscf/pbc/lib/kpts.py b/pyscf/pbc/lib/kpts.py index ced0443c4f..cd3de233e8 100644 --- a/pyscf/pbc/lib/kpts.py +++ b/pyscf/pbc/lib/kpts.py @@ -1173,5 +1173,4 @@ def cache_stabilizer(self): def loop_stabilizer(self, index): if self._kqrts_stab is None or self._ops_stab is None: self.cache_stabilizer() - for klcd, iop in zip(self._kqrts_stab[index], self._ops_stab[index]): - yield klcd, iop + yield from zip(self._kqrts_stab[index], self._ops_stab[index]) diff --git a/pyscf/tdscf/common_slow.py b/pyscf/tdscf/common_slow.py index dc6f0d1fbc..6164333502 100644 --- a/pyscf/tdscf/common_slow.py +++ b/pyscf/tdscf/common_slow.py @@ -605,8 +605,7 @@ def __call__(self, v): return r def __iter__(self): - for i, o, e in zip(self.args, self.results, self.errors): - yield i, o, e + yield from zip(self.args, self.results, self.errors) @property def ncalls(self):