Show More
@@ -5,7 +5,7 b' General purpose utilities.' | |||
|
5 | 5 | This is a grab-bag of stuff I find useful in most programs I write. Some of |
|
6 | 6 | these things are also convenient when working at the command line. |
|
7 | 7 | |
|
8 |
$Id: genutils.py 1 |
|
|
8 | $Id: genutils.py 1930 2006-11-26 17:22:13Z vivainio $""" | |
|
9 | 9 | |
|
10 | 10 | #***************************************************************************** |
|
11 | 11 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
@@ -30,6 +30,7 b' import sys' | |||
|
30 | 30 | import tempfile |
|
31 | 31 | import time |
|
32 | 32 | import types |
|
33 | import warnings | |
|
33 | 34 | |
|
34 | 35 | # Other IPython utilities |
|
35 | 36 | from IPython.Itpl import Itpl,itpl,printpl |
@@ -1697,6 +1698,7 b' def import_fail_info(mod_name,fns=None):' | |||
|
1697 | 1698 | #---------------------------------------------------------------------------- |
|
1698 | 1699 | # Proposed popitem() extension, written as a method |
|
1699 | 1700 | |
|
1701 | ||
|
1700 | 1702 | class NotGiven: pass |
|
1701 | 1703 | |
|
1702 | 1704 | def popkey(dct,key,default=NotGiven): |
@@ -1715,5 +1717,15 b' def popkey(dct,key,default=NotGiven):' | |||
|
1715 | 1717 | else: |
|
1716 | 1718 | del dct[key] |
|
1717 | 1719 | return val |
|
1720 | ||
|
1721 | def wrap_deprecated(func, suggest = '<nothing>'): | |
|
1722 | def newFunc(*args, **kwargs): | |
|
1723 | warnings.warn("Call to deprecated function %s, use %s instead" % | |
|
1724 | ( func.__name__, suggest), | |
|
1725 | category=DeprecationWarning, | |
|
1726 | stacklevel = 2) | |
|
1727 | return func(*args, **kwargs) | |
|
1728 | return newFunc | |
|
1729 | ||
|
1718 | 1730 | #*************************** end of file <genutils.py> ********************** |
|
1719 | 1731 |
General Comments 0
You need to be logged in to leave comments.
Login now