本文整理汇总了Python中sage.misc.superseded.deprecation函数的典型用法代码示例。如果您正苦于以下问题:Python deprecation函数的具体用法?Python deprecation怎么用?Python deprecation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: sort
def sort(self, cmp=None, key=None, reverse=False):
"""
Sort this list *IN PLACE*.
INPUT:
- ``key`` - see Python ``list sort``
- ``reverse`` - see Python ``list sort``
- ``cmp`` - see Python ``list sort`` (deprecated)
Because ``cmp`` is not allowed in Python3, it must be avoided.
EXAMPLES::
sage: B = Sequence([3,2,1/5])
sage: B.sort()
sage: B
[1/5, 2, 3]
sage: B.sort(reverse=True); B
[3, 2, 1/5]
TESTS::
sage: B.sort(cmp = lambda x,y: cmp(y,x)); B
doctest:...: DeprecationWarning: sorting using cmp is deprecated
See http://trac.sagemath.org/21376 for details.
[3, 2, 1/5]
"""
if cmp is not None:
from sage.misc.superseded import deprecation
deprecation(21376, 'sorting using cmp is deprecated')
self._require_mutable()
list.sort(self, cmp=cmp, key=key, reverse=reverse)
开发者ID:mcognetta,项目名称:sage,代码行数:35,代码来源:sequence.py
示例2: from_rank
def from_rank(r, n, k):
r"""
Returns the combination of rank ``r`` in the subsets of ``range(n)`` of
size ``k`` when listed in lexicographic order.
The algorithm used is based on combinadics and James McCaffrey's
MSDN article. See :wikipedia:`Combinadic`.
EXAMPLES::
sage: import sage.combinat.choose_nk as choose_nk
sage: choose_nk.from_rank(0,3,0)
doctest:...: DeprecationWarning: choose_nk.from_rank is deprecated and will be removed. Use combination.from_rank instead
See http://trac.sagemath.org/18674 for details.
()
sage: choose_nk.from_rank(0,3,1)
(0,)
sage: choose_nk.from_rank(1,3,1)
(1,)
sage: choose_nk.from_rank(2,3,1)
(2,)
sage: choose_nk.from_rank(0,3,2)
(0, 1)
sage: choose_nk.from_rank(1,3,2)
(0, 2)
sage: choose_nk.from_rank(2,3,2)
(1, 2)
sage: choose_nk.from_rank(0,3,3)
(0, 1, 2)
"""
from sage.misc.superseded import deprecation
deprecation(18674, "choose_nk.from_rank is deprecated and will be removed. Use combination.from_rank instead")
return combination.from_rank(r, n, k)
开发者ID:vbraun,项目名称:sage,代码行数:33,代码来源:choose_nk.py
示例3: quit
def quit(self, verbose=False, timeout=None):
"""
Quit the running subprocess.
INPUT:
- ``verbose`` -- (boolean, default ``False``) print a message
when quitting this process?
EXAMPLES::
sage: a = maxima('y')
sage: maxima.quit(verbose=True)
Exiting Maxima with PID ... running .../local/bin/maxima ...
sage: a._check_valid()
Traceback (most recent call last):
...
ValueError: The maxima session in which this object was defined is no longer running.
Calling ``quit()`` a second time does nothing::
sage: maxima.quit(verbose=True)
"""
if timeout is not None:
from sage.misc.superseded import deprecation
deprecation(17686, 'the timeout argument to quit() is deprecated and ignored')
if self._expect is not None:
if verbose:
if self.is_remote():
print "Exiting %r (running on %s)"%(self._expect, self._server)
else:
print "Exiting %r"%(self._expect,)
self._expect.close()
self._reset_expect()
开发者ID:Findstat,项目名称:sage,代码行数:34,代码来源:expect.py
示例4: nth_iterate
def nth_iterate(self, f, n, normalize=False):
r"""
For a map of this point and a point `P` in ``self.domain()``
this function returns the nth iterate of `P` by this point.
If ``normalize == True``,
then the coordinates are automatically normalized.
INPUT:
- ``f`` -- a ProductProjectiveSpaces_morphism_ring with ``self`` in ``f.domain()``.
- ``n`` -- a positive integer.
- ``normalize`` -- Boolean (optional Default: ``False``).
OUTPUT:
- A point in ``self.codomain()``
EXAMPLES::
sage: Z.<a,b,x,y> = ProductProjectiveSpaces([1, 1], ZZ)
sage: f = DynamicalSystem_projective([a*b, b^2, x^3 - y^3, y^2*x], domain=Z)
sage: P = Z([2, 6, 2, 4])
sage: P.nth_iterate(f, 2, normalize = True)
doctest:warning
...
(1 : 3 , 407 : 112)
.. TODO:: Is there a more efficient way to do this?
"""
from sage.misc.superseded import deprecation
deprecation(23479, "use f.nth_iterate(P, n, normalize) instead")
return f.nth_iterate(self, n, normalize)
开发者ID:saraedum,项目名称:sage-renamed,代码行数:35,代码来源:point.py
示例5: CombinatorialLogarithmSeries
def CombinatorialLogarithmSeries(R=QQ):
r"""
Return the cycle index series of the virtual species `\Omega`, the compositional inverse
of the species `E^{+}` of nonempty sets.
The notion of virtual species is treated thoroughly in [BLL]_. The specific algorithm used
here to compute the cycle index of `\Omega` is found in [Labelle]_.
EXAMPLES:
The virtual species `\Omega` is 'properly virtual', in the sense that its cycle index
has negative coefficients::
sage: from sage.combinat.species.combinatorial_logarithm import CombinatorialLogarithmSeries
sage: CombinatorialLogarithmSeries().coefficients(4)
doctest:...: DeprecationWarning: CombinatorialLogarithmSeries is deprecated, use CycleIndexSeriesRing(R).logarithm_series() or CycleIndexSeries().logarithm() instead
See http://trac.sagemath.org/14846 for details.
[0, p[1], -1/2*p[1, 1] - 1/2*p[2], 1/3*p[1, 1, 1] - 1/3*p[3]]
Its defining property is that `\Omega \circ E^{+} = E^{+} \circ \Omega = X` (that is, that
composition with `E^{+}` in both directions yields the multiplicative identity `X`)::
sage: Eplus = sage.combinat.species.set_species.SetSpecies(min=1).cycle_index_series()
sage: CombinatorialLogarithmSeries().compose(Eplus).coefficients(4)
[0, p[1], 0, 0]
"""
deprecation(14846, "CombinatorialLogarithmSeries is deprecated, use CycleIndexSeriesRing(R).logarithm_series() or CycleIndexSeries().logarithm() instead")
return LogarithmCycleIndexSeries(R)
开发者ID:Babyll,项目名称:sage,代码行数:28,代码来源:combinatorial_logarithm.py
示例6: magic_transformer
def magic_transformer(line):
r"""
Handle input lines that start out like ``load ...`` or ``attach
...``.
Since there are objects in the Sage namespace named ``load`` and
``attach``, IPython's automagic will not transform these lines
into ``%load ...`` and ``%attach ...``, respectively. Thus, we
have to do it manually.
EXAMPLES::
sage: from sage.misc.interpreter import get_test_shell, magic_transformer
sage: mt = magic_transformer()
sage: mt.push('load /path/to/file')
doctest:...: DeprecationWarning: Use %runfile instead of load.
See http://trac.sagemath.org/12719 for details.
'%runfile /path/to/file'
sage: mt.push('attach /path/to/file')
doctest:...: DeprecationWarning: Use %attach instead of attach.
See http://trac.sagemath.org/12719 for details.
'%attach /path/to/file'
sage: mt.push('time 1+2')
doctest:...: DeprecationWarning: Use %time instead of time.
See http://trac.sagemath.org/12719 for details.
'%time 1+2'
"""
global _magic_deprecations
for old,new in _magic_deprecations.items():
if line.startswith(old+' '):
from sage.misc.superseded import deprecation
deprecation(12719, 'Use %s instead of %s.'%(new,old))
return new+line[len(old):]
return line
开发者ID:jeromeca,项目名称:sagesmc,代码行数:34,代码来源:interpreter.py
示例7: points_from_gap
def points_from_gap(self):
"""
Literally pushes this block design over to GAP and returns the
points of that. Other than debugging, usefulness is unclear.
REQUIRES: GAP's Design package.
EXAMPLES::
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]])
sage: BD.points_from_gap() # optional - gap_packages (design package)
doctest:1: DeprecationWarning: Unless somebody protests this method will be removed, as nobody seems to know why it is there.
See http://trac.sagemath.org/14499 for details.
[1, 2, 3, 4, 5, 6, 7]
"""
from sage.misc.superseded import deprecation
deprecation(14499, ('Unless somebody protests this method will be '
'removed, as nobody seems to know why it is there.'))
from sage.interfaces.gap import gap, GapElement
from sage.sets.set import Set
gap.load_package("design")
gD = self._gap_()
gP = gap.eval("BlockDesignPoints("+gD+")").replace("..",",")
return range(eval(gP)[0],eval(gP)[1]+1)
开发者ID:CETHop,项目名称:sage,代码行数:25,代码来源:incidence_structures.py
示例8: load
def load(filename, bzip2=False, gzip=False):
"""
load(filename):
Loads an object from filename and returns it.
INPUT:
filename -- a string that defines a valid file. If the
file doesn't exist then an IOError exception is raised.
OUTPUT:
An almost arbitrary object.
"""
from sage.misc.superseded import deprecation
deprecation(17653, 'The sage.misc.db module is deprecated, use the load/save functions from sage.structure.sage_object instead')
if bzip2:
os.system("bunzip2 -f -k %s"%(filename + ".bz2"))
if gzip:
os.system("cat %s.gz | gunzip -f > %s"%(filename,filename))
assert os.path.exists(filename)
o = open(filename,"r")
X = cPickle.load(o)
if bzip2 or gzip:
os.remove(filename)
return X
开发者ID:BlairArchibald,项目名称:sage,代码行数:26,代码来源:db.py
示例9: positive_roots
def positive_roots(self, as_reflections=None):
"""
Return the positive roots.
These are roots in the Coxeter sense, that all have the
same norm. They are given by their coefficients in the
base of simple roots, also taken to have all the same
norm.
.. SEEALSO::
:meth:`reflections`
EXAMPLES::
sage: W = CoxeterGroup(['A',3], implementation='reflection')
sage: W.positive_roots()
((1, 0, 0), (1, 1, 0), (0, 1, 0), (1, 1, 1), (0, 1, 1), (0, 0, 1))
sage: W = CoxeterGroup(['I',5], implementation='reflection')
sage: W.positive_roots()
((1, 0),
(-E(5)^2 - E(5)^3, 1),
(-E(5)^2 - E(5)^3, -E(5)^2 - E(5)^3),
(1, -E(5)^2 - E(5)^3),
(0, 1))
"""
if as_reflections is not None:
from sage.misc.superseded import deprecation
deprecation(20027, "as_reflections is deprecated; instead, use reflections()")
return tuple(self._positive_roots_reflections().keys())
开发者ID:anuragwaliya,项目名称:sage,代码行数:30,代码来源:coxeter_group.py
示例10: has_key
def has_key(self, key):
r"""
Deprecated; present just for the sake of compatibility.
Use ``key in self`` instead.
INPUT:
- ``key`` -- A value identifying the element, will be converted.
EXAMPLES::
sage: from sage.misc.converting_dict import KeyConvertingDict
sage: d = KeyConvertingDict(int)
sage: d[3] = 42
sage: d.has_key("3")
doctest:warning...:
DeprecationWarning: use 'key in dictionary' syntax instead
See https://trac.sagemath.org/25281 for details.
True
sage: d.has_key(4)
False
"""
from sage.misc.superseded import deprecation
deprecation(25281, "use 'key in dictionary' syntax instead")
return key in self
开发者ID:saraedum,项目名称:sage-renamed,代码行数:26,代码来源:converting_dict.py
示例11: save
def save(x, filename, bzip2=False, gzip=False):
"""
save(x, filename):
Saves x to a file. Pretty much the only constraint on x is that
it have no circular references (it must be Python pickle-able).
This uses the pickle module, so data you save is *guaranteed*
to be readable by future versions of Python.
INPUT:
x -- almost arbitrary object
filename -- a string
OUTPUT:
Creates a file named filename, from which the object x
can be reconstructed.
"""
from sage.misc.superseded import deprecation
deprecation(17653, 'The sage.misc.db module is deprecated, use the load/save functions from sage.structure.sage_object instead')
o=open(filename,"w")
# Note: don't use protocol 2 here (use 1), since loading doesn't work
# on my extension types.
cPickle.dump(x,o,1)
o.close()
if bzip2:
os.system("bzip2 -f %s"%filename)
if gzip:
os.system("gzip -f %s"%filename)
开发者ID:BlairArchibald,项目名称:sage,代码行数:29,代码来源:db.py
示例12: to_libgap
def to_libgap(x):
"""
Helper to convert ``x`` to a LibGAP matrix or matrix group
element.
Deprecated; use the ``x.gap()`` method or ``libgap(x)`` instead.
EXAMPLES::
sage: from sage.groups.matrix_gps.morphism import to_libgap
sage: to_libgap(GL(2,3).gen(0))
doctest:...: DeprecationWarning: this function is deprecated.
Use x.gap() or libgap(x) instead.
See https://trac.sagemath.org/25444 for details.
[ [ Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0 ] ]
sage: to_libgap(matrix(QQ, [[1,2],[3,4]]))
[ [ 1, 2 ], [ 3, 4 ] ]
"""
from sage.misc.superseded import deprecation
deprecation(25444, "this function is deprecated."
" Use x.gap() or libgap(x) instead.")
try:
return x.gap()
except AttributeError:
from sage.libs.gap.libgap import libgap
return libgap(x)
开发者ID:sagemath,项目名称:sage,代码行数:26,代码来源:morphism.py
示例13: indices_cmp
def indices_cmp(self, x, y):
r"""
A comparison function on sets which gives a linear extension
of the inclusion order.
INPUT:
- ``x``, ``y`` -- sets
EXAMPLES::
sage: from functools import cmp_to_key
sage: A = Sets().WithRealizations().example(); A
The subset algebra of {1, 2, 3} over Rational Field
sage: sorted(A.indices(), key=cmp_to_key(A.indices_cmp))
doctest:...: DeprecationWarning: indices_cmp is deprecated, use indices_key instead.
See http://trac.sagemath.org/17229 for details.
[{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
"""
from sage.misc.superseded import deprecation
deprecation(17229, "indices_cmp is deprecated, use indices_key instead.")
s = (len(x) > len(y)) - (len(x) < len(y))
if s != 0:
return s
return (list(x) > list(y)) - (list(x) < list(y))
开发者ID:robertwb,项目名称:sage,代码行数:26,代码来源:with_realizations.py
示例14: q_bin
def q_bin(a, b, t=None):
r"""
Returns the `t`-binomial coefficient `[a+b,b]_t`.
INPUT:
- ``a``, ``b`` -- two nonnegative integers
By definition `[a+b,b]_t = (1-t)(1-t^2) \cdots (1-t^{a+b}) / ((1-t) \cdots (1-t^b) (1-t) \cdots (1-t^a))`.
EXAMPLES::
sage: from sage.combinat.sf.kfpoly import q_bin
sage: t = PolynomialRing(ZZ, 't').gen()
sage: q_bin(4,2, t)
doctest:...: DeprecationWarning: please use sage.combinat.q_analogues.q_binomial instead
See http://trac.sagemath.org/14496 for details.
t^8 + t^7 + 2*t^6 + 2*t^5 + 3*t^4 + 2*t^3 + 2*t^2 + t + 1
sage: q_bin(4,3, t)
t^12 + t^11 + 2*t^10 + 3*t^9 + 4*t^8 + 4*t^7 + 5*t^6 + 4*t^5 + 4*t^4 + 3*t^3 + 2*t^2 + t + 1
"""
from sage.misc.superseded import deprecation
deprecation(14496, "please use sage.combinat.q_analogues.q_binomial instead")
return sage.combinat.q_analogues.q_binomial(a + b, b, t)
开发者ID:kini,项目名称:sage,代码行数:25,代码来源:kfpoly.py
示例15: __init__
def __init__(self, coordinates, metric = None):
"""
An open subset of Euclidian space with a specific set of
coordinates. See ``CoordinatePatch`` for details.
INPUT:
- ``coordinates`` -- a set of symbolic variables that serve
as coordinates on this space.
- ``metric`` (default: ``None``) -- a metric tensor on this
coordinate patch. Providing anything other than ``None``
is currently not defined.
EXAMPLES::
sage: x, y, z = var('x, y, z')
sage: S = CoordinatePatch((x, y, z)); S
doctest:...: DeprecationWarning: Use Manifold instead.
See http://trac.sagemath.org/24444 for details.
Open subset of R^3 with coordinates x, y, z
"""
from sage.symbolic.ring import is_SymbolicVariable
from sage.misc.superseded import deprecation
deprecation(24444, 'Use Manifold instead.')
if not all(is_SymbolicVariable(c) for c in coordinates):
raise TypeError("%s is not a valid vector of coordinates." % \
coordinates)
self._coordinates = tuple(coordinates)
dim = len(self._coordinates)
if metric is not None:
raise NotImplementedError("Metric geometry not supported yet.")
开发者ID:saraedum,项目名称:sage-renamed,代码行数:35,代码来源:coordinate_patch.py
示例16: __init__
def __init__(self, base_field, order):
r"""
TESTS:
If ``base_field`` is not a finite field, an exception is raised::
sage: codes.HammingCode(RR, 3)
Traceback (most recent call last):
...
ValueError: base_field has to be a finite field
If ``order`` is not a Sage Integer or a Python int, an exception is raised::
sage: codes.HammingCode(GF(3), 3.14)
Traceback (most recent call last):
...
ValueError: order has to be a Sage Integer or a Python int
"""
if isinstance(base_field, (Integer, int)) and isinstance(order, Field):
from sage.misc.superseded import deprecation
deprecation(19930, "codes.HammingCode(r, F) is now deprecated. Please use codes.HammingCode(F, r) instead.")
tmp = copy(order)
order = copy(base_field)
base_field = copy(tmp)
if not base_field.is_finite():
raise ValueError("base_field has to be a finite field")
if not isinstance(order, (Integer, int)):
raise ValueError("order has to be a Sage Integer or a Python int")
q = base_field.order()
length = Integer((q ** order - 1) / (q - 1))
super(HammingCode, self).__init__(base_field, length, "Systematic", "Syndrome")
self._dimension = length - order
开发者ID:mcognetta,项目名称:sage,代码行数:33,代码来源:hamming_code.py
示例17: subtract_from_line_numbers
def subtract_from_line_numbers(s, n):
r"""
Given a string ``s`` and an integer ``n``, for any line of ``s`` which has
the form ``'text:NUM:text'`` subtract ``n`` from NUM and return
``'text:(NUM-n):text'``. Return other lines of ``s`` without change.
EXAMPLES::
sage: from sage.misc.cython import subtract_from_line_numbers
sage: subtract_from_line_numbers('hello:1234:hello', 3)
doctest:...: DeprecationWarning: subtract_from_line_numbers is deprecated
See http://trac.sagemath.org/22805 for details.
'hello:1231:hello\n'
sage: subtract_from_line_numbers('text:123\nhello:1234:', 3)
'text:123\nhello:1231:\n'
"""
from sage.misc.superseded import deprecation
deprecation(22805, 'subtract_from_line_numbers is deprecated')
ans = []
for X in s.split('\n'):
i = X.find(':')
j = i+1 + X[i+1:].find(':')
try:
ans.append('%s:%s:%s\n'%(X[:i], int(X[i+1:j]) - n, X[j+1:]))
except ValueError:
ans.append(X)
return '\n'.join(ans)
开发者ID:saraedum,项目名称:sage-renamed,代码行数:28,代码来源:cython.py
示例18: __classcall_private__
def __classcall_private__(cls, ct, c=None, use_Y=None):
r"""
Normalize input to ensure a unique representation.
INPUT:
- ``ct`` -- a Cartan type
EXAMPLES::
sage: M = crystals.infinity.NakajimaMonomials("E8")
sage: M1 = crystals.infinity.NakajimaMonomials(['E',8])
sage: M2 = crystals.infinity.NakajimaMonomials(CartanType(['E',8]))
sage: M is M1 is M2
True
"""
if use_Y is not None:
from sage.misc.superseded import deprecation
deprecation(18895, 'use_Y is deprecated; use the set_variables() method instead.')
else:
use_Y = True
cartan_type = CartanType(ct)
n = len(cartan_type.index_set())
c = InfinityCrystalOfNakajimaMonomials._normalize_c(c, n)
M = super(InfinityCrystalOfNakajimaMonomials, cls).__classcall__(cls, cartan_type, c)
if not use_Y:
M.set_variables('A')
else:
M.set_variables('Y')
return M
开发者ID:robertwb,项目名称:sage,代码行数:31,代码来源:monomial_crystals.py
示例19: parameters
def parameters(self, t=None):
"""
Returns `(t,v,k,lambda)`. Does not check if the input is a block
design.
INPUT:
- ``t`` -- `t` such that the design is a `t`-design.
EXAMPLES::
sage: from sage.combinat.designs.block_design import BlockDesign
sage: BD = BlockDesign(7,[[0,1,2],[0,3,4],[0,5,6],[1,3,5],[1,4,6],[2,3,6],[2,4,5]], name="FanoPlane")
sage: BD.parameters(t=2)
(2, 7, 3, 1)
sage: BD.parameters(t=3)
(3, 7, 3, 0)
"""
if t is None:
from sage.misc.superseded import deprecation
deprecation(15664, "the 't' argument will become mandatory soon. 2"+
" is used when none is provided.")
t = 2
v = len(self.points())
blks = self.blocks()
k = len(blks[int(0)])
b = len(blks)
#A = self.incidence_matrix()
#r = sum(A.rows()[0])
lmbda = int(b/(binomial(v, t)/binomial(k, t)))
return (t, v, k, lmbda)
开发者ID:jeromeca,项目名称:sagesmc,代码行数:32,代码来源:incidence_structures.py
示例20: composite_field
def composite_field(K, L):
"""
Return a canonical field that contains both $K$ and $L$, if possible.
Otherwise, raise a ValueError.
INPUT:
K -- field
L -- field
OUTPUT:
field
EXAMPLES:
sage: composite_field(QQ,QQbar)
doctest:...: DeprecationWarning: The function composite_field() is deprecated. Use get_coercion_model().common_parent() instead
See http://trac.sagemath.org/19415 for details.
Algebraic Field
sage: composite_field(QQ,QQ[sqrt(2)])
Number Field in sqrt2 with defining polynomial x^2 - 2
sage: composite_field(QQ,QQ)
Rational Field
sage: composite_field(QQ,GF(7))
Traceback (most recent call last):
...
ValueError: unable to find a common field
"""
from sage.misc.superseded import deprecation
deprecation(19415, "The function composite_field() is deprecated. Use get_coercion_model().common_parent() instead")
C = Sequence([K(0), L(0)]).universe()
if C not in _Fields:
raise ValueError("unable to find a common field")
return C
开发者ID:ProgVal,项目名称:sage,代码行数:31,代码来源:misc.py
注:本文中的sage.misc.superseded.deprecation函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论