File tree Expand file tree Collapse file tree 7 files changed +64
-11
lines changed Expand file tree Collapse file tree 7 files changed +64
-11
lines changed Original file line number Diff line number Diff line change 5656 if : ${{ env.build_ok == 1 }}
5757 uses : release-drafter/release-drafter@v5
5858 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 }}
6262 prerelease : true
6363 publish : true
6464 env :
Original file line number Diff line number Diff line change 1111project = "docformatter"
1212copyright = "2022-2023, Steven Myint"
1313author = "Steven Myint"
14- release = "1.7.3 "
14+ release = "1.7.4 "
1515
1616# -- General configuration ---------------------------------------------------
1717# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " docformatter"
3- version = " 1.7.3 "
3+ version = " 1.7.4 "
44description = " Formats docstrings to follow PEP 257"
55authors = [" Steven Myint" ]
66maintainers = [
Original file line number Diff line number Diff line change 2323# SOFTWARE.
2424"""Package information for docformatter."""
2525
26- __version__ = "1.7.3 "
26+ __version__ = "1.7.4 "
Original file line number Diff line number Diff line change 5959REST_REGEX = r"((\.{2}|`{2}) ?[\w.~-]+(:{2}|`{2})?[\w ]*?|`[\w.~]+`)"
6060"""Regular expression to use for finding reST directives."""
6161
62- SPHINX_REGEX = r":[a-zA-Z0-9_\-(). ]*:"
62+ SPHINX_REGEX = r":(param|raises|return|rtype|type) [a-zA-Z0-9_\-.() ]*:"
6363"""Regular expression to use for finding Sphinx-style field lists."""
6464
6565URL_PATTERNS = (
@@ -276,7 +276,10 @@ def do_find_directives(text: str) -> bool:
276276 return bool ([(_rest .start (0 ), _rest .end (0 )) for _rest in _rest_iter ])
277277
278278
279- def do_find_field_lists (text : str , style : str ):
279+ def do_find_field_lists (
280+ text : str ,
281+ style : str ,
282+ ):
280283 r"""Determine if docstring contains any field lists.
281284
282285 Parameters
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ instring='''"""CC.
139139 """'''
140140outstring =''' """CC.
141141
142- :math:`-`
142+ :math: `-`
143143 """'''
144144
145145[issue_230 ]
@@ -190,8 +190,7 @@ outstring='''"""CC.
190190
191191 C.
192192
193- C,
194- :math:`[0, 1]`.
193+ C, :math:`[0, 1]`.
195194 """'''
196195
197196[issue_239 ]
@@ -223,3 +222,17 @@ outstring='''"""Some f.
223222 :param a: Some param.
224223 :raises my.package.MyReallySrsError: Bad things happened.
225224 """'''
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(
396396 INDENTATION ,
397397 instring ,
398398 )
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