31 from functools
import wraps
36 """! Add values to *args
38 Returns the updated *args
44 """! Add values to **kwargs
46 Returns the updated **kwargs
52 """! Data type assertion decorator implementation.
54 Check and assert on function input arguments.
56 @param *args - Data types for the function to assert.
57 @param **kwargs - Data types for the function to assert.
63 def wrapper(*args, **kwargs):
65 _boundFn = inspect.getcallargs(fn, *args, **kwargs)
66 if 'self' in _boundFn:
77 _boundDec = inspect.getcallargs(fn, *decorArgs, **deckwargs)
78 if 'self' in _boundDec:
83 for key, value
in _boundDec.iteritems():
84 if key
not in _boundFn:
88 if not isinstance(_boundFn[key], value):
93 'Argument {0} must be of data type {1}'.format(key, value)
96 return fn(*args, **kwargs)
def datatypeassert
Data type assertion decorator implementation.
def add_to_kwargs
Add values to **kwargs.
def add_to_args
Add values to *args.