Beispiel #1
0
def _add_experimental_function_notice_to_docstring(doc):
    """Adds an experimental notice to a docstring for experimental functions."""
    return decorator_utils.add_notice_to_docstring(
        doc, '', 'EXPERIMENTAL FUNCTION', '(experimental)', [
            'THIS FUNCTION IS EXPERIMENTAL. It may change or '
            'be removed at any time, and without warning.'
        ])
Beispiel #2
0
def _add_deprecated_function_notice_to_docstring(doc, date, instructions):
    """Adds a deprecation notice to a docstring for deprecated functions."""
    return decorator_utils.add_notice_to_docstring(
        doc, instructions, 'DEPRECATED FUNCTION', '(deprecated)', [
            'THIS FUNCTION IS DEPRECATED. It will be removed after %s.' % date,
            'Instructions for updating:'
        ])
Beispiel #3
0
 def _check(self, doc, expected):
   self.assertEqual(
       decorator_utils.add_notice_to_docstring(
           doc=doc,
           instructions="Instructions",
           no_doc_str="Nothing here",
           suffix_str="(suffix)",
           notice=["Go away"]),
       expected)
Beispiel #4
0
def _add_experimental_function_notice_to_docstring(doc):
    """Adds an experimental notice to a docstring for experimental functions."""
    return decorator_utils.add_notice_to_docstring(
        doc,
        "",
        "EXPERIMENTAL FUNCTION",
        "(experimental)",
        ["THIS FUNCTION IS EXPERIMENTAL. It may change or " "be removed at any time, and without warning."],
    )
Beispiel #5
0
def _add_deprecated_arg_notice_to_docstring(doc, date, instructions):
    """Adds a deprecation notice to a docstring for deprecated arguments."""
    return decorator_utils.add_notice_to_docstring(
        doc, instructions, 'DEPRECATED FUNCTION ARGUMENTS',
        '(deprecated arguments)', [
            'SOME ARGUMENTS ARE DEPRECATED. '
            'They will be removed after %s.' % date,
            'Instructions for updating:'
        ])