Skip to content

Commit

Permalink
Trac #27627: Remove deprecated code in sage/structure
Browse files Browse the repository at this point in the history
Remove code deprecated in #18555 (Sage 7.3) #24135, #24254, #24256,
#24363, #24614 (Sage 8.2)

URL: https://trac.sagemath.org/27627
Reported by: jdemeyer
Ticket author(s): Jeroen Demeyer
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager authored and vbraun committed Apr 13, 2019
2 parents 8b6e387 + 403b2d3 commit 596b12f
Show file tree
Hide file tree
Showing 19 changed files with 12 additions and 207 deletions.
6 changes: 0 additions & 6 deletions src/sage/combinat/crystals/tensor_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,3 @@ def _element_constructor_(self, *args, **options):

class Element(CrystalOfTableauxElement):
pass

# deprecations from trac:18555
from sage.misc.superseded import deprecated_function_alias
TensorProductOfCrystals.global_options=deprecated_function_alias(18555, TensorProductOfCrystals.options)
TensorProductOfCrystalsOptions=deprecated_function_alias(18555, TensorProductOfCrystals.options)

6 changes: 0 additions & 6 deletions src/sage/combinat/k_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -4639,9 +4639,3 @@ def intermediate_shapes(t):
for i in range(len(t.weight())+1):
shapes += [ t.restrict(i).outer_shape()]
return shapes

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias


StrongTableaux.global_options = deprecated_function_alias(18555, StrongTableaux.options)
5 changes: 0 additions & 5 deletions src/sage/combinat/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8911,8 +8911,3 @@ def __setstate__(self, state):
register_unpickle_override("sage.combinat.permutation", "CyclicPermutationsOfPartition_partition", CyclicPermutationsOfPartition)
register_unpickle_override("sage.combinat.permutation", "CyclicPermutations_mset", CyclicPermutations)
register_unpickle_override('sage.combinat.permutation_nk', 'PermutationsNK', PermutationsNK)

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
Permutations.global_options=deprecated_function_alias(18555, Permutations.options)
PermutationOptions = deprecated_function_alias(18555, Permutations.options)
5 changes: 0 additions & 5 deletions src/sage/combinat/ribbon_shaped_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,3 @@ def __setstate__(self, state):
from sage.misc.persist import register_unpickle_override
register_unpickle_override('sage.combinat.ribbon', 'Ribbon_class', Ribbon_class)
register_unpickle_override('sage.combinat.ribbon', 'StandardRibbons_shape', StandardRibbonShapedTableaux)

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
RibbonShapedTableaux.global_options = deprecated_function_alias(18555, RibbonShapedTableaux.options)
StandardRibbonShapedTableaux.global_options = deprecated_function_alias(18555, StandardRibbonShapedTableaux.options)
5 changes: 0 additions & 5 deletions src/sage/combinat/rigged_configurations/rc_crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,3 @@ def from_virtual(self, vrc):
return self.element_class(self, partition_list=partitions, rigging_list=riggings)

Element = RCHWNonSimplyLacedElement

# deprecations from trac:18555
from sage.misc.superseded import deprecated_function_alias
CrystalOfRiggedConfigurations.global_options = deprecated_function_alias(18555, CrystalOfRiggedConfigurations.options)

Original file line number Diff line number Diff line change
Expand Up @@ -1912,8 +1912,3 @@ def from_virtual(self, vrc):
return self.element_class(self, partitions)

Element = KRRCTypeA2DualElement

# deprecations from trac:18555
from sage.misc.superseded import deprecated_function_alias
RiggedConfigurations.global_options=deprecated_function_alias(18555, RiggedConfigurations.options)
RiggedConfigurationOptions = deprecated_function_alias(18555, RiggedConfigurations.options)
6 changes: 0 additions & 6 deletions src/sage/combinat/root_system/cartan_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -3086,9 +3086,3 @@ def __setstate__(self, dict):
T = CartanType([dict['letter'], dict['n']])
self.__class__ = T.__class__
self.__dict__ = T.__dict__

# deprecations from trac:18555
from sage.misc.superseded import deprecated_function_alias
CartanTypeFactory.global_options = deprecated_function_alias(18555, CartanTypeFactory.options)
CartanTypeOptions = deprecated_function_alias(18555, CartanType.options)
CartanType_abstract.global_options = deprecated_function_alias(18555, CartanType.options)
4 changes: 0 additions & 4 deletions src/sage/combinat/skew_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,3 @@ def __iter__(self):

