From 55a0143df790e65514faaec4c79cfbec103a2a35 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 9 Jan 2022 16:52:03 +0000 Subject: [PATCH] remove unnecessary list calls around 'sorted' (C413) --- sphinx/ext/autosummary/generate.py | 2 +- tests/test_domain_cpp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 3db7eb989..5d5e64b92 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -355,7 +355,7 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None, suffix: str = '.rst', base_path: str = None, imported_members: bool = False, app: Any = None, overwrite: bool = True, encoding: str = 'utf-8') -> None: - showed_sources = list(sorted(sources)) + showed_sources = sorted(sources) if len(showed_sources) > 20: showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:] logger.info(__('[autosummary] generating autosummary for: %s') % diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py index 70876728d..765f9fd65 100644 --- a/tests/test_domain_cpp.py +++ b/tests/test_domain_cpp.py @@ -1113,11 +1113,11 @@ def test_domain_cpp_build_misuse_of_roles(app, status, warning): if targetType == 'templateParam': warn.append("WARNING: cpp:{} targets a {} (".format(r, txtTargetType)) warn.append("WARNING: cpp:{} targets a {} (".format(r, txtTargetType)) - warn = list(sorted(warn)) + warn = sorted(warn) for w in ws: assert "targets a" in w ws = [w[w.index("WARNING:"):] for w in ws] - ws = list(sorted(ws)) + ws = sorted(ws) print("Expected warnings:") for w in warn: print(w)