format-docstring 0.2.3__tar.gz → 0.2.4__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 (109) hide show
  1. {format_docstring-0.2.3 → format_docstring-0.2.4}/.pre-commit-config.yaml +3 -4
  2. {format_docstring-0.2.3 → format_docstring-0.2.4}/CHANGELOG.md +10 -0
  3. {format_docstring-0.2.3 → format_docstring-0.2.4}/PKG-INFO +1 -1
  4. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/line_wrap_numpy.py +41 -8
  5. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/PKG-INFO +1 -1
  6. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/SOURCES.txt +1 -0
  7. {format_docstring-0.2.3 → format_docstring-0.2.4}/pyproject.toml +1 -1
  8. format_docstring-0.2.4/tests/test_data/end_to_end/numpy/arg_name_is_default.txt +44 -0
  9. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_line_wrap_numpy.py +10 -0
  10. {format_docstring-0.2.3 → format_docstring-0.2.4}/.github/workflows/python-package.yml +0 -0
  11. {format_docstring-0.2.3 → format_docstring-0.2.4}/.github/workflows/python-publish.yml +0 -0
  12. {format_docstring-0.2.3 → format_docstring-0.2.4}/.gitignore +0 -0
  13. {format_docstring-0.2.3 → format_docstring-0.2.4}/.pre-commit-hooks.yaml +0 -0
  14. {format_docstring-0.2.3 → format_docstring-0.2.4}/AGENTS.md +0 -0
  15. {format_docstring-0.2.3 → format_docstring-0.2.4}/LICENSE +0 -0
  16. {format_docstring-0.2.3 → format_docstring-0.2.4}/README.md +0 -0
  17. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/__init__.py +0 -0
  18. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/base_fixer.py +0 -0
  19. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/config.py +0 -0
  20. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/docstring_rewriter.py +0 -0
  21. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/line_wrap_google.py +0 -0
  22. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/line_wrap_utils.py +0 -0
  23. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/main_jupyter.py +0 -0
  24. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring/main_py.py +0 -0
  25. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/dependency_links.txt +0 -0
  26. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/entry_points.txt +0 -0
  27. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/requires.txt +0 -0
  28. {format_docstring-0.2.3 → format_docstring-0.2.4}/format_docstring.egg-info/top_level.txt +0 -0
  29. {format_docstring-0.2.3 → format_docstring-0.2.4}/muff.toml +0 -0
  30. {format_docstring-0.2.3 → format_docstring-0.2.4}/requirements.dev +0 -0
  31. {format_docstring-0.2.3 → format_docstring-0.2.4}/setup.cfg +0 -0
  32. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/__init__.py +0 -0
  33. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/helpers.py +0 -0
  34. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_base_fixer.py +0 -0
  35. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_config.py +0 -0
  36. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/README.md +0 -0
  37. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/colon_spacing_fix.txt +0 -0
  38. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/contents_that_are_not_wrapped.txt +0 -0
  39. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/default_value_standardization.txt +0 -0
  40. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/empty_lines_are_respected.txt +0 -0
  41. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/examples_section.txt +0 -0
  42. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
  43. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/fix_rst_backticks.txt +0 -0
  44. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/four_level_nested_classes.txt +0 -0
  45. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
  46. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/indent_misaligned_all.txt +0 -0
  47. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/indent_two_levels_8_spaces.txt +0 -0
  48. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/line_length_2.txt +0 -0
  49. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/mismatched_underlines.txt +0 -0
  50. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/mismatched_underlines_one_dash.txt +0 -0
  51. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/mismatched_underlines_two_dashes.txt +0 -0
  52. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/module_level_docstring.txt +0 -0
  53. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/new_lines_before_and_after.txt +0 -0
  54. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/no_format_docstring_comment.txt +0 -0
  55. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/param_signature_without_type.txt +0 -0
  56. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/parameters_returns_raises_wrapping.txt +0 -0
  57. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/returns_signature_and_description.txt +0 -0
  58. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/section_headings_with_colons.txt +0 -0
  59. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/section_title_fixed.txt +0 -0
  60. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/sections_notes_examples.txt +0 -0
  61. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_dont_sync_raises.txt +0 -0
  62. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_line_is_not_wrapped.txt +0 -0
  63. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_sync_class_docstrings.txt +0 -0
  64. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_sync_parameters.txt +0 -0
  65. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_sync_returns.txt +0 -0
  66. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/signature_sync_yields.txt +0 -0
  67. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/single_line_docstring.txt +0 -0
  68. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/texts_are_rewrapped.txt +0 -0
  69. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/end_to_end/numpy/very_long_unbreakable_word.txt +0 -0
  70. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/after.ipynb +0 -0
  71. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/after.py +0 -0
  72. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/after_50.ipynb +0 -0
  73. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/after_50.py +0 -0
  74. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/before.ipynb +0 -0
  75. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/integration_test/numpy/before.py +0 -0
  76. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/jupyter/before.ipynb +0 -0
  77. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/jupyter/verbose_before.ipynb +0 -0
  78. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/README.md +0 -0
  79. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/colon_spacing_fix.txt +0 -0
  80. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/contents_that_are_not_wrapped.txt +0 -0
  81. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/default_value_standardization.txt +0 -0
  82. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/empty_lines_are_respected.txt +0 -0
  83. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/examples_section.txt +0 -0
  84. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/existing_linebreaks_should_not_be_respected.txt +0 -0
  85. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/fix_rst_backticks.txt +0 -0
  86. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/indent_four_levels_16_spaces_width_10.txt +0 -0
  87. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/indent_two_levels_8_spaces.txt +0 -0
  88. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/line_length_2.txt +0 -0
  89. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/mismatched_underlines.txt +0 -0
  90. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/mismatched_underlines_one_dash.txt +0 -0
  91. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/mismatched_underlines_two_dashes.txt +0 -0
  92. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/module_level_docstring.txt +0 -0
  93. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/param_signature_without_type.txt +0 -0
  94. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/parameters_returns_raises_wrapping.txt +0 -0
  95. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/returns_signature_and_description.txt +0 -0
  96. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/section_headings_with_colons.txt +0 -0
  97. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/section_title_fixed.txt +0 -0
  98. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/sections_notes_examples.txt +0 -0
  99. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/signature_line_is_not_wrapped.txt +0 -0
  100. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/texts_are_rewrapped.txt +0 -0
  101. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/line_wrap/numpy/very_long_unbreakable_word.txt +0 -0
  102. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_data/playground.py +0 -0
  103. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_docstring_rewriter.py +0 -0
  104. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_line_wrap_google.py +0 -0
  105. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_line_wrap_utils.py +0 -0
  106. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_main_jupyter.py +0 -0
  107. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_main_py.py +0 -0
  108. {format_docstring-0.2.3 → format_docstring-0.2.4}/tests/test_playground.py +0 -0
  109. {format_docstring-0.2.3 → format_docstring-0.2.4}/tox.ini +0 -0