from sage.misc.persist import register_unpickle_override
register_unpickle_override('sage.combinat.skew_partition', 'SkewPartition_class', SkewPartition)

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
SkewPartitions.global_options=deprecated_function_alias(18555, SkewPartitions.options)
4 changes: 0 additions & 4 deletions src/sage/combinat/skew_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,3 @@ def __setstate__(self, state):
# July 2013: But wait, there more!
register_unpickle_override('sage.combinat.skew_tableau', 'StandardSkewTableaux_skewpartition', StandardSkewTableaux_shape)
register_unpickle_override('sage.combinat.skew_tableau', 'SkewTableau_class', SkewTableau_class)

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
SkewTableaux.global_options=deprecated_function_alias(18555, SkewTableaux.options)
5 changes: 0 additions & 5 deletions src/sage/combinat/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -9422,8 +9422,3 @@ def __contains__(self, x):
register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_p', SemistandardTableaux_shape)
register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_nmu', SemistandardTableaux_size_weight)
register_unpickle_override('sage.combinat.tableau', 'SemistandardTableaux_pmu', SemistandardTableaux_shape_weight)


# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
Tableaux.global_options=deprecated_function_alias(18555, Tableaux.options)
3 changes: 0 additions & 3 deletions src/sage/groups/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
'merge_points', 'structure_description'],
deprecation=(25785, "this is being removed from the global namespace"))

# deprecation(24256)
from sage.structure.element import generic_power as power

lazy_import('sage.groups.class_function', 'ClassFunction')

from .additive_abelian.all import *
Expand Down
3 changes: 0 additions & 3 deletions src/sage/groups/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@
multiplication_names = ( 'multiplication', 'times', 'product', '*')
addition_names = ( 'addition', 'plus', 'sum', '+')

# deprecation(24256)
from sage.structure.element import generic_power as power


def multiple(a, n, operation='*', identity=None, inverse=None, op=None):
r"""
Expand Down
6 changes: 0 additions & 6 deletions src/sage/manifolds/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -2713,9 +2713,3 @@ def Manifold(dim, name, latex_name=None, field='real', structure='smooth',


Manifold.options = TopologicalManifold.options

# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
Manifold.global_options=deprecated_function_alias(18555, TopologicalManifold.options)
ManifoldOptions = deprecated_function_alias(18555, TopologicalManifold.options)
TopologicalManifold.global_options=deprecated_function_alias(18555, TopologicalManifold.options)
20 changes: 3 additions & 17 deletions src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ cdef class CoercionModel:
- Robert Bradshaw
"""
def __init__(self, *args, **kwds):
def __init__(self):
"""
EXAMPLES::
Expand All @@ -500,18 +500,10 @@ cdef class CoercionModel:
sage: A = cm.get_action(ZZ, K, operator.mul)
sage: f, g = cm.coercion_maps(QQ, int)
sage: f, g = cm.coercion_maps(ZZ, int)
TESTS::
sage: cm = CoercionModel(4, .95)
doctest:...: DeprecationWarning: the 'lookup_dict_size' argument is deprecated
See http://trac.sagemath.org/24135 for details.
doctest:...: DeprecationWarning: the 'lookup_dict_threshold' argument is deprecated
See http://trac.sagemath.org/24135 for details.
"""
self.reset_cache(*args, **kwds)
self.reset_cache()

def reset_cache(self, lookup_dict_size=None, lookup_dict_threshold=None):
def reset_cache(self):
"""
Clear the coercion cache.
Expand All @@ -529,12 +521,6 @@ cdef class CoercionModel:
sage: cm.get_cache()
({}, {})
"""
if lookup_dict_size is not None:
from sage.misc.superseded import deprecation
deprecation(24135, "the 'lookup_dict_size' argument is deprecated")
if lookup_dict_threshold is not None:
from sage.misc.superseded import deprecation
deprecation(24135, "the 'lookup_dict_threshold' argument is deprecated")
# This MUST be a mapping of tuples, where each
# tuple contains at least two elements that are either
# None or of type Map.
Expand Down
52 changes: 0 additions & 52 deletions src/sage/structure/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4283,55 +4283,3 @@ def coerce_binop(method):
else:
return getattr(a, method.__name__)(b, *args, **kwargs)
return new_method
###############################################################################
def generic_power(a, n, one=None):
"""
Computes `a^n`, where `n` is an integer, and `a` is an object which
supports multiplication. Optionally an additional argument,
which is used in the case that ``n == 0``:
- ``one`` - the "unit" element, returned directly (can be anything)
If this is not supplied, ``int(1)`` is returned.
EXAMPLES::
sage: from sage.structure.element import generic_power
sage: generic_power(int(12),int(0))
doctest:...: DeprecationWarning: import 'generic_power' from sage.arith.power instead
See http://trac.sagemath.org/24256 for details.
1
sage: generic_power(int(0),int(100))
0
sage: generic_power(Integer(10),Integer(0))
1
sage: generic_power(Integer(0),Integer(23))
0
sage: sum(generic_power(2,i) for i in range(17)) #test all 4-bit combinations
doctest:...: DeprecationWarning: import 'generic_power' from sage.arith.power instead
See http://trac.sagemath.org/24256 for details.
131071
sage: F = Zmod(5)
sage: a = generic_power(F(2), 5); a
2
sage: a.parent() is F
True
sage: a = generic_power(F(1), 2)
sage: a.parent() is F
True
sage: generic_power(int(5), 0)
1
"""
from sage.misc.superseded import deprecation
deprecation(24256, "import 'generic_power' from sage.arith.power instead")
if one is not None:
# Special cases not handled by sage.arith.power
if not n:
return one
if n < 0:
return ~arith_generic_power(a, -n)
return arith_generic_power(a, n)
7 changes: 0 additions & 7 deletions src/sage/structure/global_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,10 +1692,3 @@ def _reset(self, option=None):
elif option in self._linked_value:
link, linked_opt=self._linked_value[option]
link._reset(linked_opt)


