[pylint 'use-maxsplit-arg'] Do not split more than necessary when using the first element

This commit is contained in:
Pierre Sassoulas 2024-03-31 15:23:03 +02:00
parent 5d5c9dc858
commit a194e5ed27
2 changed files with 7 additions and 3 deletions

View File

@ -276,7 +276,6 @@ disable = [
"useless-else-on-loop",
"useless-import-alias",
"useless-return",
"use-maxsplit-arg",
"using-constant-test",
"wrong-import-order",
]

View File

@ -1821,7 +1821,10 @@ def _show_fixtures_per_test(config: Config, session: "Session") -> None:
fixture_doc = inspect.getdoc(fixture_def.func)
if fixture_doc:
write_docstring(
tw, fixture_doc.split("\n\n")[0] if verbose <= 0 else fixture_doc
tw,
fixture_doc.split("\n\n", maxsplit=1)[0]
if verbose <= 0
else fixture_doc,
)
else:
tw.line(" no docstring available", red=True)
@ -1903,7 +1906,9 @@ def _showfixtures_main(config: Config, session: "Session") -> None:
tw.write("\n")
doc = inspect.getdoc(fixturedef.func)
if doc:
write_docstring(tw, doc.split("\n\n")[0] if verbose <= 0 else doc)
write_docstring(
tw, doc.split("\n\n", maxsplit=1)[0] if verbose <= 0 else doc
)
else:
tw.line(" no docstring available", red=True)
tw.line()