Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Remove ParentWith*AbelianGens and Module_old
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Sep 1, 2016
1 parent 5cd62cb commit b0a3d37
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 164 deletions.
25 changes: 1 addition & 24 deletions src/sage/modules/module.pyx
@@ -1,11 +1,6 @@
"""
Abstract base class for modules
Two classes for modules are defined here: :class:`.Module_old` and
:class:`.Module`. The former is a legacy class which should not be used for new
code anymore as it does not conform to the coercion model. Eventually all
occurences shall be ported to :class:`.Module`.
AUTHORS:
- William Stein: initial version
Expand Down Expand Up @@ -67,26 +62,8 @@ A minimal example of a module::
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.structure.parent_gens cimport ParentWithAdditiveAbelianGens
from sage.structure.parent cimport Parent

cdef class Module_old(sage.structure.parent_gens.ParentWithAdditiveAbelianGens):
"""
Generic module class.
"""
def __init__(self, *args, **kwds):
"""
TESTS::
sage: sage.modules.module.Module_old(ZZ)
doctest:...: DeprecationWarning: the class Module_old is superseded by Module.
See http://trac.sagemath.org/17543 for details.
<type 'sage.modules.module.Module_old'>
"""
from sage.misc.superseded import deprecation
deprecation(17543, "the class Module_old is superseded by Module.")
ParentWithAdditiveAbelianGens.__init__(self, *args, **kwds)


cdef class Module(sage.structure.parent.Parent):
"""
Expand Down Expand Up @@ -297,7 +274,7 @@ def is_Module(x):
False
"""
return isinstance(x, Module) or isinstance(x, Module_old)
return isinstance(x, Module)

def is_VectorSpace(x):
"""
Expand Down
6 changes: 2 additions & 4 deletions src/sage/structure/all.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import

from .factorization import Factorization

from .sequence import Sequence, seq
Expand All @@ -18,10 +19,7 @@

from .parent_base import ParentWithBase

from .parent_gens import (ParentWithGens,
ParentWithAdditiveAbelianGens,
ParentWithMultiplicativeAbelianGens,
localvars)
from .parent_gens import ParentWithGens, localvars

from .proof import all as proof

Expand Down
7 changes: 0 additions & 7 deletions src/sage/structure/parent_gens.pxd
Expand Up @@ -19,10 +19,3 @@ cdef class ParentWithGens(ParentWithBase):
cdef public object _gens
cdef public object _latex_names
cdef public object _list


cdef class ParentWithMultiplicativeAbelianGens(ParentWithGens):
cdef public object _generator_orders

cdef class ParentWithAdditiveAbelianGens(ParentWithGens):
cdef public object _generator_orders
129 changes: 0 additions & 129 deletions src/sage/structure/parent_gens.pyx
Expand Up @@ -95,87 +95,6 @@ cdef inline check_old_coerce(parent.Parent p):
if p._element_constructor is not None:
raise RuntimeError("%s still using old coercion framework" % p)

def is_ParentWithGens(x):
"""
Return True if x is a parent object with generators, i.e., derives from
:class:`sage.structure.parent_gens.ParentWithGens` and False otherwise.
EXAMPLES::
sage: from sage.structure.parent_gens import is_ParentWithGens
sage: is_ParentWithGens(QQ['x'])
doctest:...: DeprecationWarning: the function is_ParentWithGens() is deprecated
See http://trac.sagemath.org/18759 for details.
True
sage: is_ParentWithGens(CC)
True
sage: is_ParentWithGens(Primes())
False
"""
from sage.misc.superseded import deprecation
deprecation(18759, "the function is_ParentWithGens() is deprecated")
return isinstance(x, ParentWithGens)

def is_ParentWithAdditiveAbelianGens(x):
"""
Return True if x is a parent object with additive abelian generators, i.e.,
derives from
:mod:`sage.structure.parent_gens.ParentWithAdditiveAbelianGens` and False
otherwise.
EXAMPLES::
sage: from sage.structure.parent_gens import is_ParentWithAdditiveAbelianGens
sage: is_ParentWithAdditiveAbelianGens(QQ)
doctest:...: DeprecationWarning: the class ParentWithAdditiveAbelianGens is deprecated
See http://trac.sagemath.org/18759 for details.
False
"""
from sage.misc.superseded import deprecation
deprecation(18759, "the class ParentWithAdditiveAbelianGens is deprecated")
return isinstance(x, ParentWithAdditiveAbelianGens)

def is_ParentWithMultiplicativeAbelianGens(x):
"""
Return True if x is a parent object with additive abelian generators, i.e.,
derives from
:class:`sage.structure.parent_gens.ParentWithMultiplicativeAbelianGens` and
False otherwise.
EXAMPLES::
sage: from sage.structure.parent_gens import is_ParentWithMultiplicativeAbelianGens
sage: is_ParentWithMultiplicativeAbelianGens(QQ)
doctest:...: DeprecationWarning: the class ParentWithMultiplicativeAbelianGens is deprecated
See http://trac.sagemath.org/18759 for details.
False
"""
from sage.misc.superseded import deprecation
deprecation(18759, "the class ParentWithMultiplicativeAbelianGens is deprecated")
return isinstance(x, ParentWithMultiplicativeAbelianGens)


# Classes that derive from ParentWithGens must define gen(i) and
# ngens() functions. It is also good if they define gens() to return
# all gens, but this is not necessary.

## def make_parent_gens_v0(_class, _dict,
## base, has_coerce_map_from, names):
## """
## This should work for any Python class deriving from this, as long
## as it doesn't implement some screwy __new__() method.
## """
## cdef ParentWithGens new_object
## new_object = _class.__new__(_class)
## if base is None:
## new_object._base = new_object
## else:
## new_object._base = base
## new_object._has_coerce_map_from = has_coerce_map_from
## new_object._names = names
## if not _dict is None:
## new_object.__dict__ = _dict
## return new_object

cdef class ParentWithGens(ParentWithBase):
# Derived class *must* call __init__ and set the base!
Expand Down Expand Up @@ -410,54 +329,6 @@ cdef class ParentWithGens(ParentWithBase):
return self.Hom(codomain)(im_gens, check=check)


cdef class ParentWithMultiplicativeAbelianGens(ParentWithGens):
def __cinit__(self, *args, **kwds):
from sage.misc.superseded import deprecation
deprecation(18759, "the class ParentWithMultiplicativeAbelianGens is deprecated, use Parent instead")

def generator_orders(self):
check_old_coerce(self)
if self._generator_orders is not None:
return self._generator_orders
else:
g = []
for x in self.gens():
g.append(x.multiplicative_order())
self._generator_orders = g
return g

def __iter__(self):
"""
Return an iterator over the elements in this object.
"""
return gens_py.multiplicative_iterator(self)


cdef class ParentWithAdditiveAbelianGens(ParentWithGens):
def __cinit__(self, *args, **kwds):
from sage.misc.superseded import deprecation
deprecation(18759, "the class ParentWithAdditiveAbelianGens is deprecated, use Parent instead")

def generator_orders(self):
check_old_coerce(self)
if self._generator_orders is not None:
return self._generator_orders
else:
g = []
for x in self.gens():
g.append(x.additive_order())
self._generator_orders = g
return g

def __iter__(self):
"""
Return an iterator over the elements in this object.
"""
return gens_py.abelian_iterator(self)




cdef class localvars:
r"""
Context manager for safely temporarily changing the variables
Expand Down

0 comments on commit b0a3d37

Please sign in to comment.