parameters: (args, kwargs, metric, func_name)
return_statement: return kwargs
docstring: Convert legacy positional arguments to keyword arguments for pdist/cdist.
docstring_summary: Convert legacy positional arguments to keyword arguments for pdist/cdist.
docstring_tokens: Convert legacy positional arguments to keyword arguments for pdist / cdist .
function: def _args_to_kwargs_xdist(args, kwargs, metric, func_name):
      """
      Convert legacy positional arguments to keyword arguments for pdist/cdist.
      """
      if not args:
          return kwargs
  
      if (callable(metric) and metric not in [
              braycurtis, canberra, chebyshev, cityblock, correlation, cosine,
              dice, euclidean, hamming, jaccard, jensenshannon, kulsinski,
              mahalanobis, matching, minkowski, rogerstanimoto, russellrao,
              seuclidean, sokalmichener, sokalsneath, sqeuclidean, yule,
              wminkowski]):
          raise TypeError('When using a custom metric arguments must be passed'
                          'as keyword (i.e., ARGNAME=ARGVALUE)')
  
      if func_name == 'pdist':
          old_arg_names = ['p', 'w', 'V', 'VI']
      else:
          old_arg_names = ['p', 'V', 'VI', 'w']
  
      num_args = len(args)
      warnings.warn('%d metric parameters have been passed as positional.'
                    'This will raise an error in a future version.'
                    'Please pass arguments as keywords(i.e., ARGNAME=ARGVALUE)'
                    % num_args, DeprecationWarning)
  
      if num_args > 4:
          raise ValueError('Deprecated %s signature accepts only 4'
                           'positional arguments (%s), %d given.'
                           % (func_name, ', '.join(old_arg_names), num_args))
  
      for old_arg, arg in zip(old_arg_names, args):
          if old_arg in kwargs:
              raise TypeError('%s() got multiple values for argument %s'
                              % (func_name, old_arg))
          kwargs[old_arg] = arg
      return kwargs
function_tokens: def _args_to_kwargs_xdist ( args , kwargs , metric , func_name ) : if not args : return kwargs if ( callable ( metric ) and metric not in [ braycurtis , canberra , chebyshev , cityblock , correlation , cosine , dice , euclidean , hamming , jaccard , jensenshannon , kulsinski , mahalanobis , matching , minkowski , rogerstanimoto , russellrao , seuclidean , sokalmichener , sokalsneath , sqeuclidean , yule , wminkowski ] ) : raise TypeError ( 'When using a custom metric arguments must be passed' 'as keyword (i.e., ARGNAME=ARGVALUE)' ) if func_name == 'pdist' : old_arg_names = [ 'p' , 'w' , 'V' , 'VI' ] else : old_arg_names = [ 'p' , 'V' , 'VI' , 'w' ] num_args = len ( args ) warnings . warn ( '%d metric parameters have been passed as positional.' 'This will raise an error in a future version.' 'Please pass arguments as keywords(i.e., ARGNAME=ARGVALUE)' % num_args , DeprecationWarning ) if num_args > 4 : raise ValueError ( 'Deprecated %s signature accepts only 4' 'positional arguments (%s), %d given.' % ( func_name , ', ' . join ( old_arg_names ) , num_args ) ) for old_arg , arg in zip ( old_arg_names , args ) : if old_arg in kwargs : raise TypeError ( '%s() got multiple values for argument %s' % ( func_name , old_arg ) ) kwargs [ old_arg ] = arg return kwargs