format-docstring 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {format_docstring-0.3.0 → format_docstring-0.4.0}/.pre-commit-config.yaml +19 -6
- {format_docstring-0.3.0 → format_docstring-0.4.0}/CHANGELOG.md +13 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/PKG-INFO +46 -24
- {format_docstring-0.3.0 → format_docstring-0.4.0}/README.md +45 -23
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/config.py +105 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/docstring_rewriter.py +106 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/line_wrap_google.py +147 -24
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/line_wrap_numpy.py +138 -64
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/line_wrap_utils.py +22 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/main_jupyter.py +52 -1
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/main_py.py +51 -3
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/PKG-INFO +46 -24
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/SOURCES.txt +7 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/muff.toml +1 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/pyproject.toml +1 -1
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_config.py +243 -1
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/google/include_arg_defaults_false.txt +133 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/google/include_arg_types_and_defaults_false.txt +83 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/google/include_arg_types_and_defaults_true.txt +84 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/google/include_return_and_yield_types_false.txt +60 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/numpy/include_arg_defaults_false.txt +155 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/numpy/include_arg_types_and_defaults_false.txt +113 -0
- format_docstring-0.4.0/tests/test_data/end_to_end/cli_options/numpy/include_arg_types_and_defaults_true.txt +113 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_docstring_rewriter.py +233 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_line_wrap_google.py +22 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_line_wrap_numpy.py +73 -0
- format_docstring-0.4.0/tests/test_main_jupyter.py +344 -0
- format_docstring-0.4.0/tests/test_main_py.py +286 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tox.ini +2 -2
- format_docstring-0.3.0/tests/test_main_jupyter.py +0 -111
- format_docstring-0.3.0/tests/test_main_py.py +0 -111
- {format_docstring-0.3.0 → format_docstring-0.4.0}/.github/workflows/python-package.yml +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/.github/workflows/python-publish.yml +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/.gitignore +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/.pre-commit-hooks.yaml +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/AGENTS.md +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/LICENSE +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/__init__.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/base_fixer.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring/section_utils.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/dependency_links.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/entry_points.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/requires.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/format_docstring.egg-info/top_level.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/requirements.dev +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/setup.cfg +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/__init__.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/helpers.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_base_fixer.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/README.md +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/arg_name_is_default.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/class_attribute_type_comment_defaults.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/colon_spacing_fix.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/contents_that_are_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/custom_section_after_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/custom_section_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/custom_section_before_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/default_value_standardization.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/doctest_output_lines_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/empty_lines_are_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/examples_plain_code_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/examples_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/existing_linebreaks_should_not_be_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/fix_rst_backticks.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/four_level_nested_classes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/indent_four_levels_16_spaces_width_10.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/indent_misaligned_all.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/indent_two_levels_8_spaces.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/keyword_args_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/line_length_2.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/literal_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/literal_block_blank_lines_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/module_docstring_indent_zero_is_not_inferred.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/module_level_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/new_lines_before_and_after.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/no_format_docstring_comment.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/no_terminal_whitespace_only_line.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/non_ascii_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/non_ascii_single_line_length_boundary.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/param_signature_without_type.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/plain_examples_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/rST_cross_reference.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/returns_bare_type_with_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/returns_colon_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/returns_description_without_type_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/returns_signature_and_description.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/returns_yields_type_like_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/rst_code_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/section_headings_with_colons.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/section_title_fixed.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/sections_notes_examples.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_dont_sync_raises.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_line_is_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_sync_class_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_sync_parameters.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_sync_returns.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/signature_sync_yields.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/single_line_backtick_expansion_respects_line_length.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/single_line_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/tilde_code_fence_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/variadic_signature_without_colon.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/google/yields_iterator_item_type_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/README.md +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/arg_name_is_default.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/class_attribute_type_comment_defaults.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/colon_spacing_fix.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/contents_that_are_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/custom_section_after_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/custom_section_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/custom_section_before_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/default_value_standardization.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/doctest_output_lines_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/empty_lines_are_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/examples_plain_code_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/examples_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/fix_rst_backticks.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/four_level_nested_classes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/indent_misaligned_all.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/indent_two_levels_8_spaces.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/keyword_args_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/line_length_2.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/literal_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/literal_block_blank_lines_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/mismatched_underlines.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/mismatched_underlines_one_dash.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/mismatched_underlines_two_dashes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/module_docstring_indent_zero_is_not_inferred.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/module_level_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/new_lines_before_and_after.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/no_format_docstring_comment.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/no_terminal_whitespace_only_line.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/non_ascii_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/non_ascii_single_line_length_boundary.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/param_signature_without_type.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/plain_examples_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/rST_cross_reference.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/returns_bare_type_with_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/returns_colon_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/returns_description_without_type_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/returns_signature_and_description.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/returns_yields_type_like_description_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/rst_code_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/section_headings_with_colons.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/section_title_fixed.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/sections_notes_examples.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_dont_sync_raises.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_line_is_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_sync_class_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_sync_parameters.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_sync_returns.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/signature_sync_yields.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/single_line_backtick_expansion_respects_line_length.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/single_line_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/tilde_code_fence_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/variadic_signature_without_colon.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/end_to_end/numpy/yields_iterator_item_type_sync.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/after.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/after.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/after_50.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/after_50.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/before.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/google/before.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/after.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/after.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/after_50.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/after_50.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/before.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/integration_test/numpy/before.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/jupyter/before.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/jupyter/verbose_before.ipynb +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/README.md +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/arg_description_starts_with_bulleted_list.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/arg_description_starts_with_table.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/colon_spacing_fix.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/contents_that_are_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/custom_section_after_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/custom_section_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/custom_section_before_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/default_value_standardization.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/doctest_output_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/doctest_output_lines_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/doctest_output_section_headers_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/doctest_plain_output_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/empty_lines_are_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/examples_leading_comment_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/examples_plain_code_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/examples_plain_output_after_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/examples_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/existing_linebreaks_should_not_be_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/fenced_code_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/fix_rst_backticks.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/indent_four_levels_16_spaces_width_10.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/indent_two_levels_8_spaces.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/label_like_prose_in_notes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/line_length_2.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/literal_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/literal_block_blank_lines_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/literal_block_marker_double_colon_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/module_level_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/no_terminal_whitespace_only_line.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/non_ascii_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/param_signature_without_type.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/plain_examples_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/returns_signature_and_description.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/rst_code_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/section_headings_with_colons.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/section_title_fixed.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/sections_notes_examples.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/signature_line_is_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/tilde_code_fence_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/variadic_signature_without_colon.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/google/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/README.md +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/arg_description_starts_with_bulleted_list.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/arg_description_starts_with_table.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/colon_spacing_fix.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/contents_that_are_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/custom_section_after_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/custom_section_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/custom_section_before_args.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/default_value_standardization.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/doctest_output_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/doctest_output_lines_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/doctest_output_section_headers_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/doctest_plain_output_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/empty_lines_are_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/examples_leading_comment_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/examples_plain_code_after_doctest.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/examples_plain_output_after_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/examples_section.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/fenced_code_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/fix_rst_backticks.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/indent_two_levels_8_spaces.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/label_like_prose_in_notes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/line_length_2.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/literal_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/literal_block_blank_lines_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/literal_block_marker_double_colon_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/mismatched_underlines.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/mismatched_underlines_one_dash.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/mismatched_underlines_two_dashes.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/module_level_docstring.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/no_terminal_whitespace_only_line.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/non_ascii_docstrings.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/param_signature_without_type.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/plain_examples_code_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/returns_signature_and_description.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/rst_code_block_backticks_are_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/section_headings_with_colons.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/section_title_fixed.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/sections_notes_examples.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/signature_line_is_not_wrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/tilde_code_fence_is_preserved.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/variadic_signature_without_colon.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/line_wrap/numpy/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_data/playground.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_google_fixture_inventory.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_line_wrap_utils.py +0 -0
- {format_docstring-0.3.0 → format_docstring-0.4.0}/tests/test_playground.py +0 -0
|
@@ -17,7 +17,7 @@ repos:
|
|
|
17
17
|
exclude: ^tests/helpers\.py$
|
|
18
18
|
- id: check-merge-conflict
|
|
19
19
|
- repo: https://github.com/jsh9/muff-pre-commit
|
|
20
|
-
rev: 0.
|
|
20
|
+
rev: 0.15.20
|
|
21
21
|
hooks:
|
|
22
22
|
- id: muff-format
|
|
23
23
|
args: [--config, muff.toml]
|
|
@@ -27,11 +27,11 @@ repos:
|
|
|
27
27
|
- id: blank-line-after-blocks
|
|
28
28
|
- id: blank-line-after-blocks-jupyter
|
|
29
29
|
- repo: https://github.com/lyz-code/yamlfix
|
|
30
|
-
rev: 1.
|
|
30
|
+
rev: 1.19.1
|
|
31
31
|
hooks:
|
|
32
32
|
- id: yamlfix
|
|
33
33
|
- repo: https://github.com/pappasam/toml-sort
|
|
34
|
-
rev: v0.24.
|
|
34
|
+
rev: v0.24.4
|
|
35
35
|
hooks:
|
|
36
36
|
- id: toml-sort-fix
|
|
37
37
|
args:
|
|
@@ -42,7 +42,7 @@ repos:
|
|
|
42
42
|
- --trailing-comma-inline-array
|
|
43
43
|
- --sort-inline-arrays
|
|
44
44
|
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
|
45
|
-
rev: v2.
|
|
45
|
+
rev: v2.16.0
|
|
46
46
|
hooks:
|
|
47
47
|
- id: pretty-format-ini
|
|
48
48
|
args: [--autofix]
|
|
@@ -63,15 +63,28 @@ repos:
|
|
|
63
63
|
- --no-sort-keys
|
|
64
64
|
- --no-eof-newline
|
|
65
65
|
- repo: https://github.com/jsh9/markdown-toc-creator
|
|
66
|
-
rev: 0.1.
|
|
66
|
+
rev: 0.1.3
|
|
67
67
|
hooks:
|
|
68
68
|
- id: markdown-toc-creator
|
|
69
69
|
exclude: ^AGENTS\.md$|^CHANGELOG\.md$
|
|
70
70
|
- repo: https://github.com/jsh9/markdown-heading-numbering
|
|
71
|
-
rev: 0.1.
|
|
71
|
+
rev: 0.1.1
|
|
72
72
|
hooks:
|
|
73
73
|
- id: markdown-heading-numbering
|
|
74
74
|
exclude: ^CHANGELOG\.md$
|
|
75
|
+
- repo: https://github.com/jsh9/pre-commit-tox-version-sync
|
|
76
|
+
rev: 0.1.1
|
|
77
|
+
hooks:
|
|
78
|
+
- id: sync-precommit-tox-versions
|
|
79
|
+
args:
|
|
80
|
+
- --pre-commit-repo
|
|
81
|
+
- https://github.com/jsh9/muff-pre-commit
|
|
82
|
+
- --tox-env
|
|
83
|
+
- muff-lint
|
|
84
|
+
- --tox-env
|
|
85
|
+
- muff-format
|
|
86
|
+
- --tox-dep
|
|
87
|
+
- muff
|
|
75
88
|
- repo: local
|
|
76
89
|
hooks:
|
|
77
90
|
- id: format-docstring
|
|
@@ -6,6 +6,19 @@ The format is based on
|
|
|
6
6
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
7
7
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.4.0] - 2026-06-29
|
|
10
|
+
|
|
11
|
+
- Added
|
|
12
|
+
- CLI and `pyproject.toml` options to control whether argument types,
|
|
13
|
+
argument defaults, and Google return/yield types are included in docstring
|
|
14
|
+
signature lines for Python files and Jupyter notebooks.
|
|
15
|
+
- Fixed
|
|
16
|
+
- Google-style argument signature synchronization preserves existing
|
|
17
|
+
`required` metadata when source annotations replace stale docstring type
|
|
18
|
+
text.
|
|
19
|
+
- Full diff
|
|
20
|
+
- https://github.com/jsh9/format-docstring/compare/0.3.0...0.4.0
|
|
21
|
+
|
|
9
22
|
## [0.3.0] - 2026-06-19
|
|
10
23
|
|
|
11
24
|
- Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: format-docstring
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A Python formatter to wrap/adjust docstring lines
|
|
5
5
|
Author-email: jsh9 <25124332+jsh9@users.noreply.github.com>
|
|
6
6
|
Maintainer-email: jsh9 <25124332+jsh9@users.noreply.github.com>
|
|
@@ -68,18 +68,17 @@ ______________________________________________________________________
|
|
|
68
68
|
`format-docstring` is a tool that automatically formats and wraps docstring
|
|
69
69
|
content in Python files and Jupyter notebooks.
|
|
70
70
|
|
|
71
|
-
Baseline reflow corresponds to the common docstring cleanups offered by
|
|
72
|
-
general-purpose formatters: splitting one-line docstrings into the canonical
|
|
73
|
-
multi-line layout (triple quotes, blank line, summary), normalizing
|
|
74
|
-
indentation, and wrapping text at a fixed column width without applying extra
|
|
75
|
-
heuristics.
|
|
76
|
-
|
|
77
71
|
| Feature | `format-docstring` | [docformatter] | [pydocstringformatter] | [Ruff] | [Black] |
|
|
78
72
|
| ----------------------------------------- | ------------------ | -------------- | ---------------------- | ------ | ------- |
|
|
79
73
|
| Docstring wrapping | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
80
74
|
| Compatible with line length linter (E501) | ✅ | ❌ | ❌ | N/A | N/A |
|
|
81
75
|
| Fixes common docstring typos | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
82
76
|
|
|
77
|
+
For stronger docstring checks, use `format-docstring` together with
|
|
78
|
+
[`pydoclint`](https://github.com/jsh9/pydoclint). `format-docstring` handles
|
|
79
|
+
formatting and wrapping, while `pydoclint` checks docstring completeness and
|
|
80
|
+
consistency with function signatures.
|
|
81
|
+
|
|
83
82
|
## 2. Before vs After Examples
|
|
84
83
|
|
|
85
84
|
These examples show the same kinds of cleanup in the two supported docstring
|
|
@@ -567,22 +566,19 @@ leave that docstring untouched.
|
|
|
567
566
|
|
|
568
567
|
### 6.1. Command-Line Options
|
|
569
568
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
Command-line options take precedence over config file settings.
|
|
584
|
-
- `--version`: Show version information
|
|
585
|
-
- `--help`: Show help message
|
|
569
|
+
| Option | Default | Description |
|
|
570
|
+
| --------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
571
|
+
| `--line-length INTEGER` | `79` | Maximum line length for wrapping docstrings. |
|
|
572
|
+
| `--docstring-style CHOICE` | `numpy` | Docstring style to target, either `numpy` or `google`. This selects the style to format, not a converter between styles. |
|
|
573
|
+
| `--fix-rst-backticks BOOL` | `True` | Automatically fix single backticks to double backticks per rST syntax. Pass `False` to disable this. |
|
|
574
|
+
| `--include-arg-types BOOL` | `True` | Include argument type hints in parameter docstrings. Pass `False` to remove them from structured arg and attribute signature lines; defaults must also be disabled. |
|
|
575
|
+
| `--include-arg-defaults BOOL` | `True` | Include argument defaults in parameter docstrings. Pass `False` to remove explicit defaults and `optional` markers from structured arg and attribute signature lines. Requires argument types. |
|
|
576
|
+
| `--include-return-and-yield-types BOOL` | `True` | Include type hints in `Returns` and `Yields` docstrings. Pass `False` to remove them from Google-style return/yield descriptions. NumPy style does not allow `False`. |
|
|
577
|
+
| `--verbose CHOICE` | `default` | Logging detail level. `default` keeps the existing behaviour; `diff` prints unified diffs when rewrites happen. |
|
|
578
|
+
| `--exclude TEXT` | `\.git\|\.tox\|\.pytest_cache` | Regex pattern to exclude files/directories. |
|
|
579
|
+
| `--config PATH` | None | Path to a `pyproject.toml` config file. If not specified, the tool automatically searches for `pyproject.toml` in parent directories. Command-line options take precedence over config file settings. |
|
|
580
|
+
| `--version` | N/A | Show version information. |
|
|
581
|
+
| `--help` | N/A | Show help message. |
|
|
586
582
|
|
|
587
583
|
### 6.2. Usage Examples
|
|
588
584
|
|
|
@@ -613,6 +609,12 @@ format-docstring --config pyproject.toml --line-length 100 src/
|
|
|
613
609
|
|
|
614
610
|
# Disable backtick fixing
|
|
615
611
|
format-docstring --fix-rst-backticks=False my_module.py
|
|
612
|
+
|
|
613
|
+
# Omit argument defaults, including optional markers
|
|
614
|
+
format-docstring --include-arg-defaults=False src/
|
|
615
|
+
|
|
616
|
+
# Omit Google-style return/yield type text when annotations carry the types
|
|
617
|
+
format-docstring --docstring-style google --include-return-and-yield-types=False src/
|
|
616
618
|
```
|
|
617
619
|
|
|
618
620
|
### 6.3. `pyproject.toml` Configuration
|
|
@@ -627,17 +629,24 @@ as `line-length`.
|
|
|
627
629
|
line_length = 79
|
|
628
630
|
docstring_style = "numpy"
|
|
629
631
|
fix_rst_backticks = true
|
|
632
|
+
include_arg_types = true
|
|
633
|
+
include_arg_defaults = true
|
|
634
|
+
include_return_and_yield_types = true
|
|
630
635
|
exclude = "\\.git|\\.venv|__pycache__"
|
|
631
636
|
verbose = "default" # or "diff" to print unified diffs
|
|
632
637
|
```
|
|
633
638
|
|
|
634
|
-
For Google-style docstrings
|
|
639
|
+
For Google-style docstrings that omit argument types/defaults and return/yield
|
|
640
|
+
types:
|
|
635
641
|
|
|
636
642
|
```toml
|
|
637
643
|
[tool.format_docstring]
|
|
638
644
|
docstring_style = "google"
|
|
639
645
|
line_length = 79
|
|
640
646
|
fix_rst_backticks = true
|
|
647
|
+
include_arg_types = false
|
|
648
|
+
include_arg_defaults = false
|
|
649
|
+
include_return_and_yield_types = false
|
|
641
650
|
```
|
|
642
651
|
|
|
643
652
|
**Available options:**
|
|
@@ -648,6 +657,19 @@ fix_rst_backticks = true
|
|
|
648
657
|
`"numpy"` or `"google"`. Default: `"numpy"`.
|
|
649
658
|
- `fix_rst_backticks` / `fix-rst-backticks` (bool): whether to convert single
|
|
650
659
|
backticks in prose to double backticks per rST syntax. Default: `true`.
|
|
660
|
+
- `include_arg_types` / `include-arg-types` (bool): whether to include argument
|
|
661
|
+
type hints in parameter docstrings. Default: `true`. If this is `false`,
|
|
662
|
+
`include_arg_defaults` must also be `false`.
|
|
663
|
+
- `include_arg_defaults` / `include-arg-defaults` (bool): whether to include
|
|
664
|
+
argument defaults in parameter docstrings. Default: `true`. This requires
|
|
665
|
+
`include_arg_types = true`. When set to `false`, explicit defaults and
|
|
666
|
+
`optional` markers are removed from structured signatures, including compact
|
|
667
|
+
or extra-spaced forms such as `,optional` and `, optional`. For example,
|
|
668
|
+
`x : int, optional` becomes `x : int` and `x (int, optional):` becomes
|
|
669
|
+
`x (int):`.
|
|
670
|
+
- `include_return_and_yield_types` / `include-return-and-yield-types` (bool):
|
|
671
|
+
whether to include return and yield type hints in docstrings. Default:
|
|
672
|
+
`true`. Setting this to `false` is supported only with Google style.
|
|
651
673
|
- `exclude` (str): regex pattern used to skip files or directories. Default:
|
|
652
674
|
`"\\.git|\\.tox|\\.pytest_cache"`.
|
|
653
675
|
- `verbose` (str): logging detail level, either `"default"` or `"diff"`. Use
|
|
@@ -36,18 +36,17 @@ ______________________________________________________________________
|
|
|
36
36
|
`format-docstring` is a tool that automatically formats and wraps docstring
|
|
37
37
|
content in Python files and Jupyter notebooks.
|
|
38
38
|
|
|
39
|
-
Baseline reflow corresponds to the common docstring cleanups offered by
|
|
40
|
-
general-purpose formatters: splitting one-line docstrings into the canonical
|
|
41
|
-
multi-line layout (triple quotes, blank line, summary), normalizing
|
|
42
|
-
indentation, and wrapping text at a fixed column width without applying extra
|
|
43
|
-
heuristics.
|
|
44
|
-
|
|
45
39
|
| Feature | `format-docstring` | [docformatter] | [pydocstringformatter] | [Ruff] | [Black] |
|
|
46
40
|
| ----------------------------------------- | ------------------ | -------------- | ---------------------- | ------ | ------- |
|
|
47
41
|
| Docstring wrapping | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
48
42
|
| Compatible with line length linter (E501) | ✅ | ❌ | ❌ | N/A | N/A |
|
|
49
43
|
| Fixes common docstring typos | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
50
44
|
|
|
45
|
+
For stronger docstring checks, use `format-docstring` together with
|
|
46
|
+
[`pydoclint`](https://github.com/jsh9/pydoclint). `format-docstring` handles
|
|
47
|
+
formatting and wrapping, while `pydoclint` checks docstring completeness and
|
|
48
|
+
consistency with function signatures.
|
|
49
|
+
|
|
51
50
|
## 2. Before vs After Examples
|
|
52
51
|
|
|
53
52
|
These examples show the same kinds of cleanup in the two supported docstring
|
|
@@ -535,22 +534,19 @@ leave that docstring untouched.
|
|
|
535
534
|
|
|
536
535
|
### 6.1. Command-Line Options
|
|
537
536
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
Command-line options take precedence over config file settings.
|
|
552
|
-
- `--version`: Show version information
|
|
553
|
-
- `--help`: Show help message
|
|
537
|
+
| Option | Default | Description |
|
|
538
|
+
| --------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
539
|
+
| `--line-length INTEGER` | `79` | Maximum line length for wrapping docstrings. |
|
|
540
|
+
| `--docstring-style CHOICE` | `numpy` | Docstring style to target, either `numpy` or `google`. This selects the style to format, not a converter between styles. |
|
|
541
|
+
| `--fix-rst-backticks BOOL` | `True` | Automatically fix single backticks to double backticks per rST syntax. Pass `False` to disable this. |
|
|
542
|
+
| `--include-arg-types BOOL` | `True` | Include argument type hints in parameter docstrings. Pass `False` to remove them from structured arg and attribute signature lines; defaults must also be disabled. |
|
|
543
|
+
| `--include-arg-defaults BOOL` | `True` | Include argument defaults in parameter docstrings. Pass `False` to remove explicit defaults and `optional` markers from structured arg and attribute signature lines. Requires argument types. |
|
|
544
|
+
| `--include-return-and-yield-types BOOL` | `True` | Include type hints in `Returns` and `Yields` docstrings. Pass `False` to remove them from Google-style return/yield descriptions. NumPy style does not allow `False`. |
|
|
545
|
+
| `--verbose CHOICE` | `default` | Logging detail level. `default` keeps the existing behaviour; `diff` prints unified diffs when rewrites happen. |
|
|
546
|
+
| `--exclude TEXT` | `\.git\|\.tox\|\.pytest_cache` | Regex pattern to exclude files/directories. |
|
|
547
|
+
| `--config PATH` | None | Path to a `pyproject.toml` config file. If not specified, the tool automatically searches for `pyproject.toml` in parent directories. Command-line options take precedence over config file settings. |
|
|
548
|
+
| `--version` | N/A | Show version information. |
|
|
549
|
+
| `--help` | N/A | Show help message. |
|
|
554
550
|
|
|
555
551
|
### 6.2. Usage Examples
|
|
556
552
|
|
|
@@ -581,6 +577,12 @@ format-docstring --config pyproject.toml --line-length 100 src/
|
|
|
581
577
|
|
|
582
578
|
# Disable backtick fixing
|
|
583
579
|
format-docstring --fix-rst-backticks=False my_module.py
|
|
580
|
+
|
|
581
|
+
# Omit argument defaults, including optional markers
|
|
582
|
+
format-docstring --include-arg-defaults=False src/
|
|
583
|
+
|
|
584
|
+
# Omit Google-style return/yield type text when annotations carry the types
|
|
585
|
+
format-docstring --docstring-style google --include-return-and-yield-types=False src/
|
|
584
586
|
```
|
|
585
587
|
|
|
586
588
|
### 6.3. `pyproject.toml` Configuration
|
|
@@ -595,17 +597,24 @@ as `line-length`.
|
|
|
595
597
|
line_length = 79
|
|
596
598
|
docstring_style = "numpy"
|
|
597
599
|
fix_rst_backticks = true
|
|
600
|
+
include_arg_types = true
|
|
601
|
+
include_arg_defaults = true
|
|
602
|
+
include_return_and_yield_types = true
|
|
598
603
|
exclude = "\\.git|\\.venv|__pycache__"
|
|
599
604
|
verbose = "default" # or "diff" to print unified diffs
|
|
600
605
|
```
|
|
601
606
|
|
|
602
|
-
For Google-style docstrings
|
|
607
|
+
For Google-style docstrings that omit argument types/defaults and return/yield
|
|
608
|
+
types:
|
|
603
609
|
|
|
604
610
|
```toml
|
|
605
611
|
[tool.format_docstring]
|
|
606
612
|
docstring_style = "google"
|
|
607
613
|
line_length = 79
|
|
608
614
|
fix_rst_backticks = true
|
|
615
|
+
include_arg_types = false
|
|
616
|
+
include_arg_defaults = false
|
|
617
|
+
include_return_and_yield_types = false
|
|
609
618
|
```
|
|
610
619
|
|
|
611
620
|
**Available options:**
|
|
@@ -616,6 +625,19 @@ fix_rst_backticks = true
|
|
|
616
625
|
`"numpy"` or `"google"`. Default: `"numpy"`.
|
|
617
626
|
- `fix_rst_backticks` / `fix-rst-backticks` (bool): whether to convert single
|
|
618
627
|
backticks in prose to double backticks per rST syntax. Default: `true`.
|
|
628
|
+
- `include_arg_types` / `include-arg-types` (bool): whether to include argument
|
|
629
|
+
type hints in parameter docstrings. Default: `true`. If this is `false`,
|
|
630
|
+
`include_arg_defaults` must also be `false`.
|
|
631
|
+
- `include_arg_defaults` / `include-arg-defaults` (bool): whether to include
|
|
632
|
+
argument defaults in parameter docstrings. Default: `true`. This requires
|
|
633
|
+
`include_arg_types = true`. When set to `false`, explicit defaults and
|
|
634
|
+
`optional` markers are removed from structured signatures, including compact
|
|
635
|
+
or extra-spaced forms such as `,optional` and `, optional`. For example,
|
|
636
|
+
`x : int, optional` becomes `x : int` and `x (int, optional):` becomes
|
|
637
|
+
`x (int):`.
|
|
638
|
+
- `include_return_and_yield_types` / `include-return-and-yield-types` (bool):
|
|
639
|
+
whether to include return and yield type hints in docstrings. Default:
|
|
640
|
+
`true`. Setting this to `false` is supported only with Google style.
|
|
619
641
|
- `exclude` (str): regex pattern used to skip files or directories. Default:
|
|
620
642
|
`"\\.git|\\.tox|\\.pytest_cache"`.
|
|
621
643
|
- `verbose` (str): logging detail level, either `"default"` or `"diff"`. Use
|
|
@@ -19,6 +19,9 @@ _VALUE_OPTIONS = frozenset({
|
|
|
19
19
|
'--docstring-style',
|
|
20
20
|
'--exclude',
|
|
21
21
|
'--fix-rst-backticks',
|
|
22
|
+
'--include-arg-defaults',
|
|
23
|
+
'--include-arg-types',
|
|
24
|
+
'--include-return-and-yield-types',
|
|
22
25
|
'--line-length',
|
|
23
26
|
'--verbose',
|
|
24
27
|
})
|
|
@@ -51,6 +54,108 @@ class ConfigFileCommand(click.Command):
|
|
|
51
54
|
return super().parse_args(ctx, args)
|
|
52
55
|
|
|
53
56
|
|
|
57
|
+
def validate_cli_include_options(
|
|
58
|
+
docstring_style: str,
|
|
59
|
+
*,
|
|
60
|
+
include_arg_types: bool,
|
|
61
|
+
include_arg_defaults: bool,
|
|
62
|
+
include_return_and_yield_types: bool,
|
|
63
|
+
) -> None:
|
|
64
|
+
"""
|
|
65
|
+
Validate cross-option rules for Click entrypoints.
|
|
66
|
+
|
|
67
|
+
This runs before fixer construction so invalid CLI/config combinations fail
|
|
68
|
+
before a multi-path invocation can rewrite any files or notebooks.
|
|
69
|
+
|
|
70
|
+
Parameters
|
|
71
|
+
----------
|
|
72
|
+
docstring_style : str
|
|
73
|
+
The selected docstring style.
|
|
74
|
+
include_arg_types : bool
|
|
75
|
+
Whether argument type hints should be included in docstrings.
|
|
76
|
+
include_arg_defaults : bool
|
|
77
|
+
Whether argument defaults should be included in docstrings.
|
|
78
|
+
include_return_and_yield_types : bool
|
|
79
|
+
Whether return and yield type hints should be included in docstrings.
|
|
80
|
+
"""
|
|
81
|
+
validate_cli_include_arg_defaults(
|
|
82
|
+
include_arg_types=include_arg_types,
|
|
83
|
+
include_arg_defaults=include_arg_defaults,
|
|
84
|
+
)
|
|
85
|
+
validate_cli_include_return_and_yield_types(
|
|
86
|
+
docstring_style,
|
|
87
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def validate_cli_include_arg_defaults(
|
|
92
|
+
*,
|
|
93
|
+
include_arg_types: bool,
|
|
94
|
+
include_arg_defaults: bool,
|
|
95
|
+
) -> None:
|
|
96
|
+
"""
|
|
97
|
+
Validate argument defaults are not emitted without argument types.
|
|
98
|
+
|
|
99
|
+
Defaults are rendered inside the same signature slot as types, so allowing
|
|
100
|
+
defaults alone would produce non-standard lines such as ``arg : default=3``
|
|
101
|
+
or ``arg (default=3):``.
|
|
102
|
+
|
|
103
|
+
Parameters
|
|
104
|
+
----------
|
|
105
|
+
include_arg_types : bool
|
|
106
|
+
Whether argument type hints should be included in docstrings.
|
|
107
|
+
include_arg_defaults : bool
|
|
108
|
+
Whether argument defaults should be included in docstrings.
|
|
109
|
+
|
|
110
|
+
Raises
|
|
111
|
+
------
|
|
112
|
+
click.UsageError
|
|
113
|
+
If defaults are requested while argument types are omitted.
|
|
114
|
+
"""
|
|
115
|
+
if include_arg_types or not include_arg_defaults:
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
msg = (
|
|
119
|
+
'--include-arg-defaults=True requires --include-arg-types=True. '
|
|
120
|
+
'Set --include-arg-defaults=False when omitting argument types.'
|
|
121
|
+
)
|
|
122
|
+
raise click.UsageError(msg)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def validate_cli_include_return_and_yield_types(
|
|
126
|
+
docstring_style: str,
|
|
127
|
+
*,
|
|
128
|
+
include_return_and_yield_types: bool,
|
|
129
|
+
) -> None:
|
|
130
|
+
"""
|
|
131
|
+
Validate return/yield type suppression for Click entrypoints.
|
|
132
|
+
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
docstring_style : str
|
|
136
|
+
The selected docstring style.
|
|
137
|
+
include_return_and_yield_types : bool
|
|
138
|
+
Whether return and yield type hints should be included in docstrings.
|
|
139
|
+
|
|
140
|
+
Raises
|
|
141
|
+
------
|
|
142
|
+
click.UsageError
|
|
143
|
+
If return/yield type suppression is requested for NumPy docstrings.
|
|
144
|
+
"""
|
|
145
|
+
if (
|
|
146
|
+
include_return_and_yield_types
|
|
147
|
+
or docstring_style.strip().lower() != 'numpy'
|
|
148
|
+
):
|
|
149
|
+
return
|
|
150
|
+
|
|
151
|
+
msg = (
|
|
152
|
+
'--include-return-and-yield-types=False is only supported for '
|
|
153
|
+
'Google-style docstrings because NumPy/numpydoc requires return '
|
|
154
|
+
'and yield type lines.'
|
|
155
|
+
)
|
|
156
|
+
raise click.UsageError(msg)
|
|
157
|
+
|
|
158
|
+
|
|
54
159
|
def _find_config_for_raw_args(args: list[str]) -> Path | None:
|
|
55
160
|
"""
|
|
56
161
|
Resolve the config file implied by raw CLI arguments.
|
|
@@ -12,6 +12,7 @@ from format_docstring.line_wrap_numpy import (
|
|
|
12
12
|
handle_single_line_docstring,
|
|
13
13
|
wrap_docstring_numpy,
|
|
14
14
|
)
|
|
15
|
+
from format_docstring.line_wrap_utils import validate_include_arg_defaults
|
|
15
16
|
|
|
16
17
|
if TYPE_CHECKING:
|
|
17
18
|
from format_docstring.line_wrap_utils import ParameterMetadata
|
|
@@ -309,6 +310,9 @@ def fix_src(
|
|
|
309
310
|
line_length: int = 79,
|
|
310
311
|
docstring_style: str = 'numpy',
|
|
311
312
|
fix_rst_backticks: bool = True,
|
|
313
|
+
include_arg_types: bool = True,
|
|
314
|
+
include_arg_defaults: bool = True,
|
|
315
|
+
include_return_and_yield_types: bool = True,
|
|
312
316
|
) -> str:
|
|
313
317
|
"""
|
|
314
318
|
Return code with only docstrings updated to wrapped content.
|
|
@@ -324,6 +328,13 @@ def fix_src(
|
|
|
324
328
|
fix_rst_backticks : bool, default=True
|
|
325
329
|
If True, automatically fix single backticks to double backticks per rST
|
|
326
330
|
syntax.
|
|
331
|
+
include_arg_types : bool, default=True
|
|
332
|
+
If True, include argument type hints in parameter docstrings.
|
|
333
|
+
include_arg_defaults : bool, default=True
|
|
334
|
+
If True, include argument defaults in parameter docstrings.
|
|
335
|
+
include_return_and_yield_types : bool, default=True
|
|
336
|
+
If True, include return and yield type hints in docstrings. This can
|
|
337
|
+
only be disabled for Google-style docstrings.
|
|
327
338
|
|
|
328
339
|
Returns
|
|
329
340
|
-------
|
|
@@ -337,6 +348,12 @@ def fix_src(
|
|
|
337
348
|
spans directly in the original text to preserve non-docstring formatting
|
|
338
349
|
and comments.
|
|
339
350
|
"""
|
|
351
|
+
_validate_include_options(
|
|
352
|
+
docstring_style,
|
|
353
|
+
include_arg_types=include_arg_types,
|
|
354
|
+
include_arg_defaults=include_arg_defaults,
|
|
355
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
356
|
+
)
|
|
340
357
|
tree: ast.Module = ast.parse(source_code, type_comments=True)
|
|
341
358
|
line_starts: list[int] = calc_line_starts(source_code)
|
|
342
359
|
|
|
@@ -351,6 +368,9 @@ def fix_src(
|
|
|
351
368
|
line_length=line_length,
|
|
352
369
|
docstring_style=docstring_style,
|
|
353
370
|
fix_rst_backticks=fix_rst_backticks,
|
|
371
|
+
include_arg_types=include_arg_types,
|
|
372
|
+
include_arg_defaults=include_arg_defaults,
|
|
373
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
354
374
|
)
|
|
355
375
|
if replacement is not None:
|
|
356
376
|
replacements.append(replacement)
|
|
@@ -367,6 +387,9 @@ def fix_src(
|
|
|
367
387
|
line_length=line_length,
|
|
368
388
|
docstring_style=docstring_style,
|
|
369
389
|
fix_rst_backticks=fix_rst_backticks,
|
|
390
|
+
include_arg_types=include_arg_types,
|
|
391
|
+
include_arg_defaults=include_arg_defaults,
|
|
392
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
370
393
|
)
|
|
371
394
|
if replacement is not None:
|
|
372
395
|
replacements.append(replacement)
|
|
@@ -414,6 +437,9 @@ def build_replacement_docstring(
|
|
|
414
437
|
line_length: int,
|
|
415
438
|
docstring_style: str = 'numpy',
|
|
416
439
|
fix_rst_backticks: bool = True,
|
|
440
|
+
include_arg_types: bool = True,
|
|
441
|
+
include_arg_defaults: bool = True,
|
|
442
|
+
include_return_and_yield_types: bool = True,
|
|
417
443
|
) -> tuple[int, int, str] | None:
|
|
418
444
|
"""
|
|
419
445
|
Compute a single docstring replacement for the given node.
|
|
@@ -433,6 +459,13 @@ def build_replacement_docstring(
|
|
|
433
459
|
fix_rst_backticks : bool, default=True
|
|
434
460
|
If True, automatically fix single backticks to double backticks per rST
|
|
435
461
|
syntax.
|
|
462
|
+
include_arg_types : bool, default=True
|
|
463
|
+
If True, include argument type hints in parameter docstrings.
|
|
464
|
+
include_arg_defaults : bool, default=True
|
|
465
|
+
If True, include argument defaults in parameter docstrings.
|
|
466
|
+
include_return_and_yield_types : bool, default=True
|
|
467
|
+
If True, include return and yield type hints in docstrings. This can
|
|
468
|
+
only be disabled for Google-style docstrings.
|
|
436
469
|
|
|
437
470
|
Returns
|
|
438
471
|
-------
|
|
@@ -532,6 +565,9 @@ def build_replacement_docstring(
|
|
|
532
565
|
function_param_metadata=param_metadata,
|
|
533
566
|
function_return_annotation=return_annotation,
|
|
534
567
|
class_attribute_metadata=attribute_metadata,
|
|
568
|
+
include_arg_types=include_arg_types,
|
|
569
|
+
include_arg_defaults=include_arg_defaults,
|
|
570
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
535
571
|
compact_google_docstring=True,
|
|
536
572
|
append_google_closing_indent=True,
|
|
537
573
|
)
|
|
@@ -686,6 +722,9 @@ def wrap_docstring(
|
|
|
686
722
|
function_param_metadata: ParameterMetadata | None = None,
|
|
687
723
|
function_return_annotation: str | None = None,
|
|
688
724
|
class_attribute_metadata: ParameterMetadata | None = None,
|
|
725
|
+
include_arg_types: bool = True,
|
|
726
|
+
include_arg_defaults: bool = True,
|
|
727
|
+
include_return_and_yield_types: bool = True,
|
|
689
728
|
compact_google_docstring: bool = False,
|
|
690
729
|
append_google_closing_indent: bool = False,
|
|
691
730
|
) -> str:
|
|
@@ -716,6 +755,13 @@ def wrap_docstring(
|
|
|
716
755
|
class_attribute_metadata : ParameterMetadata | None, default=None
|
|
717
756
|
Attribute metadata for class docstrings (names mapped to annotations
|
|
718
757
|
and default values) collected from class-level assignments.
|
|
758
|
+
include_arg_types : bool, default=True
|
|
759
|
+
If True, include argument type hints in parameter docstrings.
|
|
760
|
+
include_arg_defaults : bool, default=True
|
|
761
|
+
If True, include argument defaults in parameter docstrings.
|
|
762
|
+
include_return_and_yield_types : bool, default=True
|
|
763
|
+
If True, include return and yield type hints in docstrings. This can
|
|
764
|
+
only be disabled for Google-style docstrings.
|
|
719
765
|
compact_google_docstring : bool, default=False
|
|
720
766
|
If True, Google-style wrapping may place the first summary line beside
|
|
721
767
|
the opening quotes when indentation allows it.
|
|
@@ -735,6 +781,12 @@ def wrap_docstring(
|
|
|
735
781
|
- 'google' -> wrap_docstring_google
|
|
736
782
|
"""
|
|
737
783
|
style = (docstring_style or '').strip().lower()
|
|
784
|
+
_validate_include_options(
|
|
785
|
+
style,
|
|
786
|
+
include_arg_types=include_arg_types,
|
|
787
|
+
include_arg_defaults=include_arg_defaults,
|
|
788
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
789
|
+
)
|
|
738
790
|
# Normalize once so style-specific code can preserve the difference between
|
|
739
791
|
# omitted indentation, explicit module-level zero, and explicit ``None``.
|
|
740
792
|
leading_indent_was_unset = leading_indent is _LEADING_INDENT_UNSET
|
|
@@ -761,6 +813,9 @@ def wrap_docstring(
|
|
|
761
813
|
parameter_metadata=function_param_metadata,
|
|
762
814
|
return_annotation=function_return_annotation,
|
|
763
815
|
attribute_metadata=class_attribute_metadata,
|
|
816
|
+
include_arg_types=include_arg_types,
|
|
817
|
+
include_arg_defaults=include_arg_defaults,
|
|
818
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
764
819
|
compact_first_line=compact_google_docstring,
|
|
765
820
|
)
|
|
766
821
|
# Default to NumPy-style for unknown/unspecified styles to be permissive.
|
|
@@ -775,4 +830,55 @@ def wrap_docstring(
|
|
|
775
830
|
parameter_metadata=function_param_metadata,
|
|
776
831
|
attribute_metadata=class_attribute_metadata,
|
|
777
832
|
return_annotation=function_return_annotation,
|
|
833
|
+
include_arg_types=include_arg_types,
|
|
834
|
+
include_arg_defaults=include_arg_defaults,
|
|
835
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
836
|
+
)
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
def _validate_include_options(
|
|
840
|
+
docstring_style: str,
|
|
841
|
+
*,
|
|
842
|
+
include_arg_types: bool,
|
|
843
|
+
include_arg_defaults: bool,
|
|
844
|
+
include_return_and_yield_types: bool,
|
|
845
|
+
) -> None:
|
|
846
|
+
"""
|
|
847
|
+
Validate cross-option rules for direct formatter API calls.
|
|
848
|
+
|
|
849
|
+
CLI entrypoints validate before constructing fixers, but library callers
|
|
850
|
+
can call ``fix_src`` or ``wrap_docstring`` directly. Keep the same option
|
|
851
|
+
contract at this boundary before any wrapping logic can run.
|
|
852
|
+
"""
|
|
853
|
+
validate_include_arg_defaults(
|
|
854
|
+
include_arg_types=include_arg_types,
|
|
855
|
+
include_arg_defaults=include_arg_defaults,
|
|
856
|
+
)
|
|
857
|
+
_validate_include_return_and_yield_types(
|
|
858
|
+
docstring_style,
|
|
859
|
+
include_return_and_yield_types=include_return_and_yield_types,
|
|
860
|
+
)
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
def _validate_include_return_and_yield_types(
|
|
864
|
+
docstring_style: str,
|
|
865
|
+
*,
|
|
866
|
+
include_return_and_yield_types: bool,
|
|
867
|
+
) -> None:
|
|
868
|
+
"""
|
|
869
|
+
Validate return/yield type suppression is only used for Google style.
|
|
870
|
+
|
|
871
|
+
CLI entrypoints check this before touching files, but direct API callers
|
|
872
|
+
can bypass Click; this keeps the formatter's public API aligned with the
|
|
873
|
+
same numpydoc strictness rule.
|
|
874
|
+
"""
|
|
875
|
+
style = (docstring_style or '').strip().lower()
|
|
876
|
+
if include_return_and_yield_types or style == 'google':
|
|
877
|
+
return
|
|
878
|
+
|
|
879
|
+
msg = (
|
|
880
|
+
'include_return_and_yield_types=False is only supported for '
|
|
881
|
+
'Google-style docstrings because NumPy/numpydoc requires return and '
|
|
882
|
+
'yield type lines.'
|
|
778
883
|
)
|
|
884
|
+
raise ValueError(msg)
|