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.)
docstr: Constructs Signature for the given python function
docstr_tok: ["Constructs","Signature","for","the","given","python","function"]
code: def from_function(cls, func):
      """Constructs Signature for the given python function"""
  
      if not isinstance(func, types.FunctionType):
          raise TypeError("{0!r} is not a Python function".format(func))
  
      Parameter = cls._parameter_cls
  
      # Parameter information.
      func_code = func.__code__
      pos_count = func_code.co_argcount
      arg_names = func_code.co_varnames
      positional = tuple(arg_names[:pos_count])
      keyword_only_count = getattr(func_code, "co_kwonlyargcount", 0)
      keyword_only = arg_names[
          pos_count : (pos_count + keyword_only_count)
      ]
      annotations = getattr(func, "__annotations__", {})
      defaults = func.__defaults__
      kwdefaults = getattr(func, "__kwdefaults__", None)
  
      if defaults:
          pos_default_count = len(defaults)
      else:
          pos_default_count = 0
  
      parameters = []
  
      # Non-keyword-only parameters w/o defaults.
      non_default_count = pos_count - pos_default_count
      for name in positional[:non_default_count]:
          annotation = annotations.get(name, _empty)
          parameters.append(
              Parameter(
                  name,
                  annotation=annotation,
                  kind=_POSITIONAL_OR_KEYWORD,
              )
          )
  
      # ... w/ defaults.
      for offset, name in enumerate(positional[non_default_count:]):
          annotation = annotations.get(name, _empty)
          parameters.append(
              Parameter(
                  name,
                  annotation=annotation,
                  kind=_POSITIONAL_OR_KEYWORD,
                  default=defaults[offset],
              )
          )
  
      # *args
      if func_code.co_flags & 0x04:
          name = arg_names[pos_count + keyword_only_count]
          annotation = annotations.get(name, _empty)
          parameters.append(
              Parameter(
                  name, annotation=annotation, kind=_VAR_POSITIONAL
              )
          )
  
      # Keyword-only parameters.
      for name in keyword_only:
          default = _empty
          if kwdefaults is not None:
              default = kwdefaults.get(name, _empty)
  
          annotation = annotations.get(name, _empty)
          parameters.append(
              Parameter(
                  name,
                  annotation=annotation,
                  kind=_KEYWORD_ONLY,
                  default=default,
              )
          )
      # **kwargs
      if func_code.co_flags & 0x08:
          index = pos_count + keyword_only_count
          if func_code.co_flags & 0x04:
              index += 1
  
          name = arg_names[index]
          annotation = annotations.get(name, _empty)
          parameters.append(
              Parameter(name, annotation=annotation, kind=_VAR_KEYWORD)
          )
  
      return cls(
          parameters,
          return_annotation=annotations.get("return", _empty),
          __validate_parameters__=False,
      )
  
imports: from __future__ import absolute_import, division, print_function
  import itertools
  import functools
  import re
  import types
label_desc: Use image node_id 2 for calling the Signature obj's underlying member method code with example usage: obj.from_function(cls, func) and returns: cls