Improved comments

This commit is contained in:
Shahram Najm 2013-05-02 16:32:19 +01:00
parent 83aafa3c46
commit 4d4a21ede6
1 changed files with 6 additions and 3 deletions

View File

@ -46,14 +46,17 @@ KEYTYPES = {
# environment variable is defined
no_type_checks = os.environ.get('GRIB_API_PYTHON_NO_TYPE_CHECKS') is not None
# function arguments type checking decorator
# got inspired from http://code.activestate.com/recipes/454322-type-checking-decorator/
# Function-arguments type-checking decorator
# inspired from http://code.activestate.com/recipes/454322-type-checking-decorator/
# modified to support multiple allowed types and all types in the same decorator call
# This returns a decorator. _params_ is the dict with the type specs
def require(**_params_):
# The actual decorator. Receives the target function in _func_
def check_types(_func_, _params_ = _params_):
if no_type_checks:
return _func_
@wraps(_func_)
# The wrapper function. Replaces the target function and receives its args
def modified(*args, **kw):
arg_names = _func_.func_code.co_varnames
#argnames, varargs, kwargs, defaults = inspect.getargspec(_func_)