From 8d665aa799cecdcbf762148d11c625e0bb30bf82 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Thu, 17 May 2018 15:09:50 +0000 Subject: [PATCH] replace some class' base class with InheritComparisonUniqueRepresentation where possible --- src/sage/algebras/clifford_algebra.py | 11 ++++------- src/sage/algebras/commutative_dga.py | 12 ++++-------- .../modform_hecketriangle/graded_ring_element.py | 11 ++++------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index 244edb1a317..43eaf3d28d1 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -17,9 +17,9 @@ #***************************************************************************** from six import iteritems -from sage.misc.six import with_metaclass from sage.misc.cachefunc import cached_method -from sage.structure.unique_representation import UniqueRepresentation +from sage.structure.unique_representation import ( + InheritComparisonUniqueRepresentation) from copy import copy from sage.categories.algebras_with_basis import AlgebrasWithBasis @@ -35,7 +35,6 @@ from sage.combinat.subset import SubsetsSorted from sage.quadratic_forms.quadratic_form import QuadraticForm from sage.algebras.weyl_algebra import repr_from_monomials -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass class CliffordAlgebraElement(CombinatorialFreeModule.Element): @@ -2161,10 +2160,8 @@ def scalar(self, other): ##################################################################### ## Differentials -class ExteriorAlgebraDifferential(with_metaclass( - InheritComparisonClasscallMetaclass, - ModuleMorphismByLinearity, UniqueRepresentation - )): +class ExteriorAlgebraDifferential(ModuleMorphismByLinearity, + InheritComparisonUniqueRepresentation): r""" Internal class to store the data of a boundary or coboundary of an exterior algebra `\Lambda(L)` defined by the structure diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 36c545a8ff0..fcf4c2c7ff7 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -74,11 +74,10 @@ from __future__ import print_function, absolute_import from six import string_types -from sage.misc.six import with_metaclass -from sage.structure.unique_representation import UniqueRepresentation +from sage.structure.unique_representation import ( + InheritComparisonUniqueRepresentation, UniqueRepresentation) from sage.structure.sage_object import SageObject from sage.misc.cachefunc import cached_method -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from sage.misc.functional import is_odd, is_even from sage.misc.misc_c import prod from sage.categories.algebras import Algebras @@ -99,10 +98,7 @@ from sage.rings.quotient_ring_element import QuotientRingElement -class Differential(with_metaclass( - InheritComparisonClasscallMetaclass, - UniqueRepresentation, Morphism - )): +class Differential(InheritComparisonUniqueRepresentation, Morphism): r""" Differential of a commutative graded algebra. @@ -935,7 +931,7 @@ def _repr_(self): sage: A Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (3, 4, 2, 1) over Rational Field sage: A.quotient(A.ideal(3*x*z - 2*y*t)) - Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (3, 4, 2, 1) with relations [3*x*z - 2*y*t] over Rational Field + Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (3, 4, 2, 1) with relations [3*x*z - 2*y*t] over Rational Field """ s = "Graded Commutative Algebra with generators {} in degrees {}".format(self._names, self._degrees) # Find any nontrivial relations. diff --git a/src/sage/modular/modform_hecketriangle/graded_ring_element.py b/src/sage/modular/modform_hecketriangle/graded_ring_element.py index be3b1e614bf..5872e4c2301 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring_element.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring_element.py @@ -17,7 +17,6 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.misc import six from sage.rings.all import ZZ, infinity, LaurentSeries, O from sage.functions.all import exp from sage.rings.number_field.number_field import QuadraticField @@ -26,13 +25,13 @@ from sage.structure.parent_gens import localvars from sage.structure.richcmp import op_NE, op_EQ from sage.structure.element import CommutativeAlgebraElement -from sage.structure.unique_representation import UniqueRepresentation +from sage.structure.unique_representation import ( + InheritComparisonUniqueRepresentation) from sage.modules.free_module_element import vector from sage.geometry.hyperbolic_space.hyperbolic_interface import HyperbolicPlane from sage.misc.cachefunc import cached_method -from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass from .constructor import rational_type, FormsSpace, FormsRing from .series_constructor import MFSeriesConstructor @@ -42,10 +41,8 @@ # corresponding operations (e.g. __pow__) even though the category # (and class) of the parent is in some cases not # CommutativeAlgebras but Modules -class FormsRingElement(six.with_metaclass( - InheritComparisonClasscallMetaclass, - CommutativeAlgebraElement, UniqueRepresentation - )): +class FormsRingElement(CommutativeAlgebraElement, + InheritComparisonUniqueRepresentation): r""" Element of a FormsRing. """