Skip to content

Commit 58092f5

Browse files
pre-commit-ci[bot]jacobtylerwalls
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 50cc5c5 commit 58092f5

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

pylint/checkers/imports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from collections import defaultdict
1414
from collections.abc import ItemsView, Sequence
1515
from functools import cached_property
16-
from typing import TYPE_CHECKING, Any, Union
16+
from typing import TYPE_CHECKING, Any
1717

1818
import astroid
1919
from astroid import nodes
@@ -43,7 +43,7 @@
4343

4444
# The dictionary with Any should actually be a _ImportTree again
4545
# but mypy doesn't support recursive types yet
46-
_ImportTree = dict[str, Union[list[dict[str, Any]], list[str]]]
46+
_ImportTree = dict[str, list[dict[str, Any]] | list[str]]
4747

4848
DEPRECATED_MODULES = {
4949
(0, 0, 0): {"tkinter.tix", "fpectl"},

pylint/extensions/mccabe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
_SubGraphNodes = Union[nodes.If, nodes.Try, nodes.For, nodes.While]
4343
_AppendableNodeT = TypeVar(
44-
"_AppendableNodeT", bound=Union[_StatementNodes, nodes.While, nodes.FunctionDef]
44+
"_AppendableNodeT", bound=_StatementNodes | nodes.While | nodes.FunctionDef
4545
)
4646

4747

pylint/pyreverse/inspector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import traceback
1515
from abc import ABC, abstractmethod
1616
from collections.abc import Callable, Sequence
17-
from typing import Optional
1817

1918
import astroid
2019
from astroid import nodes
@@ -24,7 +23,7 @@
2423
from pylint.pyreverse import utils
2524

2625
_WrapperFuncT = Callable[
27-
[Callable[[str], nodes.Module], str, bool], Optional[nodes.Module]
26+
[Callable[[str], nodes.Module], str, bool], nodes.Module | None
2827
]
2928

3029

pylint/pyreverse/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import subprocess
1313
import sys
1414
from collections.abc import Callable
15-
from typing import TYPE_CHECKING, Any, Optional, Union
15+
from typing import TYPE_CHECKING, Any
1616

1717
import astroid
1818
from astroid import nodes
@@ -23,9 +23,9 @@
2323

2424
_CallbackT = Callable[
2525
[nodes.NodeNG],
26-
Union[tuple[ClassDiagram], tuple[PackageDiagram, ClassDiagram], None],
26+
tuple[ClassDiagram] | tuple[PackageDiagram, ClassDiagram] | None,
2727
]
28-
_CallbackTupleT = tuple[Optional[_CallbackT], Optional[_CallbackT]]
28+
_CallbackTupleT = tuple[_CallbackT | None, _CallbackT | None]
2929

3030

3131
RCFILE = ".pyreverserc"

pylint/reporters/json_reporter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from __future__ import annotations
88

99
import json
10-
from typing import TYPE_CHECKING, Optional, TypedDict
10+
from typing import TYPE_CHECKING, TypedDict
1111

1212
from pylint.interfaces import CONFIDENCE_MAP, UNDEFINED
1313
from pylint.message import Message
@@ -27,8 +27,8 @@
2727
"obj": str,
2828
"line": int,
2929
"column": int,
30-
"endLine": Optional[int],
31-
"endColumn": Optional[int],
30+
"endLine": int | None,
31+
"endColumn": int | None,
3232
"path": str,
3333
"symbol": str,
3434
"message": str,

pylint/typing.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
from __future__ import annotations
88

99
import argparse
10-
from collections.abc import Iterable, Sequence
10+
from collections.abc import Callable, Iterable, Sequence
1111
from pathlib import Path
1212
from re import Pattern
1313
from typing import (
1414
TYPE_CHECKING,
1515
Any,
16-
Callable,
1716
Literal,
1817
NamedTuple,
1918
Optional,
@@ -95,17 +94,15 @@ class ManagedMessage(NamedTuple):
9594

9695
OptionDict = dict[
9796
str,
98-
Union[
99-
None,
100-
str,
101-
bool,
102-
int,
103-
Pattern[str],
104-
Iterable[Union[str, int, Pattern[str]]],
105-
type["_CallbackAction"],
106-
Callable[[Any], Any],
107-
Callable[[Any, Any, Any, Any], Any],
108-
],
97+
None
98+
| str
99+
| bool
100+
| int
101+
| Pattern[str]
102+
| Iterable[str | int | Pattern[str]]
103+
| type["_CallbackAction"]
104+
| Callable[[Any], Any]
105+
| Callable[[Any, Any, Any, Any], Any],
109106
]
110107
Options = tuple[tuple[str, OptionDict], ...]
111108

0 commit comments

Comments
 (0)