format-docstring 0.1.0__tar.gz → 0.1.1__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.
Files changed (94) hide show
  1. format_docstring-0.1.1/CHANGELOG.md +30 -0
  2. {format_docstring-0.1.0 → format_docstring-0.1.1}/PKG-INFO +1 -1
  3. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/docstring_rewriter.py +2 -2
  4. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_numpy.py +15 -2
  5. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/PKG-INFO +1 -1
  6. {format_docstring-0.1.0 → format_docstring-0.1.1}/pyproject.toml +1 -1
  7. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/new_lines_before_and_after.txt +15 -0
  8. format_docstring-0.1.0/CHANGELOG.md +0 -14
  9. {format_docstring-0.1.0 → format_docstring-0.1.1}/.github/workflows/python-package.yml +0 -0
  10. {format_docstring-0.1.0 → format_docstring-0.1.1}/.github/workflows/python-publish.yml +0 -0
  11. {format_docstring-0.1.0 → format_docstring-0.1.1}/.gitignore +0 -0
  12. {format_docstring-0.1.0 → format_docstring-0.1.1}/.pre-commit-config.yaml +0 -0
  13. {format_docstring-0.1.0 → format_docstring-0.1.1}/.pre-commit-hooks.yaml +0 -0
  14. {format_docstring-0.1.0 → format_docstring-0.1.1}/CLAUDE.md +0 -0
  15. {format_docstring-0.1.0 → format_docstring-0.1.1}/LICENSE +0 -0
  16. {format_docstring-0.1.0 → format_docstring-0.1.1}/README.md +0 -0
  17. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/__init__.py +0 -0
  18. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/base_fixer.py +0 -0
  19. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/config.py +0 -0
  20. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_google.py +0 -0
  21. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_utils.py +0 -0
  22. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/main_jupyter.py +0 -0
  23. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/main_py.py +0 -0
  24. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/SOURCES.txt +0 -0
  25. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/dependency_links.txt +0 -0
  26. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/entry_points.txt +0 -0
  27. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/requires.txt +0 -0
  28. {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/top_level.txt +0 -0
  29. {format_docstring-0.1.0 → format_docstring-0.1.1}/muff.toml +0 -0
  30. {format_docstring-0.1.0 → format_docstring-0.1.1}/requirements.dev +0 -0
  31. {format_docstring-0.1.0 → format_docstring-0.1.1}/setup.cfg +0 -0
  32. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/__init__.py +0 -0
  33. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/helpers.py +0 -0
  34. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_config.py +0 -0
  35. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/README.md +0 -0
  36. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/colon_spacing_fix.txt +0 -0
  37. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/contents_that_are_not_wrapped.txt +0 -0
  38. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/default_value_standardization.txt +0 -0
  39. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/empty_lines_are_respected.txt +0 -0
  40. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
  41. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/four_level_nested_classes.txt +0 -0
  42. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
  43. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/indent_misaligned_all.txt +0 -0
  44. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/indent_two_levels_8_spaces.txt +0 -0
  45. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/line_length_2.txt +0 -0
  46. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines.txt +0 -0
  47. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines_one_dash.txt +0 -0
  48. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines_two_dashes.txt +0 -0
  49. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/module_level_docstring.txt +0 -0
  50. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/param_signature_without_type.txt +0 -0
  51. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/parameters_returns_raises_wrapping.txt +0 -0
  52. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/returns_signature_and_description.txt +0 -0
  53. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/section_title_fixed.txt +0 -0
  54. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/sections_notes_examples.txt +0 -0
  55. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/signature_line_is_not_wrapped.txt +0 -0
  56. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/single_line_docstring.txt +0 -0
  57. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/texts_are_rewrapped.txt +0 -0
  58. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/very_long_unbreakable_word.txt +0 -0
  59. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.ipynb +0 -0
  60. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.py +0 -0
  61. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after_50.ipynb +0 -0
  62. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after_50.py +0 -0
  63. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/before.ipynb +0 -0
  64. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/before.py +0 -0
  65. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/README.md +0 -0
  66. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/colon_spacing_fix.txt +0 -0
  67. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/contents_that_are_not_wrapped.txt +0 -0
  68. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/default_value_standardization.txt +0 -0
  69. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/empty_lines_are_respected.txt +0 -0
  70. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
  71. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
  72. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/indent_two_levels_8_spaces.txt +0 -0
  73. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/line_length_2.txt +0 -0
  74. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines.txt +0 -0
  75. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines_one_dash.txt +0 -0
  76. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines_two_dashes.txt +0 -0
  77. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/module_level_docstring.txt +0 -0
  78. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/param_signature_without_type.txt +0 -0
  79. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/parameters_returns_raises_wrapping.txt +0 -0
  80. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/returns_signature_and_description.txt +0 -0
  81. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/section_title_fixed.txt +0 -0
  82. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/sections_notes_examples.txt +0 -0
  83. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/signature_line_is_not_wrapped.txt +0 -0
  84. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/texts_are_rewrapped.txt +0 -0
  85. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/very_long_unbreakable_word.txt +0 -0
  86. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/playground.py +0 -0
  87. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_docstring_rewriter.py +0 -0
  88. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_google.py +0 -0
  89. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_numpy.py +0 -0
  90. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_utils.py +0 -0
  91. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_main_jupyter.py +0 -0
  92. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_main_py.py +0 -0
  93. {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_playground.py +0 -0
  94. {format_docstring-0.1.0 → format_docstring-0.1.1}/tox.ini +0 -0
@@ -0,0 +1,30 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on
6
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
7
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [0.1.1] - 2025-10-06
10
+
11
+ - Fixed
12
+ - A bug where single-line docstrings exceeding length limit aren't handled
13
+ - Full diff
14
+ - https://github.com/jsh9/format-docstring/compare/0.1.0...0.1.1
15
+
16
+ ## [0.1.0] - 2025-10-06
17
+
18
+ - Added
19
+ - Initial release of format-docstring
20
+ - Support for NumPy-style docstring formatting
21
+ - Limited support for Google-style docstrings
22
+ - CLI tools: `format-docstring` and `format-docstring-jupyter`
23
+ - Configuration via `pyproject.toml` with `[tool.format_docstring]` section
24
+ - Options for line length, docstring style, and file exclusion patterns
25
+ - Pre-commit hooks for Python files and Jupyter notebooks
26
+ - Comprehensive test suite with pytest
27
+ - Type checking with mypy
28
+ - Support for Python 3.10-3.12
29
+ - Full diff
30
+ - N/A
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: format-docstring
3
- Version: 0.1.0
3
+ Version: 0.1.1
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>
@@ -4,7 +4,7 @@ import ast
4
4
 
5
5
  from format_docstring.line_wrap_google import wrap_docstring_google
6
6
  from format_docstring.line_wrap_numpy import (
7
- handle_single_line_docstring_that_is_a_bit_too_long,
7
+ handle_single_line_docstring,
8
8
  wrap_docstring_numpy,
9
9
  )
10
10
 
@@ -168,7 +168,7 @@ def build_replacement_docstring(
168
168
 
169
169
  new_literal: str | None = rebuild_literal(original_literal, wrapped)
170
170
 
171
- new_literal = handle_single_line_docstring_that_is_a_bit_too_long(
171
+ new_literal = handle_single_line_docstring(
172
172
  whole_docstring_literal=new_literal,
173
173
  docstring_content=wrapped,
174
174
  docstring_starting_col=val.col_offset,
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import re
4
+ import textwrap
4
5
 
5
6
  from format_docstring.line_wrap_utils import (
6
7
  add_leading_indent,
@@ -358,7 +359,7 @@ def _standardize_default_value(line: str) -> str:
358
359
  return line
359
360
 
360
361
 
361
- def handle_single_line_docstring_that_is_a_bit_too_long(
362
+ def handle_single_line_docstring(
362
363
  whole_docstring_literal: str | None,
363
364
  docstring_content: str,
364
365
  docstring_starting_col: int,
@@ -382,6 +383,18 @@ def handle_single_line_docstring_that_is_a_bit_too_long(
382
383
  prefix: str = parts[0]
383
384
  postfix: str = parts[-1]
384
385
  indent: str = ' ' * num_leading_indent
385
- return f'{prefix}\n{indent}{docstring_content}\n{indent}{postfix}'
386
+
387
+ # We need to wrap `docstring_content` here because single-line
388
+ # docstrings don't get wrapped anywhere else.
389
+ tw: textwrap.TextWrapper = textwrap.TextWrapper(
390
+ width=line_length - num_leading_indent,
391
+ break_long_words=False,
392
+ break_on_hyphens=False,
393
+ replace_whitespace=False,
394
+ drop_whitespace=True,
395
+ )
396
+ wrapped_list: list[str] = tw.wrap(docstring_content)
397
+ wrapped: str = textwrap.indent('\n'.join(wrapped_list), indent)
398
+ return f'{prefix}\n{wrapped}\n{indent}{postfix}'
386
399
 
387
400
  return whole_docstring_literal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: format-docstring
3
- Version: 0.1.0
3
+ Version: 0.1.1
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>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "format-docstring"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "A Python formatter to wrap/adjust docstring lines"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -61,6 +61,12 @@ def func8():
61
61
  nf of pf qf rf sf tf uf vf wf xf yf zf 1f 2f 3f 4f 5f 6f 7f 8f 9f 0f af bf cf df ef ff gf hf if jf kf lf mf"""
62
62
  pass
63
63
 
64
+
65
+ def func9():
66
+ def get_scores(self) -> np.ndarray:
67
+ """Return entire score array, with 'None' for scores that haven't been calculated."""
68
+ return self.scores
69
+
64
70
  **********
65
71
 
66
72
  def func1():
@@ -133,3 +139,12 @@ def func8():
133
139
  df ef ff gf hf if jf kf lf mf
134
140
  """
135
141
  pass
142
+
143
+
144
+ def func9():
145
+ def get_scores(self) -> np.ndarray:
146
+ """
147
+ Return entire score array, with 'None' for scores that haven't been
148
+ calculated.
149
+ """
150
+ return self.scores
@@ -1,14 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on
6
- [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
7
- adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
-
9
- ## [0.1.0] - 2025-09-07
10
-
11
- - Added
12
- - Initial release
13
- - Full diff
14
- - N/A