Skip to content

Commit

Permalink
modernize super() (ruff UP008)
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton authored and sunqm committed Oct 19, 2023
1 parent 6e5a28c commit 231da24
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyscf/dft/gen_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion pyscf/geomopt/geometric_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyscf/gw/gw_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyscf/pbc/geomopt/geometric_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyscf/pbc/gw/kgw_slow_supercell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyscf/pbc/scf/khf_ksymm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions pyscf/pbc/tdscf/krhf_slow_supercell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyscf/tdscf/common_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyscf/tdscf/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyscf/tdscf/rhf_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 231da24

Please sign in to comment.