@@ -1,4 +1,5 @@
1
1
  ---
2
+ exclude: ^tests/test_data/
2
3
  repos:
3
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
4
5
  rev: v6.0.0
@@ -13,7 +14,7 @@ repos:
13
14
  - id: check-yaml
14
15
  - id: name-tests-test
15
16
  args: [--pytest-test-first]
16
- exclude: ^tests/test_data/|^tests/helpers\.py$
17
+ exclude: ^tests/helpers\.py$
17
18
  - id: check-merge-conflict
18
19
  - repo: https://github.com/jsh9/muff-pre-commit
19
20
  rev: 0.13.2
@@ -65,7 +66,7 @@ repos:
65
66
  rev: 0.1.0
66
67
  hooks:
67
68
  - id: markdown-toc-creator
68
- exclude: ^tests/test_data/|^AGENTS\.md$|^CHANGELOG\.md$
69
+ exclude: ^AGENTS\.md$|^CHANGELOG\.md$
69
70
  - repo: https://github.com/jsh9/markdown-heading-numbering
70
71
  rev: 0.1.0
71
72
  hooks:
@@ -79,7 +80,6 @@ repos:
79
80
  args: [-m, format_docstring.main_py, --verbose, diff]
80
81
  language: python
81
82
  types: [python]
82
- exclude: ^tests/test_data/
83
83
  additional_dependencies:
84
84
  - click>=8.0
85
85
  - jupyter-notebook-parser>=0.1.4
@@ -90,7 +90,6 @@ repos:
90
90
  args: [-m, format_docstring.main_jupyter, --verbose, diff]
91
91
  language: python
92
92
  files: ^.*\.ipynb$
93
- exclude: ^tests/test_data/
94
93
  additional_dependencies:
95
94
  - click>=8.0
96
95
  - jupyter-notebook-parser>=0.1.4
