@@ -257,9 +257,10 @@ cdef class LazyImport(object):
257
257
trac_number = self ._deprecation
258
258
message = None
259
259
if message is None :
260
- message = ' \n Importing %(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 = (' \n Importing {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)
263
264
if owner is None :
264
265
if self ._namespace and self ._namespace[alias] is self :
265
266
self ._namespace[alias] = self ._object
@@ -918,7 +919,7 @@ cdef class LazyImport(object):
918
919
return self ._get_object()
919
920
920
921
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 ):
922
923
"""
923
924
Create a lazy import object and inject it into the caller's global
924
925
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
997
998
998
999
If deprecated then a deprecation warning is issued::
999
1000
1000
- sage: lazy_import('sage.all', 'Qp', 'my_Qp', deprecation=12345 )
1001
+ sage: lazy_import('sage.all', 'Qp', 'my_Qp', deprecation=14275 )
1001
1002
sage: my_Qp(5)
1002
1003
doctest:...: DeprecationWarning:
1003
1004
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
1006
1007
1007
1008
An example of deprecation with a message::
1008
1009
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.") )
1010
1011
sage: my_Qp_msg(5)
1011
1012
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
1013
1013
See http://trac.sagemath.org/14275 for details.
1014
1014
5-adic Field with capped relative precision 20
1015
1015
"""
0 commit comments