class_docstr: A Signature object represents the overall signature of a function.
  It stores a Parameter object for each parameter accepted by the
  function, as well as information specific to the function itself.
  
  A Signature object has the following public attributes and methods:
  
  * parameters : OrderedDict
      An ordered mapping of parameters' names to the corresponding
      Parameter objects (keyword-only arguments are in the same order
      as listed in `code.co_varnames`).
  * return_annotation : object
      The annotation for the return type of the function if specified.
      If the function has no annotation for its return type, this
      attribute is not set.
  * bind(*args, **kwargs) -> BoundArguments
      Creates a mapping from positional and keyword arguments to
      parameters.
  * bind_partial(*args, **kwargs) -> BoundArguments
      Creates a partial mapping from positional and keyword arguments
      to parameters (simulating 'functools.partial' behavior.)
class_docstr_tok: ["A","Signature","object","represents","the","overall","signature","of","a","function",".","It","stores","a","Parameter","object","for","each","parameter","accepted","by","the","function",",","as","well","as","information","specific","to","the","function","itself",".","A","Signature","object","has","the","following","public","attributes","and","methods",":","*","parameters",":","OrderedDict","An","ordered","mapping","of","parameters","'","names","to","the","corresponding","Parameter","objects","(","keyword-only","arguments","are","in","the","same","order","as","listed","in","`","code.co_varnames","`",")",".","*","return_annotation",":","object","The","annotation","for","the","return","type","of","the","function","if","specified",".","If","the","function","has","no","annotation","for","its","return","type",",","this","attribute","is","not","set",".","*","bind","(","*","args",",","*","*","kwargs",")","-",">","BoundArguments","Creates","a","mapping","from","positional","and","keyword","arguments","to","parameters",".","*","bind_partial","(","*","args",",","*","*","kwargs",")","-",">","BoundArguments","Creates","a","partial","mapping","from","positional","and","keyword","arguments","to","parameters","(","simulating","'functools.partial","'","behavior",".",")"]
docstr: Private method.  Don't use directly.
code: def _bind(self, args, kwargs, partial=False):
      """Private method.  Don't use directly."""
  
      arguments = OrderedDict()
  
      parameters = iter(self.parameters.values())
      parameters_ex = ()
      arg_vals = iter(args)
  
      if partial:
          # Support for binding arguments to 'functools.partial' objects.
          # See 'functools.partial' case in 'signature()' implementation
          # for details.
          for param_name, param in self.parameters.items():
              if param._partial_kwarg and param_name not in kwargs:
                  # Simulating 'functools.partial' behavior
                  kwargs[param_name] = param.default
  
      while True:
          # Let's iterate through the positional arguments and corresponding
          # parameters
          try:
              arg_val = next(arg_vals)
          except StopIteration:
              # No more positional arguments
              try:
                  param = next(parameters)
              except StopIteration:
                  # No more parameters. That's it. Just need to check that
                  # we have no `kwargs` after this while loop
                  break
              else:
                  if param.kind == _VAR_POSITIONAL:
                      # That's OK, just empty *args.  Let's start parsing
                      # kwargs
                      break
                  elif param.name in kwargs:
                      if param.kind == _POSITIONAL_ONLY:
                          msg = (
                              "{arg!r} parameter is positional only, "
                              "but was passed as a keyword"
                          )
                          msg = msg.format(arg=param.name)
                          raise TypeError(msg)
                      parameters_ex = (param,)
                      break
                  elif (
                      param.kind == _VAR_KEYWORD
                      or param.default is not _empty
                  ):
                      # That's fine too - we have a default value for this
                      # parameter.  So, lets start parsing `kwargs`, starting
                      # with the current parameter
                      parameters_ex = (param,)
                      break
                  else:
                      if partial:
                          parameters_ex = (param,)
                          break
                      else:
                          msg = (
                              "{arg!r} parameter lacking default value"
                          )
                          msg = msg.format(arg=param.name)
                          raise TypeError(msg)
          else:
              # We have a positional argument to process
              try:
                  param = next(parameters)
              except StopIteration:
                  raise TypeError("too many positional arguments")
              else:
                  if param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
                      # Looks like we have no parameter for this positional
                      # argument
                      raise TypeError("too many positional arguments")
  
                  if param.kind == _VAR_POSITIONAL:
                      # We have an '*args'-like argument, let's fill it with
                      # all positional arguments we have left and move on to
                      # the next phase
                      values = [arg_val]
                      values.extend(arg_vals)
                      arguments[param.name] = tuple(values)
                      break
  
                  if param.name in kwargs:
                      raise TypeError(
                          "multiple values for argument "
                          "{arg!r}".format(arg=param.name)
                      )
  
                  arguments[param.name] = arg_val
  
      # Now, we iterate through the remaining parameters to process
      # keyword arguments
      kwargs_param = None
      for param in itertools.chain(parameters_ex, parameters):
          if param.kind == _POSITIONAL_ONLY:
              # This should never happen in case of a properly built
              # Signature object (but let's have this check here
              # to ensure correct behaviour just in case)
              raise TypeError(
                  "{arg!r} parameter is positional only, "
                  "but was passed as a keyword".format(arg=param.name)
              )
  
          if param.kind == _VAR_KEYWORD:
              # Memorize that we have a '**kwargs'-like parameter
              kwargs_param = param
              continue
  
          param_name = param.name
          try:
              arg_val = kwargs.pop(param_name)
          except KeyError:
              # We have no value for this parameter.  It's fine though,
              # if it has a default value, or it is an '*args'-like
              # parameter, left alone by the processing of positional
              # arguments.
              if (
                  not partial
                  and param.kind != _VAR_POSITIONAL
                  and param.default is _empty
              ):
                  raise TypeError(
                      "{arg!r} parameter lacking default value".format(
                          arg=param_name
                      )
                  )
  
          else:
              arguments[param_name] = arg_val
  
      if kwargs:
          if kwargs_param is not None:
              # Process our '**kwargs'-like parameter
              arguments[kwargs_param.name] = kwargs
          else:
              raise TypeError("too many keyword arguments")
  
      return self._bound_arguments_cls(self, arguments)
  
imports: from __future__ import absolute_import, division, print_function
  import itertools
  import functools
  import re
  import types
  from collections import OrderedDict
label_desc: Use image node_id 9 for calling the Signature obj's underlying member method code with example usage: obj._bind(args, kwargs, partial) and returns: self