original_docstring: 
      A decorator for functions, to change their signature. The new signature should be compliant with the old one.
  
      ```python
      @with_signature(<arguments>)
      def impl(...):
          ...
      ```
  
      is totally equivalent to `impl = create_function(<arguments>, func_impl=impl)` except for one additional behaviour:
  
       - If `func_signature` is set to `None`, there is no `TypeError` as in create_function. Instead, this simply
       applies the new metadata (name, doc, module_name, attrs) to the decorated function without creating a wrapper.
       `add_source`, `add_impl` and `inject_as_first_arg` should not be set in this case.
  
      :param func_signature: the new signature of the decorated function. Either a string without 'def' such as
          "foo(a, b: int, *args, **kwargs)" of "(a, b: int)", or a `Signature` object, for example from the output of
          `inspect.signature` or from the `funcsigs.signature` backport. Note that these objects can be created manually
          too. If the signature is provided as a string and contains a non-empty name, this name will be used instead
          of the one of the decorated function. Finally `None` can be provided to indicate that user wants to only change
          the medatadata (func_name, doc, module_name, attrs) of the decorated function, without generating a new
          function.
      :param inject_as_first_arg: if `True`, the created function will be injected as the first positional argument of
          the decorated function. Default=`False`
      :param func_name: provide a non-`None` value to override the created function `__name__` and `__qualname__`. If this
          is `None` (default), the `__name__` and `__qualname__` will default to the ones of the decorated function if
          `func_signature` is a `Signature`, or to the name defined in `func_signature` if `func_signature` is a `str`
          and contains a non-empty name.
      :param add_source: a boolean indicating if a '__source__' annotation should be added to the generated function
          (default: True)
      :param add_impl: a boolean indicating if a '__func_impl__' annotation should be added to the generated function
          (default: True)
      :param doc: a string representing the docstring that will be used to set the __doc__ attribute on the generated
          function. If None (default), the doc of func_impl will be used.
      :param qualname: a string representing the qualified name to be used. If None (default), the `__qualname__` will
          default to the one of `func_impl` if `func_signature` is a `Signature`, or to the name defined in
          `func_signature` if `func_signature` is a `str` and contains a non-empty name.
      :param module_name: the name of the module to be set on the function (under __module__ ). If None (default),
          `func_impl.__module__` will be used.
      :param attrs: other keyword attributes that should be set on the function
      
docstring: A decorator for functions, to change their signature. The new signature should be compliant with the old one.
  
  
  
  
docstring_tokens: A decorator for functions to change their signature . The new signature should be compliant with the old one .
code: def with_signature(func_signature,             # type: Union[str, Signature]
                     func_name=None,             # type: str
                     inject_as_first_arg=False,  # type: bool
                     add_source=True,             # type: bool
                     add_impl=True,            # type: bool
                     doc=None,                   # type: str
                     qualname=None,              # type: str
                     module_name=None,            # type: str
                     **attrs
                     ):
      """
      A decorator for functions, to change their signature. The new signature should be compliant with the old one.
  
      ```python
      @with_signature(<arguments>)
      def impl(...):
          ...
      ```
  
      is totally equivalent to `impl = create_function(<arguments>, func_impl=impl)` except for one additional behaviour:
  
       - If `func_signature` is set to `None`, there is no `TypeError` as in create_function. Instead, this simply
       applies the new metadata (name, doc, module_name, attrs) to the decorated function without creating a wrapper.
       `add_source`, `add_impl` and `inject_as_first_arg` should not be set in this case.
  
      :param func_signature: the new signature of the decorated function. Either a string without 'def' such as
          "foo(a, b: int, *args, **kwargs)" of "(a, b: int)", or a `Signature` object, for example from the output of
          `inspect.signature` or from the `funcsigs.signature` backport. Note that these objects can be created manually
          too. If the signature is provided as a string and contains a non-empty name, this name will be used instead
          of the one of the decorated function. Finally `None` can be provided to indicate that user wants to only change
          the medatadata (func_name, doc, module_name, attrs) of the decorated function, without generating a new
          function.
      :param inject_as_first_arg: if `True`, the created function will be injected as the first positional argument of
          the decorated function. Default=`False`
      :param func_name: provide a non-`None` value to override the created function `__name__` and `__qualname__`. If this
          is `None` (default), the `__name__` and `__qualname__` will default to the ones of the decorated function if
          `func_signature` is a `Signature`, or to the name defined in `func_signature` if `func_signature` is a `str`
          and contains a non-empty name.
      :param add_source: a boolean indicating if a '__source__' annotation should be added to the generated function
          (default: True)
      :param add_impl: a boolean indicating if a '__func_impl__' annotation should be added to the generated function
          (default: True)
      :param doc: a string representing the docstring that will be used to set the __doc__ attribute on the generated
          function. If None (default), the doc of func_impl will be used.
      :param qualname: a string representing the qualified name to be used. If None (default), the `__qualname__` will
          default to the one of `func_impl` if `func_signature` is a `Signature`, or to the name defined in
          `func_signature` if `func_signature` is a `str` and contains a non-empty name.
      :param module_name: the name of the module to be set on the function (under __module__ ). If None (default),
          `func_impl.__module__` will be used.
      :param attrs: other keyword attributes that should be set on the function
      """
      if func_signature is None:
          # make sure that user does not provide non-default other args
          if inject_as_first_arg or not add_source or not add_impl:
              raise ValueError("If `func_signature=None` no new signature will be generated so only `func_name`, "
                               "`module_name`, `doc` and `attrs` should be provided, to modify the metadata.")
          else:
              def replace_f(f):
                  # manually apply all the non-None metadata, but do not call create_function - that's useless
                  if func_name is not None:
                      f.__name__ = func_name
                  if doc is not None:
                      f.__doc__ = doc
                  if qualname is not None:
                      f.__qualname__ = qualname
                  if module_name is not None:
                      f.__module__ = module_name
                  for k, v in attrs.items():
                      setattr(f, k, v)
                  return f
      else:
          def replace_f(f):
              return create_function(func_signature=func_signature,
                                     func_impl=f,
                                     func_name=func_name,
                                     inject_as_first_arg=inject_as_first_arg,
                                     add_source=add_source,
                                     add_impl=add_impl,
                                     doc=doc,
                                     qualname=qualname,
                                     module_name=module_name,
                                     _with_sig_=True,  # special trick to tell create_function that we're @with_signature
                                     **attrs
                                     )
  
      return replace_f
