MCPcopy Create free account
hub / github.com/ActiveState/code / fn

Function fn

recipes/Python/577149_Simple_Validation_decorator/recipe-577149.py:5–12  ·  view source on GitHub ↗
(realfn)

Source from the content-addressed store, hash-verified

3
4def validate(schema):
5 def fn(realfn):
6 def wrapper(*args, **kws):
7 field_names = schema.fields.keys()
8 args_dict = dict(zip(realfn.func_code.co_varnames, args))
9 args_dict.update(dict((field_name, kws.get(field_name)) for field_name in field_names if field_name in kws))
10 schema().to_python(args_dict)
11 return realfn(*args, **kws)
12 return wrapper
13 return fn
14
15

Callers 8

rmFunction · 0.50
from_elemMethod · 0.50
matchFunction · 0.50
methodFunction · 0.50
_countedFunction · 0.50
run_serverMethod · 0.50
wrapperFunction · 0.50
wrapperFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected