MCPcopy Create free account
hub / github.com/NCAR/wrf-python / from_args

Function from_args

src/wrf/util.py:2716–2760  ·  view source on GitHub ↗

Return a mapping of argument name to value for the called function. This function parses the function args and kwargs to obtain the desired argument value. If the argument has not been passed in, the value is taken from the default keyword argument value. This func is usually calle

(func, argnames, *args, **kwargs)

Source from the content-addressed store, hash-verified

2714
2715
2716def from_args(func, argnames, *args, **kwargs):
2717 """Return a mapping of argument name to value for the called function.
2718
2719 This function parses the function args and kwargs to obtain the
2720 desired argument value. If the argument has not been passed in, the value
2721 is taken from the default keyword argument value.
2722
2723 This func is usually called from within a decorator.
2724
2725 Note:
2726
2727 This function currently does not work with functions that contain
2728 variable length args or kwargs arguments.
2729
2730 Args:
2731
2732 func (function): The function to examine (usually the function that is
2733 wrapped).
2734
2735 argnames (iterable): An iterable sequence of argument names.
2736
2737 *args: The positional arguments.
2738
2739 **kwargs: The keyword arguments.
2740
2741 Returns:
2742
2743 :obj:`dict`: A mapping of argument name to argument value.
2744
2745 """
2746 if isstr(argnames):
2747 arglist = [argnames]
2748 else:
2749 arglist = argnames
2750
2751 result = OrderedDict()
2752 for argname in arglist:
2753 arg_loc = arg_location(func, argname, args, kwargs)
2754
2755 if arg_loc is not None:
2756 result[argname] = arg_loc[0][arg_loc[1]]
2757 else:
2758 result[argname] = None
2759
2760 return result
2761
2762
2763def _args_to_list2(func, args, kwargs):

Callers 10

func_wrapperFunction · 0.85
func_wrapperFunction · 0.85
_set_horiz_metaFunction · 0.85
_set_cross_metaFunction · 0.85
_set_line_metaFunction · 0.85
_set_vinterp_metaFunction · 0.85
_set_2dxy_metaFunction · 0.85
_set_1d_metaFunction · 0.85
_set_xy_metaFunction · 0.85
__call__Method · 0.85

Calls 2

isstrFunction · 0.85
arg_locationFunction · 0.85

Tested by

no test coverage detected