@@ -6,6 +6,16 @@ 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.2.4] - 2025-10-27
10
+
11
+ - Fixed
12
+ - A bug where 2nd pair of backticks can't be added for dunder names (such as
13
+ `__init__`)
14
+ - A bug where input args named `default` would get treated incorrectly (the
15
+ tool would confuse it with the default values)
16
+ - Full diff
17
+ - https://github.com/jsh9/format-docstring/compare/0.2.3...0.2.4
18
+
9
19
  ## [0.2.3] - 2025-10-22
10
20
 
11
21
  - Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: format-docstring
3
- Version: 0.2.3
3
+ Version: 0.2.4
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>
@@ -464,19 +464,39 @@ def _standardize_default_value(line: str) -> str:
464
464
  >>> _standardize_default_value('arg : bool, default: True')
465
465
  'arg : bool, default=True'
466
466
  """
467
+ colon_idx = line.find(':')
468
+ if colon_idx == -1:
469
+ return line
470
+
471
+ # `prefix` is everything before the 1st colon (param identifier portion).
472
+ # We leave `prefix` untouched so arg names like `default` aren't rewritten.
473
+ prefix = line[: colon_idx + 1]
474
+ after_colon = line[colon_idx + 1 :]
475
+
467
476
  # Check colon format first to avoid matching colons in space-based pattern
468
- match = _DEFAULT_COLON_RE.match(line)
477
+ match = _DEFAULT_COLON_RE.match(after_colon)
469
478
  if match:
470
- before = match.group(1).rstrip()
479
+ before = match.group(1)
480
+ if before.strip() == '':
481
+ return line
482
+
471
483
  default_value = match.group(2).strip()
472
- return f'{before}, default={default_value}'
484
+ rebuilt_suffix = f'{before.rstrip()}, default={default_value}'
485
+ return f'{prefix}{rebuilt_suffix}'
473
486
 
474
487
  # Try space-separated format with optional "is"
475
- match = _DEFAULT_SPACE_RE.match(line)
488
+ match = _DEFAULT_SPACE_RE.match(after_colon)
476
489
  if match:
477
- before = match.group(1).rstrip()
490
+ before = match.group(1)
491
+ if before.strip() == '':
492
+ return line
493
+
494
+ # ``before`` still contains any annotation text; tightening the spacing
495
+ # here standardizes the ``", default=..."`` suffix while preserving
496
+ # whatever appeared to the left.
478
497
  default_value = match.group(2).strip()
479
- return f'{before}, default={default_value}'
498
+ rebuilt_suffix = f'{before.rstrip()}, default={default_value}'
499
+ return f'{prefix}{rebuilt_suffix}'
480
500
 
481
501
  return line
482
502
 
@@ -730,12 +750,20 @@ def handle_single_line_docstring(
730
750
  # or certain punctuation (like > and . for `>>> ` and `... ` literals)
731
751
  # Note: We match [^`]+ (anything except backticks) and then check in the
732
752
  # replacement function whether it's an external link (contains < followed by >)
733
- # The opening backtick must not be immediately followed by _ or __ (to avoid
734
- # matching the trailing backtick of cross-references like `text`_ or `text`__)
735
753
  _RST_BACKTICK_PATTERN = re.compile(
736
754
  r'(?:^|(?<=\s)|(?<=\()|(?<=[>.]))(?::[\w-]+:)?`(?!_)([^`]+)`(?!`)(?!__)(?!_)'
737
755
  )
738
756
 
757
+ # 2nd-stage fixer for ``__dunder__`` names that slipped past the main pattern
758
+ # because the literal starts with an underscore. Negative lookbehinds/aheads
759
+ # ensure we only touch isolated single-backtick literals and leave
760
+ # cross-references (`name`_ / `name`__) alone.
761
+ _DUNDER_LITERAL_PATTERN = re.compile(
762
+ r'(?<!`)`(__[A-Za-z0-9_]+__)`(?!`)(?!_)(?!__)'
763
+ )
764
+ # Replacement wraps the captured dunder name (group 1) with double backticks.
765
+ _DUNDER_LITERAL_REPLACEMENT = r'``\1``'
766
+
739
767
 
740
768
  def _fix_rst_backticks(docstring: str) -> str:
741
769
  """
@@ -857,6 +885,11 @@ def _fix_rst_backticks(docstring: str) -> str:
857
885
  # Process the entire docstring (with REPL lines protected)
858
886
  protected_docstring = ''.join(protected_lines)
859
887
  processed = _RST_BACKTICK_PATTERN.sub(replace_func, protected_docstring)
