From 3ab797a9882d3104514323ec5168872a8542a3ff Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Wed, 11 Nov 2015 16:25:53 +0100 Subject: [PATCH] remove explicit mention of object as base class --- examples/square.py | 2 +- kwant/builder.py | 14 +++++++------- kwant/lattice.py | 2 +- kwant/linalg/mumps.py | 6 +++--- kwant/physics/dispersion.py | 2 +- kwant/physics/leads.py | 4 ++-- kwant/solvers/common.py | 6 +++--- kwant/solvers/tests/_test_sparse.py | 2 +- kwant/system.py | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/square.py b/examples/square.py index 580df113..abad6392 100644 --- a/examples/square.py +++ b/examples/square.py @@ -10,7 +10,7 @@ from kwant.physics.leads import square_selfenergy __all__ = ['System'] -class Lead(object): +class Lead: def __init__(self, width, t, potential): self.width = width self.t = t diff --git a/kwant/builder.py b/kwant/builder.py index 42ef1b11..faf37135 100644 --- a/kwant/builder.py +++ b/kwant/builder.py @@ -82,7 +82,7 @@ class Site(tuple): return self.family.pos(self.tag) -class SiteFamily(object, metaclass=abc.ABCMeta): +class SiteFamily(metaclass=abc.ABCMeta): """Abstract base class for site families. Site families are the 'type' of `Site` objects. Within a family, individual @@ -221,7 +221,7 @@ def validate_hopping(hopping): ################ Symmetries -class Symmetry(object, metaclass=abc.ABCMeta): +class Symmetry(metaclass=abc.ABCMeta): """Abstract base class for spatial symmetries. Many physical systems possess a discrete spatial symmetry, which results in @@ -321,7 +321,7 @@ class NoSymmetry(Symmetry): ################ Hopping kinds -class HoppingKind(object): +class HoppingKind: """A pattern for matching hoppings. A hopping ``(a, b)`` matches precisely when the site family of ``a`` equals @@ -413,7 +413,7 @@ def herm_conj(value): return value -class HermConjOfFunc(object): +class HermConjOfFunc: """Proxy returning the hermitian conjugate of the original result.""" __slots__ = ('function') @@ -426,7 +426,7 @@ class HermConjOfFunc(object): ################ Leads -class Lead(object, metaclass=abc.ABCMeta): +class Lead(metaclass=abc.ABCMeta): """Abstract base class for leads that can be attached to a `Builder`. To attach a lead to a builder, append it to the builder's `~Builder.leads` @@ -554,7 +554,7 @@ class ModesLead(Lead): # A marker, meaning for hopping (i, j): this value is given by the Hermitian # conjugate the value of the hopping (j, i). Used by Builder and System. -class Other(object): +class Other: pass @@ -567,7 +567,7 @@ def edges(seq): return result -class Builder(object): +class Builder: """A tight binding system defined on a graph. This is one of the central types in Kwant. It is used to construct tight diff --git a/kwant/lattice.py b/kwant/lattice.py index f00647d1..9b26bca8 100644 --- a/kwant/lattice.py +++ b/kwant/lattice.py @@ -49,7 +49,7 @@ def general(prim_vecs, basis=None, name=''): return Polyatomic(prim_vecs, basis, name=name) -class Polyatomic(object): +class Polyatomic: """ A Bravais lattice with an arbitrary number of sites in the basis. diff --git a/kwant/linalg/mumps.py b/kwant/linalg/mumps.py index cd28860a..0fa797bc 100644 --- a/kwant/linalg/mumps.py +++ b/kwant/linalg/mumps.py @@ -86,7 +86,7 @@ class MUMPSError(RuntimeError): RuntimeError.__init__(self, msg) -class AnalysisStatistics(object): +class AnalysisStatistics: def __init__(self, inst, time=None): self.est_mem_incore = inst.infog[17] self.est_mem_ooc = inst.infog[27] @@ -110,7 +110,7 @@ class AnalysisStatistics(object): return " ".join(parts) -class FactorizationStatistics(object): +class FactorizationStatistics: def __init__(self, inst, time=None, include_ordering=False): # information about pivoting self.offdiag_pivots = inst.infog[12] if inst.sym == 0 else 0 @@ -144,7 +144,7 @@ class FactorizationStatistics(object): return " ".join(parts) -class MUMPSContext(object): +class MUMPSContext: """MUMPSContext contains the internal data structures needed by the MUMPS library and contains a user-friendly interface. diff --git a/kwant/physics/dispersion.py b/kwant/physics/dispersion.py index 238f584c..1dfff843 100644 --- a/kwant/physics/dispersion.py +++ b/kwant/physics/dispersion.py @@ -14,7 +14,7 @@ from .._common import ensure_isinstance __all__ = ['Bands'] -class Bands(object): +class Bands: """ Class of callable objects for the computation of energy bands. diff --git a/kwant/physics/leads.py b/kwant/physics/leads.py index edacd0bf..4342316e 100644 --- a/kwant/physics/leads.py +++ b/kwant/physics/leads.py @@ -37,7 +37,7 @@ else: Linsys = namedtuple('Linsys', ['eigenproblem', 'v', 'extract']) -class PropagatingModes(object): +class PropagatingModes: """The calculated propagating modes of a lead. Attributes @@ -68,7 +68,7 @@ class PropagatingModes(object): self.__dict__.update(kwargs) -class StabilizedModes(object): +class StabilizedModes: """Stabilized eigendecomposition of the translation operator. Due to the lack of Hermiticity of the translation operator, its diff --git a/kwant/solvers/common.py b/kwant/solvers/common.py index 6d6a683c..a91d7c94 100644 --- a/kwant/solvers/common.py +++ b/kwant/solvers/common.py @@ -29,7 +29,7 @@ from functools import reduce LinearSys = namedtuple('LinearSys', ['lhs', 'rhs', 'indices', 'num_orb']) -class SparseSolver(object, metaclass=abc.ABCMeta): +class SparseSolver(metaclass=abc.ABCMeta): """Solver class for computing physical quantities based on solving a liner system of equations. @@ -546,7 +546,7 @@ class SparseSolver(object, metaclass=abc.ABCMeta): return WaveFunction(self, sys, energy, args, check_hermiticity) -class WaveFunction(object): +class WaveFunction: def __init__(self, solver, sys, energy, args, check_hermiticity): ensure_isinstance(sys, system.System) for lead in sys.leads: @@ -568,7 +568,7 @@ class WaveFunction(object): return result.transpose() -class BlockResult(object, metaclass=abc.ABCMeta): +class BlockResult(metaclass=abc.ABCMeta): """ ABC for a linear system solution with variable grouping. """ diff --git a/kwant/solvers/tests/_test_sparse.py b/kwant/solvers/tests/_test_sparse.py index 3c26d263..380229a7 100644 --- a/kwant/solvers/tests/_test_sparse.py +++ b/kwant/solvers/tests/_test_sparse.py @@ -18,7 +18,7 @@ chain = kwant.lattice.chain() sq = square = kwant.lattice.square() -class LeadWithOnlySelfEnergy(object): +class LeadWithOnlySelfEnergy: def __init__(self, lead): self.lead = lead diff --git a/kwant/system.py b/kwant/system.py index ca541b4a..5efbc5c8 100644 --- a/kwant/system.py +++ b/kwant/system.py @@ -16,7 +16,7 @@ from copy import copy from . import _system -class System(object, metaclass=abc.ABCMeta): +class System(metaclass=abc.ABCMeta): """Abstract general low-level system. Attributes @@ -225,7 +225,7 @@ class InfiniteSystem(System, metaclass=abc.ABCMeta): return physics.selfenergy(ham, self.inter_cell_hopping(args)) -class PrecalculatedLead(object): +class PrecalculatedLead: def __init__(self, modes=None, selfenergy=None): """A general lead defined by its self energy. -- GitLab