Skip to content

Commit a484809

Browse files
author
Travis Scrimshaw
committed
Doctest fixes.
1 parent 108e019 commit a484809

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/sage/misc/lazy_import.pyx

+7-7
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,10 @@ cdef class LazyImport(object):
257257
trac_number = self._deprecation
258258
message = None
259259
if message is None:
260-
message = '\nImporting %(name)s from here is deprecated. ' + \
261-
'If you need to use it, please import it directly from %(module_name)s'
262-
deprecation(trac_number, message%{'name': alias, 'module_name': self._module})
260+
message = ('\nImporting {name} from here is deprecated. ' +
261+
'If you need to use it, please import it directly from' +
262+
' {module_name}').format(name=alias, module_name=self._module)
263+
deprecation(trac_number, message)
263264
if owner is None:
264265
if self._namespace and self._namespace[alias] is self:
265266
self._namespace[alias] = self._object
@@ -918,7 +919,7 @@ cdef class LazyImport(object):
918919
return self._get_object()
919920

920921

921-
def lazy_import(module, names, _as=None, namespace=None, bint overwrite=True, at_startup=False, deprecation=False):
922+
def lazy_import(module, names, _as=None, namespace=None, bint overwrite=True, at_startup=False, deprecation=None):
922923
"""
923924
Create a lazy import object and inject it into the caller's global
924925
namespace. For the purposes of introspection and calling, this is
@@ -997,7 +998,7 @@ def lazy_import(module, names, _as=None, namespace=None, bint overwrite=True, at
997998
998999
If deprecated then a deprecation warning is issued::
9991000
1000-
sage: lazy_import('sage.all', 'Qp', 'my_Qp', deprecation=12345)
1001+
sage: lazy_import('sage.all', 'Qp', 'my_Qp', deprecation=14275)
10011002
sage: my_Qp(5)
10021003
doctest:...: DeprecationWarning:
10031004
Importing my_Qp from here is deprecated. If you need to use it, please import it directly from sage.all
@@ -1006,10 +1007,9 @@ def lazy_import(module, names, _as=None, namespace=None, bint overwrite=True, at
10061007
10071008
An example of deprecation with a message::
10081009
1009-
sage: lazy_import('sage.all', 'Qp', 'my_Qp_msg', deprecation=(12345, "This is an example.")
1010+
sage: lazy_import('sage.all', 'Qp', 'my_Qp_msg', deprecation=(14275, "This is an example."))
10101011
sage: my_Qp_msg(5)
10111012
doctest:...: DeprecationWarning: This is an example.
1012-
Importing my_Qp_msg from here is deprecated. If you need to use it, please import it directly from sage.all
10131013
See http://trac.sagemath.org/14275 for details.
10141014
5-adic Field with capped relative precision 20
10151015
"""

0 commit comments

Comments
 (0)