qiskit/pulse/samplers/decorators.py
def _update_docstring(discretized_pulse: Callable, sampler_inst: Callable) -> Callable:
    """Update annotations of discretized continuous pulse function.

    Args:
        discretized_pulse: Discretized decorated continuous pulse.
        sampler_inst: Applied sampler.
    """
    wrapped_docstring = pydoc.render_doc(discretized_pulse, '%s')
    header, body = wrapped_docstring.split('\n', 1)
    body = textwrap.indent(body, '                    ')
    wrapped_docstring = header+body
    updated_ds = """
                Discretized continuous pulse function: `{continuous_name}` using
                sampler: `{sampler_name}`.

                 The first argument (time) of the continuous pulse function has been replaced with
                 a discretized `duration` of type (int).

                 Args:
                     duration (int)
                     *args: Remaining arguments of continuous pulse function.
                            See continuous pulse function documentation below.
                     **kwargs: Remaining kwargs of continuous pulse function.
                               See continuous pulse function documentation below.

                 Sampled continuous function:

                    {continuous_doc}
                """.format(continuous_name=discretized_pulse.__name__,
                           sampler_name=sampler_inst.__name__,
                           continuous_doc=wrapped_docstring)

    discretized_pulse.__doc__ = updated_ds
    return discretized_pulse
def _update_docstring(discretized_pulse: Callable, sampler_inst: Callable) -> Callable:
    """Update annotations of discretized continuous pulse function.

    Args:
        discretized_pulse: Discretized decorated continuous pulse.
        sampler_inst: Applied sampler.
    """
    wrapped_docstring = pydoc.render_doc(discretized_pulse, '%s')
    header, body = wrapped_docstring.split('\n', 1)
    body = textwrap.indent(body, '                    ')
    wrapped_docstring = header+body
    updated_ds = """
                Discretized continuous pulse function: `{continuous_name}` using
                sampler: `{sampler_name}`.

                 The first argument (time) of the continuous pulse function has been replaced with
                 a discretized `duration` of type (int).

                 Args:
                     duration (int)
                     *args: Remaining arguments of continuous pulse function.
                            See continuous pulse function documentation below.
                     **kwargs: Remaining kwargs of continuous pulse function.
                               See continuous pulse function documentation below.

                 Sampled continuous function:

                    {continuous_doc}
                """.format(continuous_name=discretized_pulse.__name__,
                           sampler_name=sampler_inst.__name__,
                           continuous_doc=wrapped_docstring)

    discretized_pulse.__doc__ = updated_ds
    return discretized_pulse
def _update_docstring ( discretized_pulse : Callable , sampler_inst : Callable ) -> Callable : wrapped_docstring = pydoc . render_doc ( discretized_pulse , '%s' ) header , body = wrapped_docstring . split ( '\n' , 1 ) body = textwrap . indent ( body , '                    ' ) wrapped_docstring = header + body updated_ds = """
                Discretized continuous pulse function: `{continuous_name}` using
                sampler: `{sampler_name}`.

                 The first argument (time) of the continuous pulse function has been replaced with
                 a discretized `duration` of type (int).

                 Args:
                     duration (int)
                     *args: Remaining arguments of continuous pulse function.
                            See continuous pulse function documentation below.
                     **kwargs: Remaining kwargs of continuous pulse function.
                               See continuous pulse function documentation below.

                 Sampled continuous function:

                    {continuous_doc}
                """ . format ( continuous_name = discretized_pulse . __name__ , sampler_name = sampler_inst . __name__ , continuous_doc = wrapped_docstring ) discretized_pulse . __doc__ = updated_ds return discretized_pulse
Update annotations of discretized continuous pulse function.

    Args:
        discretized_pulse: Discretized decorated continuous pulse.
        sampler_inst: Applied sampler.
Update annotations of discretized continuous pulse function .