process kwargs for AxDimension instances by stripping off the prefix
    for the appropriate direction
420276
def _process_dimension_kwargs(direction, kwargs):
    
    acceptable_keys = ['unit', 'pad', 'lim', 'label']
    # if direction in ['s']:
        # acceptable_keys += ['mode']
    processed_kwargs = {}
    for k,v in kwargs.items():
        if k.startswith(direction):
            processed_key = k.lstrip(direction)
        else:
            processed_key = k

        if processed_key in acceptable_keys:
            processed_kwargs[processed_key] = v

    return processed_kwargs
994224
def _process_axsettings(self, hist, lims, ticks):
        
        axis_settings = dict(zip(self.axis_settings, [None, None, (None if self.overlaid else ticks)]))
        return axis_settings
222088
def process(ctx, dataset, kwargs):
    ""

    kwargs = parse_kwargs(kwargs)
    data(dataset, **ctx.obj).process(**kwargs)
1080734
def _kwargs_to_attributes(self, kwargs):
        
        for key, val in kwargs.iteritems():
            if key not in self.__dict__:
                raise ValueError(
                    "Can't set %s parameter - it is not defined here!" % key
                )

            self.__dict__[key] = val
396530
def kwarg(string, separator='='):
    """"""
    if separator not in string:
        raise ValueError("Separator '%s' not in value '%s'"
                         % (separator, string))
    if string.strip().startswith(separator):
        raise ValueError("Value '%s' starts with separator '%s'"
                         % (string, separator))
    if string.strip().endswith(separator):
        raise ValueError("Value '%s' ends with separator '%s'"
                         % (string, separator))
    if string.count(separator) != 1:
        raise ValueError("Value '%s' should only have one '%s' separator"
                         % (string, separator))
    key, value = string.split(separator)
    return {key: value}
605625
def mk_kwargs(cls, kwargs):
        
        ret = {}
        kws = ['row_factory', 'body', 'parent']
        for k in kws:
            if k in kwargs:
                ret[k] = kwargs.pop(k)

        return ret
240312
def split_kwargs(relaxation_kwds):
    """"""
    optimizer_keys_list = [
        'step_method',
        'linesearch',
        'eta_max',
        'eta',
        'm',
        'linesearch_first'
    ]
    optimizer_kwargs = { k:relaxation_kwds.pop(k) for k in optimizer_keys_list if k in relaxation_kwds }
    if 'm' in optimizer_kwargs:
        optimizer_kwargs['momentum'] = optimizer_kwargs.pop('m')
    return optimizer_kwargs, relaxation_kwds
834830
def _construct_axes_dict_from(self, axes, **kwargs):
        """"""
        d = {a: ax for a, ax in zip(self._AXIS_ORDERS, axes)}
        d.update(kwargs)
        return d
269261
def _mpl_ax_to(self, mplobj, output='vb'):
        """"""
        for ax in self._axs.values():
            if ax['ax'] is mplobj.axes:
                return ax[output]
        raise RuntimeError('Parent axes could not be found!')
1144701
def prepare_arguments(self, attributes):
        """"""
        kwargs = dict(attributes)
        # 1. Extension points
        kwargs = self.factory._adjust_kwargs(**kwargs)

        # 2. Remove hidden objects
        kwargs = {
            k: v for k, v in kwargs.items()
            if k not in self.exclude and k not in self.parameters and v is not declarations.SKIP
        }

        # 3. Rename fields
        for old_name, new_name in self.rename.items():
            if old_name in kwargs:
                kwargs[new_name] = kwargs.pop(old_name)

        # 4. Extract inline args
        args = tuple(
            kwargs.pop(arg_name)
            for arg_name in self.inline_args
        )

        return args, kwargs
335501
def transform_kwargs(self, **kwargs):
		""""""
		args = list()
		for k, v in kwargs.items():
			if len(k) == 1:
				if v is True:
					args.append("-%s" % k)
				elif type(v) is not bool:
					args.append("-%s%s" % (k, v))
			else:
				if v is True:
					args.append("--%s" % dashify(k))
				elif type(v) is not bool:
					args.append("--%s=%s" % (dashify(k), v))
		return args
1121617
def transform_kwargs(self, split_single_char_options=True, **kwargs):
        """"""
        args = []
        kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0]))
        for k, v in kwargs.items():
            if isinstance(v, (list, tuple)):
                for value in v:
                    args += self.transform_kwarg(k, value, split_single_char_options)
            else:
                args += self.transform_kwarg(k, v, split_single_char_options)
        return args
