Skip to content

Commit 6d558c7

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 51cf8d2 commit 6d558c7

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

pylint/lint/pylinter.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,12 @@ def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
260260
}
261261

262262

263-
def _handle_force_color_no_color(reporters: list[reporters.BaseReporter]) -> list[reporters.BaseReporter]:
263+
def _handle_force_color_no_color(
264+
reporters: list[reporters.BaseReporter],
265+
) -> list[reporters.BaseReporter]:
264266
"""
265-
Check ``NO_COLOR`` and ``FORCE_COLOR``, and return the modified reporter list accordingly.
267+
Check ``NO_COLOR`` and ``FORCE_COLOR``, and return the modified reporter list
268+
accordingly.
266269
267270
Rules are presented in this table:
268271
+--------------+---------------+-----------------+------------------------------------------------------------+
@@ -290,19 +293,26 @@ def _handle_force_color_no_color(reporters: list[reporters.BaseReporter]) -> lis
290293
force_color = False
291294

292295
final_reporters: list[reporters.BaseReporter] = []
293-
296+
294297
for idx, rep in enumerate(reporters):
295-
if no_color and isinstance(rep, ColorizedTextReporter) and rep.out.buffer is sys.stdout.buffer:
298+
if (
299+
no_color
300+
and isinstance(rep, ColorizedTextReporter)
301+
and rep.out.buffer is sys.stdout.buffer
302+
):
296303
warnings.warn(
297304
WARN_NO_COLOR_SET,
298305
ReporterWarning,
299306
stacklevel=2,
300307
)
301308
final_reporters.append(TextReporter())
302309

303-
304310
# pylint: disable=unidiomatic-typecheck # Want explicit type check
305-
elif force_color and type(rep) is TextReporter and rep.out.buffer is sys.stdout.buffer:
311+
elif (
312+
force_color
313+
and type(rep) is TextReporter
314+
and rep.out.buffer is sys.stdout.buffer
315+
):
306316
warnings.warn(
307317
WARN_FORCE_COLOR_SET,
308318
ReporterWarning,
@@ -312,7 +322,7 @@ def _handle_force_color_no_color(reporters: list[reporters.BaseReporter]) -> lis
312322

313323
else:
314324
final_reporters.append(rep)
315-
325+
316326
return final_reporters
317327

318328

tests/lint/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import unittest.mock
66
from pathlib import Path, PosixPath
7-
from typing import Any
87

98
import pytest
109

0 commit comments

Comments
 (0)