From 46f4fdc45d81559a40ab2ab13db70644f875582c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Thu, 4 Sep 2014 15:47:08 +0200 Subject: [PATCH 1/3] remove deprecated code --- src/sage/combinat/composition.py | 54 ------- src/sage/combinat/integer_list.py | 121 -------------- src/sage/combinat/integer_vector.py | 6 +- src/sage/combinat/partition.py | 148 +----------------- src/sage/combinat/partition_tuple.py | 7 +- src/sage/combinat/posets/posets.py | 33 +--- .../root_system/root_lattice_realizations.py | 23 --- src/sage/combinat/tableau.py | 69 -------- src/sage/graphs/graph.py | 30 ---- 9 files changed, 11 insertions(+), 480 deletions(-) diff --git a/src/sage/combinat/composition.py b/src/sage/combinat/composition.py index 70b4d09a02a..ee06bc7344d 100644 --- a/src/sage/combinat/composition.py +++ b/src/sage/combinat/composition.py @@ -1946,60 +1946,6 @@ def __iter__(self): for c in Compositions_n(self.n-i): yield self.element_class(self, [i]+list(c)) -def from_descents(descents, nps=None): - r""" - This has been deprecated in :trac:`14063`. Use - :meth:`Compositions.from_descents()` instead. - - EXAMPLES:: - - sage: [x-1 for x in Composition([1, 1, 3, 4, 3]).to_subset()] - [0, 1, 4, 8] - sage: sage.combinat.composition.from_descents([1,0,4,8],12) - doctest:...: DeprecationWarning: from_descents is deprecated. Use Compositions().from_descents instead. - See http://trac.sagemath.org/14063 for details. - [1, 1, 3, 4, 3] - """ - from sage.misc.superseded import deprecation - deprecation(14063, 'from_descents is deprecated. Use Compositions().from_descents instead.') - return Compositions().from_descents(descents, nps) - -def composition_from_subset(S, n): - r""" - This has been deprecated in :trac:`14063`. Use - :meth:`Compositions.from_subset()` instead. - - EXAMPLES:: - - sage: from sage.combinat.composition import composition_from_subset - sage: composition_from_subset([2,1,5,9], 12) - doctest:...: DeprecationWarning: composition_from_subset is deprecated. Use Compositions().from_subset instead. - See http://trac.sagemath.org/14063 for details. - [1, 1, 3, 4, 3] - """ - from sage.misc.superseded import deprecation - deprecation(14063, 'composition_from_subset is deprecated. Use Compositions().from_subset instead.') - return Compositions().from_subset(S, n) - -def from_code(code): - r""" - This has been deprecated in :trac:`14063`. Use - :meth:`Compositions.from_code()` instead. - - EXAMPLES:: - - sage: import sage.combinat.composition as composition - sage: Composition([4,1,2,3,5]).to_code() - [1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0] - sage: composition.from_code(_) - doctest:...: DeprecationWarning: from_code is deprecated. Use Compositions().from_code instead. - See http://trac.sagemath.org/14063 for details. - [4, 1, 2, 3, 5] - """ - from sage.misc.superseded import deprecation - deprecation(14063, 'from_code is deprecated. Use Compositions().from_code instead.') - return Compositions().from_code(code) - from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.composition', 'Composition_class', Composition) diff --git a/src/sage/combinat/integer_list.py b/src/sage/combinat/integer_list.py index 2b2297990e1..3ba62bcb705 100644 --- a/src/sage/combinat/integer_list.py +++ b/src/sage/combinat/integer_list.py @@ -367,127 +367,6 @@ def next(comp, min_length, max_length, floor, ceiling, min_slope, max_slope): res += f return res - -def iterator(n, min_length, max_length, floor, ceiling, min_slope, max_slope): - """ - .. WARNING:: - - INTERNAL FUNCTION! DO NOT USE DIRECTLY! - - EXAMPLES:: - - sage: from sage.combinat.integer_list import iterator - sage: IV = IntegerVectors(2,3,min_slope=0) - sage: params = IV._parameters() - sage: list(iterator(2,*params)) - [[0, 1, 1], [0, 0, 2]] - """ - #from sage.misc.superseded import deprecation - #deprecation(13605, 'iterator(...) is deprecated. Use IntegerListLex(...) instead.') - succ = lambda x: next(x, min_length, max_length, floor, ceiling, min_slope, max_slope) - - #Handle the case where n is a list of integers - if isinstance(n, __builtin__.list): - for i in range(n[0], min(n[1]+1,upper_bound(min_length, max_length, floor, ceiling, min_slope, max_slope))): - for el in iterator(i, min_length, max_length, floor, ceiling, min_slope, max_slope): - yield el - else: - f = first(n, min_length, max_length, floor, ceiling, min_slope, max_slope) - while not f is None: - yield f - f = succ(f) - -def list(n, min_length, max_length, floor, ceiling, min_slope, max_slope): - """ - .. WARNING:: - - THIS FUNCTION IS DEPRECATED! Use ``IntegersListsLex(...)`` instead. - - EXAMPLES:: - - sage: import sage.combinat.integer_list as integer_list - sage: g = lambda x: lambda i: x - sage: integer_list.list(0,0,infinity,g(1),g(infinity),0,infinity) - [[]] - sage: integer_list.list(0,0,infinity,g(1),g(infinity),0,0) - [[]] - sage: integer_list.list(0, 0, 0, g(1), g(infinity), 0, 0) - [[]] - sage: integer_list.list(0, 0, 0, g(0), g(infinity), 0, 0) - [[]] - sage: integer_list.list(0, 0, infinity, g(1), g(infinity), 0, infinity) - [[]] - sage: integer_list.list(1, 0, infinity, g(1), g(infinity), 0, infinity) - [[1]] - sage: integer_list.list(0, 1, infinity, g(1), g(infinity), 0, infinity) - [] - sage: integer_list.list(0, 1, infinity, g(0), g(infinity), 0, infinity) - [[0]] - sage: integer_list.list(3, 0, 2, g(0), g(infinity), -infinity, infinity) - [[3], [2, 1], [1, 2], [0, 3]] - sage: partitions = (0, infinity, g(0), g(infinity), -infinity, 0) - sage: partitions_min_2 = (0, infinity, g(2), g(infinity), -infinity, 0) - sage: compositions = (0, infinity, g(1), g(infinity), -infinity, infinity) - sage: integer_vectors = lambda l: (l, l, g(0), g(infinity), -infinity, infinity) - sage: lower_monomials = lambda c: (len(c), len(c), g(0), lambda i: c[i], -infinity, infinity) - sage: upper_monomials = lambda c: (len(c), len(c), g(0), lambda i: c[i], -infinity, infinity) - sage: constraints = (0, infinity, g(1), g(infinity), -1, 0) - sage: integer_list.list(6, *partitions) - [[6], - [5, 1], - [4, 2], - [4, 1, 1], - [3, 3], - [3, 2, 1], - [3, 1, 1, 1], - [2, 2, 2], - [2, 2, 1, 1], - [2, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1]] - sage: integer_list.list(6, *constraints) - [[6], - [3, 3], - [3, 2, 1], - [2, 2, 2], - [2, 2, 1, 1], - [2, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1]] - sage: integer_list.list(1, *partitions_min_2) - [] - sage: integer_list.list(2, *partitions_min_2) - [[2]] - sage: integer_list.list(3, *partitions_min_2) - [[3]] - sage: integer_list.list(4, *partitions_min_2) - [[4], [2, 2]] - sage: integer_list.list(5, *partitions_min_2) - [[5], [3, 2]] - sage: integer_list.list(6, *partitions_min_2) - [[6], [4, 2], [3, 3], [2, 2, 2]] - sage: integer_list.list(7, *partitions_min_2) - [[7], [5, 2], [4, 3], [3, 2, 2]] - sage: integer_list.list(9, *partitions_min_2) - [[9], [7, 2], [6, 3], [5, 4], [5, 2, 2], [4, 3, 2], [3, 3, 3], [3, 2, 2, 2]] - sage: integer_list.list(10, *partitions_min_2) - [[10], - [8, 2], - [7, 3], - [6, 4], - [6, 2, 2], - [5, 5], - [5, 3, 2], - [4, 4, 2], - [4, 3, 3], - [4, 2, 2, 2], - [3, 3, 2, 2], - [2, 2, 2, 2, 2]] - sage: integer_list.list(4, *compositions) - [[4], [3, 1], [2, 2], [2, 1, 1], [1, 3], [1, 2, 1], [1, 1, 2], [1, 1, 1, 1]] - """ - #from sage.misc.superseded import deprecation - #deprecation(13605, 'list(...) is deprecated. Use list(IntegerListLex(...) instead.') - return __builtin__.list(iterator(n, min_length, max_length, floor, ceiling, min_slope, max_slope)) - def upper_regular(comp, min_slope, max_slope): """ Return the uppest regular composition above ``comp``. diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index d78447c0a35..fcf825978d5 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -1058,7 +1058,11 @@ def __iter__(self): sage: all(map(lambda x: x.cardinality() == len(x.list()), iv)) True """ - return integer_list.iterator(self.n, *self._parameters()) + succ = lambda x: integer_list.next(x, *self._parameters()) + f = integer_list.first(self.n, *self._parameters()) + while not f is None: + yield f + f = succ(f) class IntegerVectors_nconstraints(IntegerVectors_nkconstraints): def __init__(self, n, constraints): diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 72e9dbf9871..e5cdf8f8f9b 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -411,70 +411,6 @@ notation = dict(alt_name='convention') ) -def from_frobenius_coordinates(coords): - """ - This function has been deprecated in :trac:`13605`. Use - :meth:`Partitions.from_frobenius_coordinates()` instead. - - EXAMPLES:: - - sage: sage.combinat.partition.from_frobenius_coordinates(([],[])) - doctest:...: DeprecationWarning: from_frobenius_coordinates is deprecated. Use Partitions().from_frobenius_coordinates instead. - See http://trac.sagemath.org/13605 for details. - [] - """ - from sage.misc.superseded import deprecation - deprecation(13605, 'from_frobenius_coordinates is deprecated. Use Partitions().from_frobenius_coordinates instead.') - return _Partitions.from_frobenius_coordinates(coords) - -def from_beta_numbers(beta): - """ - This function has been deprecated in :trac:`13605`. Use - :meth:`Partitions.from_beta_numbers()` instead. - - EXAMPLES:: - - sage: sage.combinat.partition.from_beta_numbers([0,1,2,4,5,8]) - doctest:...: DeprecationWarning: from_beta_numbers is deprecated. Use Partitions().from_beta_numbers instead. - See http://trac.sagemath.org/13605 for details. - [3, 1, 1] - """ - from sage.misc.superseded import deprecation - deprecation(13605, 'from_beta_numbers is deprecated. Use Partitions().from_beta_numbers instead.') - return _Partitions.from_beta_numbers(beta) - -def from_exp(exp): - """ - This has been deprecated in :trac:`13605`. Use - :meth:`Partitions.from_exp()` instead. - - EXAMPLES:: - - sage: sage.combinat.partition.from_exp([2,2,1]) - doctest:...: DeprecationWarning: from_exp is deprecated. Use Partitions().from_exp instead. - See http://trac.sagemath.org/13605 for details. - [3, 2, 2, 1, 1] - """ - from sage.misc.superseded import deprecation - deprecation(13605, 'from_exp is deprecated. Use Partitions().from_exp instead.') - return _Partitions.from_exp(exp) - -def from_core_and_quotient(core, quotient): - """ - This has been deprecated in :trac:`13605`. Use - :meth:`Partitions.from_core_and_quotient()` instead. - - EXAMPLES:: - - sage: sage.combinat.partition.from_core_and_quotient([2,1], [[2,1],[3],[1,1,1]]) - doctest:...: DeprecationWarning: from_core_and_quotient is deprecated. Use Partitions().from_core_and_quotient instead. - See http://trac.sagemath.org/13605 for details. - [11, 5, 5, 3, 2, 2, 2] - """ - from sage.misc.superseded import deprecation - deprecation(13605, 'from_core_and_quotient is deprecated. Use Partitions().from_core_and_quotient instead.') - return _Partitions.from_core_and_quotient(core, quotient) - class Partition(CombinatorialObject, Element): r""" A partition `p` of a nonnegative integer `n` is a @@ -706,7 +642,7 @@ def __init__(self, parent, mu): else: raise ValueError("%s is not a valid partition"%repr(mu)) - def _repr_(self, compact=False): + def _repr_(self): r""" Return a string representation of ``self`` depending on :meth:`Partitions.global_options`. @@ -770,12 +706,6 @@ def _repr_(self, compact=False): sage: Partitions.global_options.reset() """ - - if compact != False: - from sage.misc.superseded import deprecation - deprecation(13605, 'compact option is deprecated. Use :meth:`Partitions.global_options` instead.') - return self._repr_compact_high() - return self.parent().global_options.dispatch(self, '_repr_', 'display') def _ascii_art_(self): @@ -2739,21 +2669,6 @@ def attacking_pairs(self): return attacking_pairs - def dominate(self, rows=None): - """ - Old name for :meth:`dominated_partitions()`. - - EXAMPLES:: - - sage: Partition([3,2,1]).dominate() - doctest:...: DeprecationWarning: dominate is deprecated. Use dominated_partitions instead. - See http://trac.sagemath.org/13605 for details. - [[3, 2, 1], [3, 1, 1, 1], [2, 2, 2], [2, 2, 1, 1], [2, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]] - """ - from sage.misc.superseded import deprecation - deprecation(13605, 'dominate is deprecated. Use dominated_partitions instead.') - return self.dominated_partitions(rows) - def dominated_partitions(self, rows=None): """ Return a list of the partitions dominated by `n`. If ``rows`` is @@ -6458,22 +6373,6 @@ def list(self): return [self.element_class(self, [x for x in p if x!=0]) for p in l] -def PartitionsInBox_hw(h, w): - """ - For unpickling ``PartitionsInBox_hw`` objects created before - :trac:`13605`. See :class:`OrderedPartitions`. - - EXAMPLES:: - - sage: sage.combinat.partition.PartitionsInBox_hw(3, 2) - doctest:...: DeprecationWarning: this class is deprecated. Use PartitionsInBox instead - See http://trac.sagemath.org/13605 for details. - Integer partitions which fit in a 3 x 2 box - """ - from sage.misc.superseded import deprecation - deprecation(13605,'this class is deprecated. Use PartitionsInBox instead') - return PartitionsInBox(h, w) - class Partitions_constraints(IntegerListsLex): """ For unpickling old constrained ``Partitions_constraints`` objects created @@ -6644,22 +6543,6 @@ def cardinality(self): ans=gap.eval("NrOrderedPartitions(%s,%s)"%(n,k)) return ZZ(ans) -def OrderedPartitions_nk(n, k): - """ - For unpickling ``OrderedPartitions_nk`` objects created before - :trac:`13605`. See :class:`OrderedPartitions`. - - EXAMPLES:: - - sage: sage.combinat.partition.OrderedPartitions_nk(3, 2) - doctest:...: DeprecationWarning: this class is deprecated. Use OrderedPartitions instead - See http://trac.sagemath.org/13605 for details. - Ordered partitions of 3 of length 2 - """ - from sage.misc.superseded import deprecation - deprecation(13605,'this class is deprecated. Use OrderedPartitions instead') - return OrderedPartitions(n, k) - ########################## # Partitions Greatest LE # ########################## @@ -6718,22 +6601,6 @@ def _repr_(self): Element = Partition global_options = PartitionOptions -def PartitionsGreatestLE_nk(n, k): - """ - For unpickling ``PartitionsGreatestLE`` objects created with sage <= 3.4.1. - See :class:`PartitionsGreatestLE`. - - EXAMPLES:: - - sage: sage.combinat.partition.PartitionsGreatestLE_nk(10, 2) - doctest:...: DeprecationWarning: this class is deprecated. Use PartitionsGreatestLE instead - See http://trac.sagemath.org/13605 for details. - Partitions of 10 having parts less than or equal to 2 - """ - from sage.misc.superseded import deprecation - deprecation(13605,'this class is deprecated. Use PartitionsGreatestLE instead') - return PartitionsGreatestLE(n, k) - ########################## # Partitions Greatest EQ # ########################## @@ -6793,19 +6660,6 @@ def _repr_(self): Element = Partition global_options = PartitionOptions -def PartitionsGreatestEQ_nk(n, k): - """ - EXAMPLES:: - - sage: sage.combinat.partition.PartitionsGreatestEQ_nk(10, 2) - doctest:...: DeprecationWarning: this class is deprecated. Use PartitionsGreatestEQ instead - See http://trac.sagemath.org/13605 for details. - Partitions of 10 having greatest part equal to 2 - """ - from sage.misc.superseded import deprecation - deprecation(13605,'this class is deprecated. Use PartitionsGreatestEQ instead') - return PartitionsGreatestEQ(n, k) - ######################### # Restricted Partitions # ######################### diff --git a/src/sage/combinat/partition_tuple.py b/src/sage/combinat/partition_tuple.py index 306dab15059..2e807f20c25 100644 --- a/src/sage/combinat/partition_tuple.py +++ b/src/sage/combinat/partition_tuple.py @@ -484,7 +484,7 @@ def __len__(self): """ return self.level() - def _repr_(self, compact=False): + def _repr_(self): """ Return a string representation of ``self`` depending on :meth:`PartitionTuples.global_options`. @@ -526,11 +526,6 @@ def _repr_(self, compact=False): 2, 1 | 3, 2 | 1^3 sage: PartitionTuples.global_options.reset() """ - if compact: - from sage.misc.superseded import deprecation - deprecation(13605, 'compact option is deprecated. Use PartitionTuples.global_options instead.') - return self._repr_compact_high() - return self.parent().global_options.dispatch(self, '_repr_', 'display') def _repr_diagram(self): diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 3a328f372e9..35647d46062 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -995,27 +995,12 @@ def _element_constructor_(self, element): sage: Q(5) 5 - Accessing the n-th element of ``self`` as ``P(i)`` is deprecated:: + Accessing the i-th element of ``self`` as ``P[i]``:: - sage: P(5) == P(-1) - doctest:...: DeprecationWarning: Accessing the i-th element of a poset as P(i) is deprecated. Please use P[i] - See http://trac.sagemath.org/13109 for details. + sage: P = FinitePoset(DiGraph({'a':['b','c'], 'b':['d'], 'c':['d'], 'd':[]}), facade = False) + sage: P('a') == P[0] True - sage: Q(5) == Q(-1) - True - sage: R = FinitePoset(DiGraph({'a':['b','c'], 'b':['d'], 'c':['d'], 'd':[]}), facade = False) - sage: R(0) - a - sage: R('a') == R(0) - True - sage: R('d') == R(-1) - True - - Please use instead ``P[i]``:: - - sage: R('a') == R[0] - True - sage: R('d') == R[-1] + sage: P('d') == P[-1] True TESTS:: @@ -1030,16 +1015,6 @@ def _element_constructor_(self, element): try: return self._list[self._element_to_vertex_dict[element]] except KeyError: - if isinstance(element,Integer): - from sage.misc.superseded import deprecation - deprecation(13109, "Accessing the i-th element of a poset as P(i) is deprecated. Please use P[i]") - if element > -1: - return self.element_class(self, \ - self._elements[element], element) - else: - return self.element_class(self, \ - self._elements[element], self.cardinality()+element) - else: raise ValueError("%s is not an element of this poset"%type(element)) def __call__(self, element): diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index d463b76de21..20a1902c0e9 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -1596,29 +1596,6 @@ def simple_projections(self, to_negative=True): res.rename("pi") return res - @lazy_attribute - def pi(self): - r""" - The simple projections of ``self`` - - .. seealso:: :meth:`simple_projections` - - .. warning:: this shortcut is deprecated - - EXAMPLES:: - - sage: space = RootSystem(['A',2]).weight_lattice() - sage: pi = space.pi - sage: x = space.simple_roots() - sage: pi[1](x[2]) - -Lambda[1] + 2*Lambda[2] - """ - # _test_not_implemented_methods apparently evaluates all lazy - # attributes, which means that we can't use deprecation here! - # from sage.misc.superseded import deprecation - # deprecation(trac_number, "The lazy attribute pi is deprecated; please use the simple_projections method.") - return self.simple_projections() - ########################################################################## # Weyl group ########################################################################## diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 1f5643d492b..934192a1fde 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -1748,74 +1748,6 @@ def anti_restrict(self, n): from sage.combinat.skew_tableau import SkewTableau return SkewTableau(t) - def up(self): - """ - Deprecated in :trac:`7983` since this is an operation on standard - tableaux. - - EXAMPLES:: - - sage: t = Tableau([[1,2]]) - sage: [x for x in t.up()] - doctest:...: DeprecationWarning: Tableau.up() is deprecated since it is an operation on standard tableaux. - See http://trac.sagemath.org/7983 for details. - [[[1, 2, 3]], [[1, 2], [3]]] - """ - from sage.misc.superseded import deprecation - deprecation(7983,'Tableau.up() is deprecated since it is an operation on standard tableaux.') - return StandardTableau(self).up() - - def up_list(self): - """ - Deprecated in :trac:`7983` since this is an operation on standard - tableaux. - - EXAMPLES:: - - sage: t = Tableau([[1,2]]) - sage: t.up_list() - doctest:...: DeprecationWarning: Tableau.up_list() is deprecated since it is an operation on standard tableaux. - See http://trac.sagemath.org/7983 for details. - [[[1, 2, 3]], [[1, 2], [3]]] - """ - from sage.misc.superseded import deprecation - deprecation(7983,'Tableau.up_list() is deprecated since it is an operation on standard tableaux.') - return StandardTableau(self).up_list() - - def down(self): - """ - Deprecated in :trac:`7983` since this is an operation on standard - tableaux. - - EXAMPLES:: - - sage: t = Tableau([[1,2],[3]]) - sage: [x for x in t.down()] - doctest:...: DeprecationWarning: Tableau.down() is deprecated since it is an operation on standard tableaux. - See http://trac.sagemath.org/7983 for details. - [[[1, 2]]] - """ - from sage.misc.superseded import deprecation - deprecation(7983,'Tableau.down() is deprecated since it is an operation on standard tableaux.') - return StandardTableau(self).down() - - def down_list(self): - """ - Deprecated in :trac:`7983` since this is an operation on standard - tableaux. - - EXAMPLES:: - - sage: t = Tableau([[1,2],[3]]) - sage: t.down_list() - doctest:...: DeprecationWarning: Tableau.down_list() is deprecated since it is an operation on standard tableaux. - See http://trac.sagemath.org/7983 for details. - [[[1, 2]]] - """ - from sage.misc.superseded import deprecation - deprecation(7983,'Tableau.down_list() is deprecated since it is an operation on standard tableaux.') - return StandardTableau(self).down_list() - def to_list(self): """ EXAMPLES:: @@ -3775,7 +3707,6 @@ def from_chain(chain): res[j][k] = i -1 return Tableau(res) -@rename_keyword(deprecation=13605, order='convention') def from_shape_and_word(shape, w, convention="French"): r""" Returns a tableau from a shape and word. diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index f9e8feaf2bd..1a4ae8d0521 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -6854,33 +6854,3 @@ def ihara_zeta_function_inverse(self): from sage.graphs.tutte_polynomial import tutte_polynomial Graph.tutte_polynomial = tutte_polynomial - -def compare_edges(x, y): - """ - This function has been deprecated. - - Compare edge x to edge y, return -1 if x y, 1 if x y, else 0. - - TEST:: - - sage: G = graphs.PetersenGraph() - sage: E = G.edges() - sage: from sage.graphs.graph import compare_edges - sage: compare_edges(E[0], E[2]) - doctest:...: DeprecationWarning: compare_edges(x,y) is deprecated. Use statement 'cmp(x[1],y[1]) or cmp(x[0],y[0])' instead. - See http://trac.sagemath.org/13192 for details. - -1 - """ - from sage.misc.superseded import deprecation - deprecation(13192, "compare_edges(x,y) is deprecated. Use statement 'cmp(x[1],y[1]) or cmp(x[0],y[0])' instead.") - if x[1] < y[1]: - return -1 - elif x[1] > y[1]: - return 1 - elif x[1] == y[1]: - if x[0] < y[0]: - return -1 - if x[0] > y[0]: - return 1 - else: - return 0 From ea330d3c88c9a64e504cfb63652856964f79b119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Thu, 4 Sep 2014 19:27:36 +0200 Subject: [PATCH 2/3] revert remove of iterator() and list() --- src/sage/combinat/integer_list.py | 121 ++++++++++++++++++++++++++++ src/sage/combinat/integer_vector.py | 6 +- 2 files changed, 122 insertions(+), 5 deletions(-) diff --git a/src/sage/combinat/integer_list.py b/src/sage/combinat/integer_list.py index 3ba62bcb705..2b2297990e1 100644 --- a/src/sage/combinat/integer_list.py +++ b/src/sage/combinat/integer_list.py @@ -367,6 +367,127 @@ def next(comp, min_length, max_length, floor, ceiling, min_slope, max_slope): res += f return res + +def iterator(n, min_length, max_length, floor, ceiling, min_slope, max_slope): + """ + .. WARNING:: + + INTERNAL FUNCTION! DO NOT USE DIRECTLY! + + EXAMPLES:: + + sage: from sage.combinat.integer_list import iterator + sage: IV = IntegerVectors(2,3,min_slope=0) + sage: params = IV._parameters() + sage: list(iterator(2,*params)) + [[0, 1, 1], [0, 0, 2]] + """ + #from sage.misc.superseded import deprecation + #deprecation(13605, 'iterator(...) is deprecated. Use IntegerListLex(...) instead.') + succ = lambda x: next(x, min_length, max_length, floor, ceiling, min_slope, max_slope) + + #Handle the case where n is a list of integers + if isinstance(n, __builtin__.list): + for i in range(n[0], min(n[1]+1,upper_bound(min_length, max_length, floor, ceiling, min_slope, max_slope))): + for el in iterator(i, min_length, max_length, floor, ceiling, min_slope, max_slope): + yield el + else: + f = first(n, min_length, max_length, floor, ceiling, min_slope, max_slope) + while not f is None: + yield f + f = succ(f) + +def list(n, min_length, max_length, floor, ceiling, min_slope, max_slope): + """ + .. WARNING:: + + THIS FUNCTION IS DEPRECATED! Use ``IntegersListsLex(...)`` instead. + + EXAMPLES:: + + sage: import sage.combinat.integer_list as integer_list + sage: g = lambda x: lambda i: x + sage: integer_list.list(0,0,infinity,g(1),g(infinity),0,infinity) + [[]] + sage: integer_list.list(0,0,infinity,g(1),g(infinity),0,0) + [[]] + sage: integer_list.list(0, 0, 0, g(1), g(infinity), 0, 0) + [[]] + sage: integer_list.list(0, 0, 0, g(0), g(infinity), 0, 0) + [[]] + sage: integer_list.list(0, 0, infinity, g(1), g(infinity), 0, infinity) + [[]] + sage: integer_list.list(1, 0, infinity, g(1), g(infinity), 0, infinity) + [[1]] + sage: integer_list.list(0, 1, infinity, g(1), g(infinity), 0, infinity) + [] + sage: integer_list.list(0, 1, infinity, g(0), g(infinity), 0, infinity) + [[0]] + sage: integer_list.list(3, 0, 2, g(0), g(infinity), -infinity, infinity) + [[3], [2, 1], [1, 2], [0, 3]] + sage: partitions = (0, infinity, g(0), g(infinity), -infinity, 0) + sage: partitions_min_2 = (0, infinity, g(2), g(infinity), -infinity, 0) + sage: compositions = (0, infinity, g(1), g(infinity), -infinity, infinity) + sage: integer_vectors = lambda l: (l, l, g(0), g(infinity), -infinity, infinity) + sage: lower_monomials = lambda c: (len(c), len(c), g(0), lambda i: c[i], -infinity, infinity) + sage: upper_monomials = lambda c: (len(c), len(c), g(0), lambda i: c[i], -infinity, infinity) + sage: constraints = (0, infinity, g(1), g(infinity), -1, 0) + sage: integer_list.list(6, *partitions) + [[6], + [5, 1], + [4, 2], + [4, 1, 1], + [3, 3], + [3, 2, 1], + [3, 1, 1, 1], + [2, 2, 2], + [2, 2, 1, 1], + [2, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1]] + sage: integer_list.list(6, *constraints) + [[6], + [3, 3], + [3, 2, 1], + [2, 2, 2], + [2, 2, 1, 1], + [2, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1]] + sage: integer_list.list(1, *partitions_min_2) + [] + sage: integer_list.list(2, *partitions_min_2) + [[2]] + sage: integer_list.list(3, *partitions_min_2) + [[3]] + sage: integer_list.list(4, *partitions_min_2) + [[4], [2, 2]] + sage: integer_list.list(5, *partitions_min_2) + [[5], [3, 2]] + sage: integer_list.list(6, *partitions_min_2) + [[6], [4, 2], [3, 3], [2, 2, 2]] + sage: integer_list.list(7, *partitions_min_2) + [[7], [5, 2], [4, 3], [3, 2, 2]] + sage: integer_list.list(9, *partitions_min_2) + [[9], [7, 2], [6, 3], [5, 4], [5, 2, 2], [4, 3, 2], [3, 3, 3], [3, 2, 2, 2]] + sage: integer_list.list(10, *partitions_min_2) + [[10], + [8, 2], + [7, 3], + [6, 4], + [6, 2, 2], + [5, 5], + [5, 3, 2], + [4, 4, 2], + [4, 3, 3], + [4, 2, 2, 2], + [3, 3, 2, 2], + [2, 2, 2, 2, 2]] + sage: integer_list.list(4, *compositions) + [[4], [3, 1], [2, 2], [2, 1, 1], [1, 3], [1, 2, 1], [1, 1, 2], [1, 1, 1, 1]] + """ + #from sage.misc.superseded import deprecation + #deprecation(13605, 'list(...) is deprecated. Use list(IntegerListLex(...) instead.') + return __builtin__.list(iterator(n, min_length, max_length, floor, ceiling, min_slope, max_slope)) + def upper_regular(comp, min_slope, max_slope): """ Return the uppest regular composition above ``comp``. diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index fcf825978d5..d78447c0a35 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -1058,11 +1058,7 @@ def __iter__(self): sage: all(map(lambda x: x.cardinality() == len(x.list()), iv)) True """ - succ = lambda x: integer_list.next(x, *self._parameters()) - f = integer_list.first(self.n, *self._parameters()) - while not f is None: - yield f - f = succ(f) + return integer_list.iterator(self.n, *self._parameters()) class IntegerVectors_nconstraints(IntegerVectors_nkconstraints): def __init__(self, n, constraints): From cf77bc2db234bee09524cdcacb5d8f7777ef6341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Mon, 13 Oct 2014 23:42:02 +0200 Subject: [PATCH 3/3] deprecate compact argument --- src/sage/combinat/partition.py | 6 +++++- src/sage/combinat/partition_tuple.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 6356150783a..b83f7a50d5f 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -642,7 +642,7 @@ def __init__(self, parent, mu): else: raise ValueError("%s is not a valid partition"%repr(mu)) - def _repr_(self): + def _repr_(self, compact=None): r""" Return a string representation of ``self`` depending on :meth:`Partitions.global_options`. @@ -706,6 +706,10 @@ def _repr_(self): sage: Partitions.global_options.reset() """ + if compact is not None: + from sage.misc.superseded import deprecation + deprecation(16933, 'compact argument is deprecated.') + return self.parent().global_options.dispatch(self, '_repr_', 'display') def _ascii_art_(self): diff --git a/src/sage/combinat/partition_tuple.py b/src/sage/combinat/partition_tuple.py index 2e807f20c25..f6daac7adf0 100644 --- a/src/sage/combinat/partition_tuple.py +++ b/src/sage/combinat/partition_tuple.py @@ -484,7 +484,7 @@ def __len__(self): """ return self.level() - def _repr_(self): + def _repr_(self, compact=None): """ Return a string representation of ``self`` depending on :meth:`PartitionTuples.global_options`. @@ -526,6 +526,10 @@ def _repr_(self): 2, 1 | 3, 2 | 1^3 sage: PartitionTuples.global_options.reset() """ + if compact is not None: + from sage.misc.superseded import deprecation + deprecation(16933, 'compact argument is deprecated.') + return self.parent().global_options.dispatch(self, '_repr_', 'display') def _repr_diagram(self):