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

Commit

Permalink
move code of NotImplementedOZero to avoid merge-conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Feb 12, 2016
1 parent ba0a5ad commit c2f30f5
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions src/sage/rings/asymptotic/misc.py
Expand Up @@ -576,6 +576,43 @@ def log_string(element, base=None):
return 'log(%s%s)' % (element, basestr)


class NotImplementedOZero(NotImplementedError):
r"""
A special :python:`NotImplementedError<library/exceptions.html#exceptions.NotImplementedError>`
which is raised when the result is O(0) which means 0
for sufficiently large values of the variable.
"""
def __init__(self, data):
r"""
INPUT:
- ``data`` -- an :class:`AsymptoticRing` or a string.
TESTS::
sage: A = AsymptoticRing('n^ZZ', ZZ)
doctest:...: FutureWarning: ...
sage: from sage.rings.asymptotic.misc import NotImplementedOZero
sage: raise NotImplementedOZero(A)
Traceback (most recent call last):
...
NotImplementedOZero: The result is O(0)
which means 0 for sufficiently large n
sage: raise NotImplementedOZero('something')
Traceback (most recent call last):
...
NotImplementedOZero: something
"""
from asymptotic_ring import AsymptoticRing
if isinstance(data, AsymptoticRing):
message = ('The result is O(0) which means 0 for sufficiently '
'large {}'.format(
', '.join(str(g) for g in data.gens())))
else:
message = data
super(NotImplementedOZero, self).__init__(message)


def transform_category(category,
subcategory_mapping, axiom_mapping,
initial_category=None):
Expand Down Expand Up @@ -707,40 +744,3 @@ def transform_category(category,
(category, A))

return result


class NotImplementedOZero(NotImplementedError):
r"""
A special :python:`NotImplementedError<library/exceptions.html#exceptions.NotImplementedError>`
which is raised when the result is O(0) which means 0
for sufficiently large values of the variable.
"""
def __init__(self, data):
r"""
INPUT:
- ``data`` -- an :class:`AsymptoticRing` or a string.
TESTS::
sage: A = AsymptoticRing('n^ZZ', ZZ)
doctest:...: FutureWarning: ...
sage: from sage.rings.asymptotic.misc import NotImplementedOZero
sage: raise NotImplementedOZero(A)
Traceback (most recent call last):
...
NotImplementedOZero: The result is O(0)
which means 0 for sufficiently large n
sage: raise NotImplementedOZero('something')
Traceback (most recent call last):
...
NotImplementedOZero: something
"""
from asymptotic_ring import AsymptoticRing
if isinstance(data, AsymptoticRing):
message = ('The result is O(0) which means 0 for sufficiently '
'large {}'.format(
', '.join(str(g) for g in data.gens())))
else:
message = data
super(NotImplementedOZero, self).__init__(message)

0 comments on commit c2f30f5

Please sign in to comment.