967163
def xarray_derivative_wrap(func):
    
    @functools.wraps(func)
    def wrapper(f, **kwargs):
        if 'x' in kwargs or 'delta' in kwargs:
            # Use the usual DataArray to pint.Quantity preprocessing wrapper
            return preprocess_xarray(func)(f, **kwargs)
        elif isinstance(f, xr.DataArray):
            # Get axis argument, defaulting to first dimension
            axis = f.metpy.find_axis_name(kwargs.get('axis', 0))

            # Initialize new kwargs with the axis number
            new_kwargs = {'axis': f.get_axis_num(axis)}

            if f[axis].attrs.get('_metpy_axis') == 'T':
                # Time coordinate, need to convert to seconds from datetimes
                new_kwargs['x'] = f[axis].metpy.as_timestamp().metpy.unit_array
            elif CFConventionHandler.check_axis(f[axis], 'lon'):
                # Longitude coordinate, need to get grid deltas
                new_kwargs['delta'], _ = grid_deltas_from_dataarray(f)
            elif CFConventionHandler.check_axis(f[axis], 'lat'):
                # Latitude coordinate, need to get grid deltas
                _, new_kwargs['delta'] = grid_deltas_from_dataarray(f)
            else:
                # General coordinate, use as is
                new_kwargs['x'] = f[axis].metpy.unit_array

            # Calculate and return result as a DataArray
            result = func(f.metpy.unit_array, **new_kwargs)
            return xr.DataArray(result.magnitude,
                                coords=f.coords,
                                dims=f.dims,
                                attrs={'units': str(result.units)})
        else:
            # Error
            raise ValueError('Must specify either "x" or "delta" for value positions when "f" '
                             'is not a DataArray.')
    return wrapper
555730
def _get_clean_parameters(kwargs):
        
        return dict((k, v) for k, v in kwargs.items() if v is not None)
728966
def _convert_args(args):
    '''
    
    '''
    converted = []
    for arg in args:
        if isinstance(arg, dict):
            for key in list(arg.keys()):
                if key == '__kwarg__':
                    continue
                converted.append('{0}={1}'.format(key, arg[key]))
        else:
            converted.append(arg)
    return converted
1059928
def _process_cmap_cbar_kwargs(func, kwargs, data):
    

    cmap = kwargs.pop('cmap', None)
    colors = kwargs.pop('colors', None)

    cbar_kwargs = kwargs.pop('cbar_kwargs', {})
    cbar_kwargs = {} if cbar_kwargs is None else dict(cbar_kwargs)

    levels = kwargs.pop('levels', None)
    if 'contour' in func.__name__ and levels is None:
        levels = 7  # this is the matplotlib default

    # colors is mutually exclusive with cmap
    if cmap and colors:
        raise ValueError("Can't specify both cmap and colors.")

    # colors is only valid when levels is supplied or the plot is of type
    # contour or contourf
    if colors and (('contour' not in func.__name__) and (not levels)):
        raise ValueError("Can only specify colors with contour or levels")

    # we should not be getting a list of colors in cmap anymore
    # is there a better way to do this test?
    if isinstance(cmap, (list, tuple)):
        warnings.warn("Specifying a list of colors in cmap is deprecated. "
                      "Use colors keyword instead.",
                      DeprecationWarning, stacklevel=3)

    cmap_kwargs = {'plot_data': data,
                   'levels': levels,
                   'cmap': colors if colors else cmap,
                   'filled': func.__name__ != 'contour'}

    cmap_args = getfullargspec(_determine_cmap_params).args
    cmap_kwargs.update((a, kwargs[a]) for a in cmap_args if a in kwargs)
    cmap_params = _determine_cmap_params(**cmap_kwargs)

    return cmap_params, cbar_kwargs
243964
def argmax(attrs, inputs, proto_obj):
    """"""
    axis = attrs.get('axis', 0)
    keepdims = attrs.get('keepdims', 1)
    argmax_op = symbol.argmax(inputs[0], axis=axis, keepdims=keepdims)
    # onnx argmax operator always expects int64 as output type
    cast_attrs = {'dtype': 'int64'}
    return 'cast', cast_attrs, argmax_op