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.
- format_docstring-0.1.1/CHANGELOG.md +30 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/PKG-INFO +1 -1
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/docstring_rewriter.py +2 -2
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_numpy.py +15 -2
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/PKG-INFO +1 -1
- {format_docstring-0.1.0 → format_docstring-0.1.1}/pyproject.toml +1 -1
- {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
- format_docstring-0.1.0/CHANGELOG.md +0 -14
- {format_docstring-0.1.0 → format_docstring-0.1.1}/.github/workflows/python-package.yml +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/.github/workflows/python-publish.yml +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/.gitignore +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/.pre-commit-config.yaml +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/.pre-commit-hooks.yaml +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/CLAUDE.md +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/LICENSE +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/README.md +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/__init__.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/base_fixer.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/config.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_google.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/line_wrap_utils.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/main_jupyter.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring/main_py.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/SOURCES.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/dependency_links.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/entry_points.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/requires.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/top_level.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/muff.toml +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/requirements.dev +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/setup.cfg +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/__init__.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/helpers.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_config.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/README.md +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/colon_spacing_fix.txt +0 -0
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/default_value_standardization.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/empty_lines_are_respected.txt +0 -0
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/four_level_nested_classes.txt +0 -0
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/indent_misaligned_all.txt +0 -0
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/line_length_2.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines_one_dash.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/mismatched_underlines_two_dashes.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/module_level_docstring.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/param_signature_without_type.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/returns_signature_and_description.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/section_title_fixed.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/sections_notes_examples.txt +0 -0
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/single_line_docstring.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.ipynb +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after_50.ipynb +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after_50.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/before.ipynb +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/before.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/README.md +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/colon_spacing_fix.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/contents_that_are_not_wrapped.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/default_value_standardization.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/empty_lines_are_respected.txt +0 -0
- {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
- {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
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/indent_two_levels_8_spaces.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/line_length_2.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines_one_dash.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/mismatched_underlines_two_dashes.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/module_level_docstring.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/param_signature_without_type.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/parameters_returns_raises_wrapping.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/returns_signature_and_description.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/section_title_fixed.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/sections_notes_examples.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/signature_line_is_not_wrapped.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/texts_are_rewrapped.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/very_long_unbreakable_word.txt +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/playground.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_docstring_rewriter.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_google.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_numpy.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_line_wrap_utils.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_main_jupyter.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_main_py.py +0 -0
- {format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_playground.py +0 -0
- {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.
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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.
|
|
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>
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/format_docstring.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/end_to_end/numpy/line_length_2.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.ipynb
RENAMED
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after.py
RENAMED
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/after_50.py
RENAMED
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/integration_test/numpy/before.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{format_docstring-0.1.0 → format_docstring-0.1.1}/tests/test_data/line_wrap/numpy/line_length_2.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|