File tree 7 files changed +64
-11
lines changed
7 files changed +64
-11
lines changed Original file line number Diff line number Diff line change 56
56
if : ${{ env.build_ok == 1 }}
57
57
uses : release-drafter/release-drafter@v5
58
58
with :
59
- name : $env.tag
60
- tag : $env.tag
61
- version : $env.tag
59
+ name : ${{ env.tag }}
60
+ tag : ${{ env.tag }}
61
+ version : ${{ env.tag }}
62
62
prerelease : true
63
63
publish : true
64
64
env :
Original file line number Diff line number Diff line change 11
11
project = "docformatter"
12
12
copyright = "2022-2023, Steven Myint"
13
13
author = "Steven Myint"
14
- release = "1.7.3 "
14
+ release = "1.7.4 "
15
15
16
16
# -- General configuration ---------------------------------------------------
17
17
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " docformatter"
3
- version = " 1.7.3 "
3
+ version = " 1.7.4 "
4
4
description = " Formats docstrings to follow PEP 257"
5
5
authors = [" Steven Myint" ]
6
6
maintainers = [
Original file line number Diff line number Diff line change 23
23
# SOFTWARE.
24
24
"""Package information for docformatter."""
25
25
26
- __version__ = "1.7.3 "
26
+ __version__ = "1.7.4 "
Original file line number Diff line number Diff line change 59
59
REST_REGEX = r"((\.{2}|`{2}) ?[\w.~-]+(:{2}|`{2})?[\w ]*?|`[\w.~]+`)"
60
60
"""Regular expression to use for finding reST directives."""
61
61
62
- SPHINX_REGEX = r":[a-zA-Z0-9_\-(). ]*:"
62
+ SPHINX_REGEX = r":(param|raises|return|rtype|type) [a-zA-Z0-9_\-.() ]*:"
63
63
"""Regular expression to use for finding Sphinx-style field lists."""
64
64
65
65
URL_PATTERNS = (
@@ -276,7 +276,10 @@ def do_find_directives(text: str) -> bool:
276
276
return bool ([(_rest .start (0 ), _rest .end (0 )) for _rest in _rest_iter ])
277
277
278
278
279
- def do_find_field_lists (text : str , style : str ):
279
+ def do_find_field_lists (
280
+ text : str ,
281
+ style : str ,
282
+ ):
280
283
r"""Determine if docstring contains any field lists.
281
284
282
285
Parameters
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ instring='''"""CC.
139
139
"""'''
140
140
outstring =''' """CC.
141
141
142
- :math:`-`
142
+ :math: `-`
143
143
"""'''
144
144
145
145
[issue_230 ]
@@ -190,8 +190,7 @@ outstring='''"""CC.
190
190
191
191
C.
192
192
193
- C,
194
- :math:`[0, 1]`.
193
+ C, :math:`[0, 1]`.
195
194
"""'''
196
195
197
196
[issue_239 ]
@@ -223,3 +222,17 @@ outstring='''"""Some f.
223
222
:param a: Some param.
224
223
:raises my.package.MyReallySrsError: Bad things happened.
225
224
"""'''
225
+
226
+ [issue_250 ]
227
+ instring =''' """CC.
228
+
229
+ c.
230
+
231
+ c c :math:`[0, 1]`.
232
+ """'''
233
+ outstring =''' """CC.
234
+
235
+ c.
236
+
237
+ c c :math:`[0, 1]`.
238
+ """'''
Original file line number Diff line number Diff line change @@ -396,3 +396,40 @@ def test_format_docstring_sphinx_style_field_name_has_periods(
396
396
INDENTATION ,
397
397
instring ,
398
398
)
399
+
400
+ @pytest .mark .unit
401
+ @pytest .mark .parametrize (
402
+ "args" ,
403
+ [
404
+ [
405
+ "--wrap-descriptions" ,
406
+ "88" ,
407
+ "--wrap-summaries" ,
408
+ "88" ,
409
+ "" ,
410
+ ]
411
+ ],
412
+ )
413
+ def test_format_docstring_sphinx_style_ignore_directive (
414
+ self ,
415
+ test_args ,
416
+ args ,
417
+ ):
418
+ """Should not identify inline directives as sphinx field names.
419
+
420
+ See issue #250.
421
+ """
422
+ uut = Formatter (
423
+ test_args ,
424
+ sys .stderr ,
425
+ sys .stdin ,
426
+ sys .stdout ,
427
+ )
428
+
429
+ instring = self .TEST_STRINGS ["issue_250" ]["instring" ]
430
+ outstring = self .TEST_STRINGS ["issue_250" ]["outstring" ]
431
+
432
+ assert outstring == uut ._do_format_docstring (
433
+ INDENTATION ,
434
+ instring ,
435
+ )
You can’t perform that action at this time.
0 commit comments