Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Stopgaps """
#***************************************************************************** # Copyright (C) 2012 William Stein <wstein@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #***************************************************************************** from __future__ import absolute_import
""" Enable or disable the stopgap warnings.
INPUT:
- ``mode`` -- (bool); if True, enable stopgaps; otherwise, disable.
EXAMPLES::
sage: import sage.misc.stopgap sage: sage.misc.stopgap.set_state(False) sage: sage.misc.stopgap.stopgap("Displays nothing.", 12345) sage: sage.misc.stopgap.set_state(True) sage: sage.misc.stopgap.stopgap("Displays something.", 123456) doctest:...: ...StopgapWarning: Displays something. This issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/123456. sage: sage.misc.stopgap.set_state(False) """ global ENABLED
""" This class is used to warn users of a known issue that may produce mathematically incorrect results. """ pass
r""" Issue a stopgap warning.
INPUT:
- ``message`` - an explanation of how an incorrect answer might be produced.
- ``ticket_no`` - an integer, giving the number of the Trac ticket tracking the underlying issue.
EXAMPLES::
sage: import sage.misc.stopgap sage: sage.misc.stopgap.set_state(True) sage: sage.misc.stopgap.stopgap("Computation of heights on elliptic curves over number fields can return very imprecise results.", 12509) doctest:... ...StopgapWarning: Computation of heights on elliptic curves over number fields can return very imprecise results. This issue is being tracked at https://trac.sagemath.org/sage_trac/ticket/12509. sage: sage.misc.stopgap.stopgap("This is not printed", 12509) sage: sage.misc.stopgap.set_state(False) # so rest of doctesting fine """ # We reset show_warning so that the message is not printed twice. return "%s:%s:\n%s\n%s\n%s\n" % (filename, lineno, "*"*80, message, "*"*80) |