Skip to content

Commit 9bb39cf

Browse files
committed
Remove unnecessary _get_newlines_by_type black parameter
1 parent 8038f7e commit 9bb39cf

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/docformatter/format.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
# SOFTWARE.
2727
"""This module provides docformatter's Formattor class."""
2828

29-
3029
# Standard Library Imports
3130
import argparse
3231
import collections
@@ -359,7 +358,6 @@ def _get_module_docstring_newlines() -> int:
359358
def _get_newlines_by_type(
360359
tokens: list[tokenize.TokenInfo],
361360
index: int,
362-
black: bool = False,
363361
) -> int:
364362
"""Dispatch to the correct docstring formatter based on context.
365363
@@ -969,9 +967,7 @@ def _do_format_oneline_docstring(
969967
).strip()
970968
if self.args.close_quotes_on_newline and "\n" in summary_wrapped:
971969
summary_wrapped = (
972-
f"{summary_wrapped[:-3]}"
973-
f"\n{indentation}"
974-
f"{summary_wrapped[-3:]}"
970+
f"{summary_wrapped[:-3]}\n{indentation}{summary_wrapped[-3:]}"
975971
)
976972
return summary_wrapped
977973

@@ -1058,7 +1054,8 @@ def _do_rewrite_docstring_blocks(
10581054

10591055
_docstring_token = tokens[_docstr_idx]
10601056
_blank_line_count = _get_newlines_by_type(
1061-
tokens, _docstr_idx, black=self.args.black
1057+
tokens,
1058+
_docstr_idx,
10621059
)
10631060

10641061
if (

tests/formatter/test_format_functions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,23 @@ def test_do_remove_preceding_blank_lines(test_key, block):
221221
@pytest.mark.integration
222222
@pytest.mark.order(5)
223223
@pytest.mark.parametrize(
224-
"test_key, black",
224+
"test_key",
225225
[
226-
("get_newlines_by_type_module_docstring", False),
227-
("get_newlines_by_type_module_docstring_black", True),
228-
("get_newlines_by_type_class_docstring", False),
229-
("get_newlines_by_type_function_docstring", False),
230-
("get_newlines_by_type_attribute_docstring", False),
226+
"get_newlines_by_type_module_docstring",
227+
"get_newlines_by_type_module_docstring_black",
228+
"get_newlines_by_type_class_docstring",
229+
"get_newlines_by_type_function_docstring",
230+
"get_newlines_by_type_attribute_docstring",
231231
],
232232
)
233-
def test_get_newlines_by_type(test_key, black):
233+
def test_get_newlines_by_type(test_key):
234234
source = TEST_STRINGS[test_key]["source"]
235235
expected = TEST_STRINGS[test_key]["expected"]
236236

237237
tokens = _get_tokens(source)
238238
index = _get_docstring_token_and_index(tokens)
239239

240-
result = _format._get_newlines_by_type(tokens, index, black)
240+
result = _format._get_newlines_by_type(tokens, index)
241241
assert result == expected, f"\nFailed {test_key}\nExpected {expected}\nGot {result}"
242242

243243

0 commit comments

Comments
 (0)