888
+ # Upgrade remaining single-backtick ``__dunder__`` literals to double
889
+ # backticks; they are safe literals (not targets or refs) after the guards.
890
+ processed = _DUNDER_LITERAL_PATTERN.sub(
891
+ _DUNDER_LITERAL_REPLACEMENT, processed
892
+ )
860
893
 
861
894
  # Restore REPL lines
862
895
  result_lines = processed.splitlines(keepends=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: format-docstring
3
- Version: 0.2.3
3
+ Version: 0.2.4
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>
@@ -39,6 +39,7 @@ tests/test_main_py.py
39
39
  tests/test_playground.py
40
40
  tests/test_data/playground.py
41
41
  tests/test_data/end_to_end/numpy/README.md
42
+ tests/test_data/end_to_end/numpy/arg_name_is_default.txt
42
43
  tests/test_data/end_to_end/numpy/colon_spacing_fix.txt
43
44
  tests/test_data/end_to_end/numpy/contents_that_are_not_wrapped.txt
44
45
  tests/test_data/end_to_end/numpy/default_value_standardization.txt
@@ -4,7 +4,7 @@ requires = ["setuptools-scm[toml]>=6.2", "setuptools>=45"]
4
4
 
5
5
  [project]
6
6
  name = "format-docstring"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  dependencies = [
9
9
  "click>=8.0",
10
10
  "jupyter-notebook-parser>=0.1.4",
@@ -0,0 +1,44 @@
1
+ LINE_LENGTH: 79
2
+
3
+ **********
4
+ def func1(arg1: str, default: int = 2, _default: str = "value", default_: list[int] | None = None) -> None:
5
+ """
6
+ Do something
7
+
8
+ Parameters
9
+ ----------
10
+ arg1 : str
11
+ Very very very very very very very very very very very very very very very very
12
+ very very very very very very very very very very very very very very very very
13
+ very very very very very very very
14
+ default : int
15
+ Quite quite quite quite quite quite quite quite quite quite quite quite quite quite quite quite
16
+ quite quite quite quite quite quite quite quite quite quite quite quite quite quite quite quite long
17
+ _default : str default is "value"
18
+ Placeholder description for _default parameter.
19
+ default_ : list[int] | None default None
20
+ Placeholder description for default_ parameter.
21
+ """
22
+ pass
23
+
24
+ **********
25
+ def func1(arg1: str, default: int = 2, _default: str = "value", default_: list[int] | None = None) -> None:
26
+ """
27
+ Do something
28
+
29
+ Parameters
30
+ ----------
31
+ arg1 : str
32
+ Very very very very very very very very very very very very very very
33
+ very very very very very very very very very very very very very very
34
+ very very very very very very very very very very very
35
+ default : int, default=2
36
+ Quite quite quite quite quite quite quite quite quite quite quite quite
37
+ quite quite quite quite quite quite quite quite quite quite quite quite
38
+ quite quite quite quite quite quite quite quite long
39
+ _default : str, default="value"
40
+ Placeholder description for _default parameter.
41
+ default_ : list[int] | None, default=None
42
+ Placeholder description for default_ parameter.
43
+ """
44
+ pass
@@ -238,6 +238,8 @@ def test_fix_colon_spacing(line: str, expected: str) -> None:
238
238
  ('arg : int', 'arg : int'),
239
239
  ('arg : str', 'arg : str'),
240
240
  (' arg : bool', ' arg : bool'),
241
+ ('default : int', 'default : int'),
242
+ (' default : int', ' default : int'),
241
243
  # Case insensitive "default"
242
244
  ('arg : int Default 10', 'arg : int, default=10'),
243
245
  ('arg : int DEFAULT 10', 'arg : int, default=10'),
@@ -262,6 +264,14 @@ def test_standardize_default_value(line: str, expected: str) -> None:
262
264
  'Underscores inside literal are fine: `foo_bar`.',
263
265
  'Underscores inside literal are fine: ``foo_bar``.',
264
266
  ),
267
+ (
268
+ 'Dunder names should be wrapped: `__init__`',
269
+ 'Dunder names should be wrapped: ``__init__``',
270
+ ),
271
+ (
272
+ 'Dunder names should be wrapped: `__init123__`',
273
+ 'Dunder names should be wrapped: ``__init123__``',
274
+ ),
265
275
  (
266
276
  'Adjacent to parentheses: (`call_me`) and `ok`',
267
277
  'Adjacent to parentheses: (``call_me``) and ``ok``',