if arguments are given, adds a hash of the args to the key.
322825
def _prepare_key(key, *args, **kwargs):
    

    if not args and not kwargs:
        return key

    items = sorted(kwargs.items())
    hashable_args = (args, tuple(items))
    args_key = hashlib.md5(pickle.dumps(hashable_args)).hexdigest()

    return "%s/args:%s" % (key, args_key)
904670
def _update_file_args(self, file_mapping):
        """"""
        for key, value in self.args.items():
            new_value = file_mapping.get(value, value)
            if new_value != value:
                self.args[key] = new_value
452237
def cache_key(*args, **kwargs):
    
    key = ""
    for arg in args:
        if callable(arg):
            key += ":%s" % repr(arg)
        else:
            key += ":%s" % str(arg)

    return key
597402
def add_arg_param(self, param_name, layer_index, blob_index):
        """"""
        self.add_param('arg:%s' % param_name, layer_index, blob_index)
268619
def _add_hash(cls, attrs):
    
    cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False)
    return cls
12194
def add(*args)
      args.flatten! # allow [] as a param
      args.each do |arg|
        arg = arg.to_sym if arg.is_a? String
        @set << arg unless @set.include? arg # avoid duplicates
      end
    end
227013
def argument(self, key=None):
        
        if key is None:
            return self._args.arguments()

        return self._args.argument(key)
486581
def p_kw_args_update(self, p):
        """"""
        p[0] = p[1]
        for key in p[3]:
            if key in p[1]:
                msg = "Keyword argument '%s' defined more than once." % key
                self.errors.append((msg, p.lineno(2), self.path))
        p[0].update(p[3])
847220
def symbolize_keys(hash)
      hash = hash.to_hash
      if hash.respond_to?(:symbolize_keys)
        hash.symbolize_keys
      else
        hash.inject({}) do |new_hash, (key, value)|
          new_hash[symbolize_key(key)] = value
          new_hash
        end
      end
    end
725353
def add_argument(self, *args, **kwargs):
        

        if len(args) == 1 and isinstance(args[0], self.argument_class):
            self.args.append(args[0])
        else:
            self.args.append(self.argument_class(*args, **kwargs))

        # Do not know what other argument classes are out there
        if self.trim and self.argument_class is Argument:
            # enable trim for appended element
            self.args[-1].trim = kwargs.get('trim', self.trim)

        return self
471072
def add_config_argument(arguments)
      arguments['_config'] = @config.clone
      arguments['_config'].delete_if { |k, _| arguments.key?(k) }
      arguments['_config'].delete_if do |k, _|
        @config.class.const_get('DEFAULTS').stringify_keys.key?(k)
      end
      arguments
    end
1184740
def resolve_args(args)
      if args.last.is_a?(Hash)
        deps = args.pop
        resolve_args_with_dependencies(args, deps)
      else
        resolve_args_without_dependencies(args)
      end
    end
1272217
def hash_key(*args, **kwargs):
    """"""

    if kwargs:
        return cachetools.keys._HashedTuple(args + _kwargs_mark + tuple(itertools.chain(sorted(kwargs.items()))))
    else:
        return cachetools.keys._HashedTuple(args)
26115
def _attach_arguments(self):
        """"""
        for arg in self.arguments:
            self.parser.add_argument(*arg[0], **arg[1])
485220
def argshash(self, args, kwargs):
        ""
        a = repr(args)
        b = repr(sorted((repr(k), repr(v)) for k, v in kwargs.items()))
        return a + b
482214
def append_args(self, arg):
      
      debug.log("Adding Arguments: %s"%(arg))
      if isinstance(arg, (int,float)): self.args.append(str(arg))
      if isinstance(arg, str): self.args.append(arg)
      if isinstance(arg, list):
         if sys.version_info < (3, 0):
            self.args.extend([str(x) if not isinstance(x, (unicode)) else x.encode('utf-8') for x in arg])
         else:
            self.args.extend([str(x) for x in arg])
1345544
def arguments(value)
      value = case value
              when Hash
                value.map do |key,sub_value|
                  if    sub_value == true then key.to_s
                  elsif sub_value         then "#{key}=#{sub_value}"
                  end
                end
              when false, nil
                []
              else
                Array(value)
              end

      return value.compact
    end