code_tokens: def with_signature ( func_signature , func_name = None , inject_as_first_arg = False , add_source = True , add_impl = True , doc = None , qualname = None , module_name = None , ** attrs ) : if func_signature is None : if inject_as_first_arg or not add_source or not add_impl : raise ValueError ( "If `func_signature=None` no new signature will be generated so only `func_name`, " "`module_name`, `doc` and `attrs` should be provided, to modify the metadata." ) else : def replace_f ( f ) : if func_name is not None : f . __name__ = func_name if doc is not None : f . __doc__ = doc if qualname is not None : f . __qualname__ = qualname if module_name is not None : f . __module__ = module_name for k , v in attrs . items ( ) : setattr ( f , k , v ) return f else : def replace_f ( f ) : return create_function ( func_signature = func_signature , func_impl = f , func_name = func_name , inject_as_first_arg = inject_as_first_arg , add_source = add_source , add_impl = add_impl , doc = doc , qualname = qualname , module_name = module_name , _with_sig_ = True , ** attrs ) return replace_f
short_docstring: A decorator for functions, to change their signature.
short_docstring_tokens: A decorator for functions to change their signature .
comment: # type: Union[str, Signature]$SEP$# type: str$SEP$# type: bool$SEP$# type: bool$SEP$# type: bool$SEP$# type: str$SEP$# type: str$SEP$# type: str$SEP$"""
      A decorator for functions, to change their signature. The new signature should be compliant with the old one.
  
      ```python
      @with_signature(<arguments>)
      def impl(...):
          ...
      ```
  
      is totally equivalent to `impl = create_function(<arguments>, func_impl=impl)` except for one additional behaviour:
  
       - If `func_signature` is set to `None`, there is no `TypeError` as in create_function. Instead, this simply
       applies the new metadata (name, doc, module_name, attrs) to the decorated function without creating a wrapper.
       `add_source`, `add_impl` and `inject_as_first_arg` should not be set in this case.
  
      :param func_signature: the new signature of the decorated function. Either a string without 'def' such as
          "foo(a, b: int, *args, **kwargs)" of "(a, b: int)", or a `Signature` object, for example from the output of
          `inspect.signature` or from the `funcsigs.signature` backport. Note that these objects can be created manually
          too. If the signature is provided as a string and contains a non-empty name, this name will be used instead
          of the one of the decorated function. Finally `None` can be provided to indicate that user wants to only change
          the medatadata (func_name, doc, module_name, attrs) of the decorated function, without generating a new
          function.
      :param inject_as_first_arg: if `True`, the created function will be injected as the first positional argument of
          the decorated function. Default=`False`
      :param func_name: provide a non-`None` value to override the created function `__name__` and `__qualname__`. If this
          is `None` (default), the `__name__` and `__qualname__` will default to the ones of the decorated function if
          `func_signature` is a `Signature`, or to the name defined in `func_signature` if `func_signature` is a `str`
          and contains a non-empty name.
      :param add_source: a boolean indicating if a '__source__' annotation should be added to the generated function
          (default: True)
      :param add_impl: a boolean indicating if a '__func_impl__' annotation should be added to the generated function
          (default: True)
      :param doc: a string representing the docstring that will be used to set the __doc__ attribute on the generated
          function. If None (default), the doc of func_impl will be used.
      :param qualname: a string representing the qualified name to be used. If None (default), the `__qualname__` will
          default to the one of `func_impl` if `func_signature` is a `Signature`, or to the name defined in
          `func_signature` if `func_signature` is a `str` and contains a non-empty name.
      :param module_name: the name of the module to be set on the function (under __module__ ). If None (default),
          `func_impl.__module__` will be used.
      :param attrs: other keyword attributes that should be set on the function
      """$SEP$# make sure that user does not provide non-default other args$SEP$# manually apply all the non-None metadata, but do not call create_function - that's useless$SEP$# special trick to tell create_function that we're @with_signature