# Deprecations from trac:18555. July 2016
from sage.misc.superseded import deprecated_function_alias
GlobalOptions.default_value=deprecated_function_alias(18555, GlobalOptions._default_value)
GlobalOptions.dispatch=deprecated_function_alias(18555, GlobalOptions._dispatch)
GlobalOptions.reset=deprecated_function_alias(18555, GlobalOptions._reset)
2 changes: 0 additions & 2 deletions src/sage/structure/parent.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
cdef inline bint get_flag(self, int flag):
return self.flags & flag

cpdef bint _is_coercion_cached(self, domain)
cpdef bint _is_conversion_cached(self, domain)
cpdef register_coercion(self, mor)
cpdef register_action(self, action)
cpdef register_conversion(self, mor)
Expand Down
52 changes: 8 additions & 44 deletions src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1391,14 +1391,12 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
self.init_coerce(False)

if not unpickling:
if element_constructor is None:
try:
element_constructor = self._element_constructor_
except AttributeError:
raise RuntimeError("an _element_constructor_ method must be defined")
else:
from sage.misc.superseded import deprecation
deprecation(24363, "the 'element_constructor' keyword of _populate_coercion_lists_ is deprecated: override the _element_constructor_ method or define an Element attribute instead")
if element_constructor is not None:
raise ValueError("element_constructor can only be given when unpickling is True")
try:
element_constructor = self._element_constructor_
except AttributeError:
raise RuntimeError("an _element_constructor_ method must be defined")
self._element_constructor = element_constructor
self._element_init_pass_parent = guess_pass_parent(self, element_constructor)

Expand Down Expand Up @@ -1456,24 +1454,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
self._embedding = None
self._unset_coercions_used()

def is_coercion_cached(self, domain):
"""
Deprecated method
TESTS::
sage: Parent().is_coercion_cached(QQ)
doctest:warning
...
DeprecationWarning: is_coercion_cached is deprecated use _is_coercion_cached instead
See http://trac.sagemath.org/24254 for details.
False
"""
from sage.misc.superseded import deprecation
deprecation(24254, "is_coercion_cached is deprecated use _is_coercion_cached instead")
return self._is_coercion_cached(domain)

cpdef bint _is_coercion_cached(self, domain):
def _is_coercion_cached(self, domain):
r"""
Test whether the coercion from ``domain`` is already cached.
Expand All @@ -1488,24 +1469,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
"""
return domain in self._coerce_from_hash

def is_conversion_cached(self, domain):
"""
Deprecated method
TESTS::
sage: Parent().is_conversion_cached(QQ)
doctest:warning
...
DeprecationWarning: is_conversion_cached is deprecated use _is_conversion_cached instead
See http://trac.sagemath.org/24254 for details.
False
"""
from sage.misc.superseded import deprecation
deprecation(24254, "is_conversion_cached is deprecated use _is_conversion_cached instead")
return self._is_conversion_cached(domain)

cpdef bint _is_conversion_cached(self, domain):
def _is_conversion_cached(self, domain):
r"""
Test whether the conversion from ``domain`` is already set.
Expand Down
23 changes: 1 addition & 22 deletions src/sage/structure/parent_old.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,10 @@ cdef class Parent(parent.Parent):
def __cinit__(self):
self._has_coerce_map_from = MonoDict()

def __init__(self, coerce_from=None, actions=None, embeddings=None, *, category=None):
def __init__(self, *, category=None):
self.init_coerce(False)
if coerce_from is not None:
from sage.misc.superseded import deprecation
deprecation(24614, "the 'coerce_from' keyword is deprecated")
self._coerce_from_list = list(coerce_from)
self._coerce_from_hash = MonoDict()
if actions is not None:
from sage.misc.superseded import deprecation
deprecation(24614, "the 'actions' keyword is deprecated")
self._action_list = list(actions)

cdef parent.Parent other
if embeddings is not None:
from sage.misc.superseded import deprecation
deprecation(24614, "the 'embeddings' keyword is deprecated")
for mor in embeddings:
other = mor.domain()
print("embedding", self, " --> ", other)
print(mor)
other.init_coerce() # TODO remove when we can
other._coerce_from_list.append(mor)

self._set_element_constructor()

if category is not None:
self._init_category_(category)

Expand Down

0 comments on commit 596b12f

Please sign in to comment.