From 231da24f746d3a7988a4c48c9237c4788bda6a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 17 Oct 2023 08:28:02 +0200 Subject: [PATCH] modernize super() (ruff UP008) --- pyscf/dft/gen_grid.py | 2 +- pyscf/geomopt/geometric_solver.py | 2 +- pyscf/gw/gw_slow.py | 2 +- pyscf/pbc/geomopt/geometric_solver.py | 2 +- pyscf/pbc/gw/kgw_slow_supercell.py | 2 +- pyscf/pbc/scf/khf_ksymm.py | 6 +++--- pyscf/pbc/tdscf/krhf_slow_supercell.py | 6 +++--- pyscf/tdscf/common_slow.py | 2 +- pyscf/tdscf/proxy.py | 2 +- pyscf/tdscf/rhf_slow.py | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pyscf/dft/gen_grid.py b/pyscf/dft/gen_grid.py index 00b2b3bcd0..dc2512d203 100644 --- a/pyscf/dft/gen_grid.py +++ b/pyscf/dft/gen_grid.py @@ -525,7 +525,7 @@ def __setattr__(self, key, val): if key in ('atom_grid', 'atomic_radii', 'radii_adjust', 'radi_method', 'becke_scheme', 'prune', 'level'): self.reset() - super(Grids, self).__setattr__(key, val) + super().__setattr__(key, val) def dump_flags(self, verbose=None): logger.info(self, 'radial grids: %s', self.radi_method.__doc__) diff --git a/pyscf/geomopt/geometric_solver.py b/pyscf/geomopt/geometric_solver.py index b15dd37944..7f258a52e2 100644 --- a/pyscf/geomopt/geometric_solver.py +++ b/pyscf/geomopt/geometric_solver.py @@ -57,7 +57,7 @@ def __init__(self, scanner): # Molecule is the geometry parser for a bunch of formats which use # Angstrom for Cartesian coordinates by default. molecule.xyzs = [mol.atom_coords()*lib.param.BOHR] # In Angstrom - super(PySCFEngine, self).__init__(molecule) + super().__init__(molecule) self.scanner = scanner self.cycle = 0 diff --git a/pyscf/gw/gw_slow.py b/pyscf/gw/gw_slow.py index 9c80c33113..65959767d5 100644 --- a/pyscf/gw/gw_slow.py +++ b/pyscf/gw/gw_slow.py @@ -133,7 +133,7 @@ def __init__(self, td, eri=None): td: a container with TD solution; eri: a container with electron repulsion integrals; """ - super(IMDS, self).__init__(td, eri=eri) + super().__init__(td, eri=eri) # MF self.nocc = self.eri.nocc diff --git a/pyscf/pbc/geomopt/geometric_solver.py b/pyscf/pbc/geomopt/geometric_solver.py index d6f468d84a..d8c47bc21e 100644 --- a/pyscf/pbc/geomopt/geometric_solver.py +++ b/pyscf/pbc/geomopt/geometric_solver.py @@ -53,7 +53,7 @@ def __init__(self, scanner): # Molecule is the geometry parser for a bunch of formats which use # Angstrom for Cartesian coordinates by default. molecule.xyzs = [cell.atom_coords()*lib.param.BOHR] # In Angstrom - super(PySCFEngine, self).__init__(molecule) + super().__init__(molecule) self.scanner = scanner self.cycle = 0 diff --git a/pyscf/pbc/gw/kgw_slow_supercell.py b/pyscf/pbc/gw/kgw_slow_supercell.py index 2aec34cd56..65eca686b6 100644 --- a/pyscf/pbc/gw/kgw_slow_supercell.py +++ b/pyscf/pbc/gw/kgw_slow_supercell.py @@ -116,7 +116,7 @@ def get_rhs(self, p, components=False): return corrected_moe(self.eri, k, kp) def get_sigma_element(self, omega, p, eta, vir_sgn=1): - return super(IMDS, self).get_sigma_element(omega, self.__plain_index__(p, spec=False), eta, vir_sgn=vir_sgn) + return super().get_sigma_element(omega, self.__plain_index__(p, spec=False), eta, vir_sgn=vir_sgn) def initial_guess(self, p): k, kp = p diff --git a/pyscf/pbc/scf/khf_ksymm.py b/pyscf/pbc/scf/khf_ksymm.py index 5b57cf3534..cdefdea11f 100644 --- a/pyscf/pbc/scf/khf_ksymm.py +++ b/pyscf/pbc/scf/khf_ksymm.py @@ -211,7 +211,7 @@ def get_hcore(self, cell=None, kpts=None): def get_jk(self, cell=None, dm_kpts=None, hermi=1, kpts=None, kpts_band=None, with_j=True, with_k=True, omega=None, **kwargs): if isinstance(kpts, np.ndarray): - return super(KsymAdaptedKSCF, self).get_jk(cell, dm_kpts, hermi, kpts, kpts_band, + return super().get_jk(cell, dm_kpts, hermi, kpts, kpts_band, with_j, with_k, omega, **kwargs) if cell is None: cell = self.cell if kpts is None: kpts = self.kpts @@ -238,9 +238,9 @@ def get_jk(self, cell=None, dm_kpts=None, hermi=1, kpts=None, kpts_band=None, def init_guess_by_chkfile(self, chk=None, project=None, kpts=None): if isinstance(kpts, np.ndarray): - return super(KsymAdaptedKSCF, self).init_guess_by_chkfile(chk, project, kpts) + return super().init_guess_by_chkfile(chk, project, kpts) if kpts is None: kpts = self.kpts - return super(KsymAdaptedKSCF, self).init_guess_by_chkfile(chk, project, kpts.kpts_ibz) + return super().init_guess_by_chkfile(chk, project, kpts.kpts_ibz) def dump_chk(self, envs): if self.chkfile: diff --git a/pyscf/pbc/tdscf/krhf_slow_supercell.py b/pyscf/pbc/tdscf/krhf_slow_supercell.py index f626e62eb4..6f05cabc30 100644 --- a/pyscf/pbc/tdscf/krhf_slow_supercell.py +++ b/pyscf/pbc/tdscf/krhf_slow_supercell.py @@ -88,7 +88,7 @@ def tdhf_diag_k(self, k1, k2): The diagonal block. """ # Everything is already implemented in molecular code - return super(PhysERI, self).tdhf_diag(k1, k2) + return super().tdhf_diag(k1, k2) def tdhf_diag(self, pairs=None): """ @@ -127,7 +127,7 @@ def eri_mknj_k(self, item, k): The corresponding block of ERI (phys notation). """ # Everything is already implemented in molecular code - return super(PhysERI, self).eri_mknj(item, k) + return super().eri_mknj(item, k) def eri_mknj(self, item, pairs_row=None, pairs_column=None): """ @@ -214,7 +214,7 @@ def __init__(self, model, frozen=None): frozen (int, Iterable): the number of frozen valence orbitals or the list of frozen orbitals for all k-points or multiple lists of frozen orbitals for each k-point; """ - super(PhysERI8, self).__init__(model, frozen=frozen) + super().__init__(model, frozen=frozen) def vector_to_amplitudes(vectors, nocc, nmo): diff --git a/pyscf/tdscf/common_slow.py b/pyscf/tdscf/common_slow.py index 6164333502..513d3eb9e0 100644 --- a/pyscf/tdscf/common_slow.py +++ b/pyscf/tdscf/common_slow.py @@ -361,7 +361,7 @@ def __init__(self, model): Args: model: a pyscf base model to extract TD matrix from; """ - super(TDProxyMatrixBlocks, self).__init__() + super().__init__() self.proxy_model = model self.proxy_vind, self.proxy_diag = self.proxy_model.gen_vind(self.proxy_model._scf) self.proxy_vind = VindTracker(self.proxy_vind) diff --git a/pyscf/tdscf/proxy.py b/pyscf/tdscf/proxy.py index fbd0ed98c1..2cbbeedb48 100644 --- a/pyscf/tdscf/proxy.py +++ b/pyscf/tdscf/proxy.py @@ -245,7 +245,7 @@ def __init__(self, mf, proxy, frozen=None): proxy: a pyscf proxy with TD response function, one of 'hf', 'dft'; frozen (int, Iterable): the number of frozen valence orbitals or the list of frozen orbitals; """ - super(TDProxy, self).__init__(mf, frozen=frozen) + super().__init__(mf, frozen=frozen) self.__proxy__ = proxy def ao2mo(self): diff --git a/pyscf/tdscf/rhf_slow.py b/pyscf/tdscf/rhf_slow.py index 98ec8a9da8..25a24fd2c8 100644 --- a/pyscf/tdscf/rhf_slow.py +++ b/pyscf/tdscf/rhf_slow.py @@ -125,7 +125,7 @@ def __init__(self, model, frozen=None): Args: model (RHF): the base model; """ - super(PhysERI8, self).__init__(model, frozen=frozen) + super().__init__(model, frozen=frozen) def vector_to_amplitudes(vectors, nocc, nmo):