import cPickle
import functools
-import itertools
import contextlib
import inspect
def newFunc(*args, **kwargs):
warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning)
return func(*args, **kwargs)
+
_append_docstring(newFunc, "\n@deprecated")
return newFunc
return wrapper
+def into_debugger(func):
+ """
+ >>> validate_decorator(into_debugger)
+ """
+
+ @functools.wraps(func)
+ def newFunc(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except:
+ import pdb
+ pdb.post_mortem()
+
+ return newFunc
+
+
class bindclass(object):
"""
>>> validate_decorator(bindclass)
for key in (x for x in f_locals.keys() if x not in saved):
del f_locals[key]
del frame
+
+
+def strip_number(prettynumber):
+ """
+ function to take a phone number and strip out all non-numeric
+ characters
+
+ >>> strip_number("+012-(345)-678-90")
+ '01234567890'
+ """
+ import re
+ uglynumber = re.sub('\D', '', prettynumber)
+ return uglynumber