docstrfmt 2.0.0__tar.gz → 2.0.2__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.
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/PKG-INFO +1 -1
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/__init__.py +1 -1
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/docstrfmt.py +8 -19
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/main.py +5 -3
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/LICENSE.txt +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/README.rst +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/__main__.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/const.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/debug.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/exceptions.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/rst_extras.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/server.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/docstrfmt/util.py +0 -0
- {docstrfmt-2.0.0 → docstrfmt-2.0.2}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docstrfmt
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: docstrfmt: A formatter for Sphinx flavored reStructuredText.
|
|
5
5
|
Keywords: black,docutils,autoformatter,formatter,lint,restructuredtext,rst,sphinx
|
|
6
6
|
Author-email: Joel Payne <lilspazjoekp@gmail.com>
|
|
@@ -1075,20 +1075,10 @@ class Formatters:
|
|
|
1075
1075
|
f"Invalid doctest block: {e}",
|
|
1076
1076
|
) from None
|
|
1077
1077
|
doctest_blocks = []
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
example
|
|
1081
|
-
|
|
1082
|
-
current_block += example.source.strip()
|
|
1083
|
-
formatted = CodeFormatters(current_block, context).python()
|
|
1084
|
-
doctest_blocks.append((formatted, example.want.strip()))
|
|
1085
|
-
current_block = ""
|
|
1086
|
-
else: # pragma: no cover
|
|
1087
|
-
current_block += example.source.strip() + "\n"
|
|
1088
|
-
if current_block:
|
|
1089
|
-
# If there's any remaining code, format it as well.
|
|
1090
|
-
formatted = CodeFormatters(current_block, context).python()
|
|
1091
|
-
doctest_blocks.append((formatted, ""))
|
|
1078
|
+
for example in parsed:
|
|
1079
|
+
formatted = CodeFormatters(example.source.strip(), context).python()
|
|
1080
|
+
doctest_blocks.append((formatted, example.want.strip()))
|
|
1081
|
+
|
|
1092
1082
|
if not doctest_blocks:
|
|
1093
1083
|
raise InvalidRstError(
|
|
1094
1084
|
context.current_file,
|
|
@@ -1097,11 +1087,10 @@ class Formatters:
|
|
|
1097
1087
|
"Empty doctest block.",
|
|
1098
1088
|
)
|
|
1099
1089
|
for formatted, want in doctest_blocks:
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
yield f">>> {line}"
|
|
1090
|
+
first_line, *other_lines = formatted.splitlines()
|
|
1091
|
+
yield f">>> {first_line}"
|
|
1092
|
+
for line in other_lines:
|
|
1093
|
+
yield f"... {line}" if line else "..."
|
|
1105
1094
|
if want:
|
|
1106
1095
|
yield from want.splitlines()
|
|
1107
1096
|
|
|
@@ -387,7 +387,7 @@ def _validate_adornments(
|
|
|
387
387
|
:raises click.BadParameter: If adornments are not unique.
|
|
388
388
|
|
|
389
389
|
"""
|
|
390
|
-
actual_value =
|
|
390
|
+
actual_value = context.params.pop("section_adornments", value)
|
|
391
391
|
|
|
392
392
|
if len(actual_value) != len(set(actual_value)):
|
|
393
393
|
msg = "Section adornments must be unique"
|
|
@@ -395,11 +395,13 @@ def _validate_adornments(
|
|
|
395
395
|
|
|
396
396
|
if "|" in actual_value:
|
|
397
397
|
with_overline, without_overline = actual_value.split("|", 1)
|
|
398
|
-
|
|
398
|
+
adornments = list(zip(with_overline, itertools.repeat(True))) + list(
|
|
399
399
|
zip(without_overline, itertools.repeat(False))
|
|
400
400
|
)
|
|
401
|
+
else:
|
|
402
|
+
adornments = list(zip(actual_value, itertools.repeat(False)))
|
|
401
403
|
|
|
402
|
-
return
|
|
404
|
+
return adornments
|
|
403
405
|
|
|
404
406
|
|
|
405
407
|
async def _run_formatter(
|
|
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
|