Coverage for /opt/obspy/update-docs/src/obspy/obspy/core/util/decorator : 78%

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
# -*- coding: utf-8 -*- Decorator used in ObsPy.
:copyright: The ObsPy Development Team (devs@obspy.org) :license: GNU Lesser General Public License, Version 3 (http://www.gnu.org/copyleft/lesser.html) """
""" This is a decorator which can be used to mark functions as deprecated.
It will result in a warning being emitted when the function is used. """ def new_func(*args, **kwargs): if 'deprecated' in str(func.__doc__).lower(): msg = func.__doc__ elif warning_msg: msg = warning_msg else: msg = "Call to deprecated function %s." % func.__name__ warnings.warn(msg, category=DeprecationWarning) return func(*args, **kwargs)
""" Decorator for marking keywords as deprecated.
:type keywords: dict :param keywords: old/new keyword names as key/value pairs. """
def echo_func(*args, **kwargs): warnings.warn(msg2 % (kw, fname), category=DeprecationWarning) else: category=DeprecationWarning)
""" Unconditionally skip a test. """ unittest.TestCase)): def skip_wrapper(*args, **kwargs): # @UnusedVariable return
""" Skip a test if the condition is true. """
""" Decorator used for temporary uncompressing file if .gz or .bz2 archive. """ msg = "File not found '%s'" % (filename) raise IOError(msg) # check if we got a compressed file # bzip2 except: pass # gzip except: pass # we unpacked something without errors - create temporary file # call wrapped function except: # clean up unpacking procedure if unpacked_data: tempfile.close() os.remove(tempfile.name) raise # clean up unpacking procedure else: # call wrapped function with original filename
if __name__ == '__main__': import doctest doctest.testmod(exclude_empty=True) |