Skip to content

Commit c70baac

Browse files
committed
black and isort
1 parent 6ec5369 commit c70baac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+80
-347
lines changed

mypy/argmap.py

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

33
from __future__ import annotations
44

5-
from typing import Callable, Sequence, TYPE_CHECKING
5+
from typing import TYPE_CHECKING, Callable, Sequence
66

77
from mypy import nodes
88
from mypy.maptype import map_instance_to_supertype

mypy/binder.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,7 @@ def accumulate_type_assignments(self) -> Iterator[Assigns]:
251251
self.type_assignments = old_assignments
252252

253253
def assign_type(
254-
self,
255-
expr: Expression,
256-
type: Type,
257-
declared_type: Type | None,
258-
restrict_any: bool = False,
254+
self, expr: Expression, type: Type, declared_type: Type | None, restrict_any: bool = False
259255
) -> None:
260256
# We should erase last known value in binder, because if we are using it,
261257
# it means that the target is not final, and therefore can't hold a literal.

mypy/build.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,11 +1353,7 @@ def find_cache_meta(id: str, path: str, manager: BuildManager) -> CacheMeta | No
13531353

13541354

13551355
def validate_meta(
1356-
meta: CacheMeta | None,
1357-
id: str,
1358-
path: str | None,
1359-
ignore_all: bool,
1360-
manager: BuildManager,
1356+
meta: CacheMeta | None, id: str, path: str | None, ignore_all: bool, manager: BuildManager
13611357
) -> CacheMeta | None:
13621358
"""Checks whether the cached AST of this module can be used.
13631359

mypy/checker.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -988,10 +988,7 @@ def _visit_func_def(self, defn: FuncDef) -> None:
988988
)
989989

990990
def check_func_item(
991-
self,
992-
defn: FuncItem,
993-
type_override: CallableType | None = None,
994-
name: str | None = None,
991+
self, defn: FuncItem, type_override: CallableType | None = None, name: str | None = None
995992
) -> None:
996993
"""Type check a function.
997994
@@ -2950,9 +2947,7 @@ def enter_final_context(self, is_final_def: bool) -> Iterator[None]:
29502947
finally:
29512948
self._is_final_def = old_ctx
29522949

2953-
def check_final(
2954-
self, s: AssignmentStmt | OperatorAssignmentStmt | AssignmentExpr
2955-
) -> None:
2950+
def check_final(self, s: AssignmentStmt | OperatorAssignmentStmt | AssignmentExpr) -> None:
29562951
"""Check if this assignment does not assign to a final attribute.
29572952
29582953
This function performs the check only for name assignments at module
@@ -3421,9 +3416,7 @@ def check_multi_assignment_from_iterable(
34213416
else:
34223417
self.msg.type_not_iterable(rvalue_type, context)
34233418

3424-
def check_lvalue(
3425-
self, lvalue: Lvalue
3426-
) -> tuple[Type | None, IndexExpr | None, Var | None]:
3419+
def check_lvalue(self, lvalue: Lvalue) -> tuple[Type | None, IndexExpr | None, Var | None]:
34273420
lvalue_type = None
34283421
index_lvalue = None
34293422
inferred = None
@@ -6173,9 +6166,7 @@ def conditional_types(
61736166

61746167

61756168
def conditional_types(
6176-
current_type: Type,
6177-
proposed_type_ranges: list[TypeRange] | None,
6178-
default: Type | None = None,
6169+
current_type: Type, proposed_type_ranges: list[TypeRange] | None, default: Type | None = None
61796170
) -> tuple[Type | None, Type | None]:
61806171
"""Takes in the current type and a proposed type of an expression.
61816172

mypy/checkexpr.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44

55
import itertools
66
from contextlib import contextmanager
7-
from typing import (
8-
Callable,
9-
ClassVar,
10-
Iterator,
11-
List,
12-
Optional,
13-
Sequence,
14-
cast,
15-
)
7+
from typing import Callable, ClassVar, Iterator, List, Optional, Sequence, cast
168
from typing_extensions import Final, TypeAlias as _TypeAlias, overload
179

1810
import mypy.checker
@@ -708,11 +700,7 @@ def match_typeddict_call_with_dict(
708700
return False
709701

710702
def check_typeddict_call_with_dict(
711-
self,
712-
callee: TypedDictType,
713-
kwargs: DictExpr,
714-
context: Context,
715-
orig_callee: Type | None,
703+
self, callee: TypedDictType, kwargs: DictExpr, context: Context, orig_callee: Type | None
716704
) -> Type:
717705
validated_kwargs = self.validate_typeddict_kwargs(kwargs=kwargs)
718706
if validated_kwargs is not None:
@@ -3918,9 +3906,7 @@ def fast_container_type(
39183906
self.resolved_type[e] = ct
39193907
return ct
39203908

3921-
def check_lst_expr(
3922-
self, e: ListExpr | SetExpr | TupleExpr, fullname: str, tag: str
3923-
) -> Type:
3909+
def check_lst_expr(self, e: ListExpr | SetExpr | TupleExpr, fullname: str, tag: str) -> Type:
39243910
# fast path
39253911
t = self.fast_container_type(e, fullname)
39263912
if t:

mypy/checkmember.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Callable, Sequence, TYPE_CHECKING, cast
5+
from typing import TYPE_CHECKING, Callable, Sequence, cast
66

77
from mypy import meet, message_registry, subtypes
88
from mypy.erasetype import erase_typevars
@@ -772,9 +772,7 @@ def freeze_type_vars(member_type: Type) -> None:
772772
v.id.meta_level = 0
773773

774774

775-
def lookup_member_var_or_accessor(
776-
info: TypeInfo, name: str, is_lvalue: bool
777-
) -> SymbolNode | None:
775+
def lookup_member_var_or_accessor(info: TypeInfo, name: str, is_lvalue: bool) -> SymbolNode | None:
778776
"""Find the attribute/accessor node that refers to a member of a type."""
779777
# TODO handle lvalues
780778
node = info.get(name)

mypy/checkstrformat.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@
1313
from __future__ import annotations
1414

1515
import re
16-
from typing import (
17-
TYPE_CHECKING,
18-
Callable,
19-
Dict,
20-
Match,
21-
Pattern,
22-
Tuple,
23-
Union,
24-
cast,
25-
)
16+
from typing import TYPE_CHECKING, Callable, Dict, Match, Pattern, Tuple, Union, cast
2617
from typing_extensions import Final, TypeAlias as _TypeAlias
2718

2819
import mypy.errorcodes as codes

mypy/constraints.py

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

33
from __future__ import annotations
44

5-
from typing import Iterable, List, Sequence, TYPE_CHECKING
5+
from typing import TYPE_CHECKING, Iterable, List, Sequence
66
from typing_extensions import Final
77

88
import mypy.subtypes

mypy/dmypy/client.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ class BadStatus(Exception):
263263
"""
264264

265265

266-
267266
def main(argv: list[str]) -> None:
268267
"""The code is top-down."""
269268
check_python_version("dmypy")
@@ -547,10 +546,7 @@ def do_inspect(args: argparse.Namespace) -> None:
547546

548547

549548
def check_output(
550-
response: dict[str, Any],
551-
verbose: bool,
552-
junit_xml: str | None,
553-
perf_stats_file: str | None,
549+
response: dict[str, Any], verbose: bool, junit_xml: str | None, perf_stats_file: str | None
554550
) -> None:
555551
"""Print the output from a check or recheck command.
556552

mypy/dmypy_server.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
from subprocess import STARTUPINFO
4444

4545
def daemonize(
46-
options: Options,
47-
status_file: str,
48-
timeout: int | None = None,
49-
log_file: str | None = None,
46+
options: Options, status_file: str, timeout: int | None = None, log_file: str | None = None
5047
) -> int:
5148
"""Create the daemon process via "dmypy daemon" and pass options via command line
5249
@@ -118,10 +115,7 @@ def _daemonize_cb(func: Callable[[], None], log_file: str | None = None) -> int:
118115
os._exit(1)
119116

120117
def daemonize(
121-
options: Options,
122-
status_file: str,
123-
timeout: int | None = None,
124-
log_file: str | None = None,
118+
options: Options, status_file: str, timeout: int | None = None, log_file: str | None = None
125119
) -> int:
126120
"""Run the mypy daemon in a grandchild of the current process
127121

mypy/errors.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,10 +1048,7 @@ class CompileError(Exception):
10481048
module_with_blocker: str | None = None
10491049

10501050
def __init__(
1051-
self,
1052-
messages: list[str],
1053-
use_stdout: bool = False,
1054-
module_with_blocker: str | None = None,
1051+
self, messages: list[str], use_stdout: bool = False, module_with_blocker: str | None = None
10551052
) -> None:
10561053
super().__init__("\n".join(messages))
10571054
self.messages = messages

mypy/exprtotype.py

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

33
from __future__ import annotations
44

5-
65
from mypy.fastparse import parse_type_string
76
from mypy.nodes import (
87
BytesExpr,

mypy/fastparse.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@
149149
)
150150

151151
def ast3_parse(
152-
source: str | bytes,
153-
filename: str,
154-
mode: str,
155-
feature_version: int = PY_MINOR_VERSION,
152+
source: str | bytes, filename: str, mode: str, feature_version: int = PY_MINOR_VERSION
156153
) -> AST:
157154
return ast3.parse(
158155
source,
@@ -185,10 +182,7 @@ def ast3_parse(
185182
)
186183

187184
def ast3_parse(
188-
source: str | bytes,
189-
filename: str,
190-
mode: str,
191-
feature_version: int = PY_MINOR_VERSION,
185+
source: str | bytes, filename: str, mode: str, feature_version: int = PY_MINOR_VERSION
192186
) -> AST:
193187
return ast3.parse(source, filename, mode, feature_version=feature_version)
194188

mypy/ipc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class IPCException(Exception):
3636
"""Exception for IPC issues."""
3737

3838

39-
4039
class IPCBase:
4140
"""Base class for communication between the dmypy client and server.
4241

mypy/join.py

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

33
from __future__ import annotations
44

5-
65
import mypy.typeops
76
from mypy.maptype import map_instance_to_supertype
87
from mypy.nodes import CONTRAVARIANT, COVARIANT, INVARIANT

mypy/lookup.py

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

66
from __future__ import annotations
77

8-
98
from mypy.nodes import MypyFile, SymbolTableNode, TypeInfo
109

1110
# TODO: gradually move existing lookup functions to this module.

mypy/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import time
1010
from gettext import gettext
11-
from typing import Any, IO, NoReturn, Sequence, TextIO
11+
from typing import IO, Any, NoReturn, Sequence, TextIO
1212
from typing_extensions import Final
1313

1414
from mypy import build, defaults, state, util

mypy/maptype.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
43
import mypy.typeops
54
from mypy.expandtype import expand_type
65
from mypy.nodes import TypeInfo

mypy/messages.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@
1515
import re
1616
from contextlib import contextmanager
1717
from textwrap import dedent
18-
from typing import (
19-
Any,
20-
Callable,
21-
Iterable,
22-
Iterator,
23-
List,
24-
Sequence,
25-
cast,
26-
)
18+
from typing import Any, Callable, Iterable, Iterator, List, Sequence, cast
2719
from typing_extensions import Final
2820

2921
from mypy import errorcodes as codes, message_registry
@@ -820,10 +812,7 @@ def invalid_index_type(
820812
)
821813

822814
def too_few_arguments(
823-
self,
824-
callee: CallableType,
825-
context: Context,
826-
argument_names: Sequence[str | None] | None,
815+
self, callee: CallableType, context: Context, argument_names: Sequence[str | None] | None
827816
) -> None:
828817
if argument_names is not None:
829818
num_positional_args = sum(k is None for k in argument_names)

mypy/metastore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import os
1515
import time
1616
from abc import abstractmethod
17-
from typing import Any, Iterable, TYPE_CHECKING
17+
from typing import TYPE_CHECKING, Any, Iterable
1818

1919
if TYPE_CHECKING:
2020
# We avoid importing sqlite3 unless we are using it so we can mostly work

mypy/mixedtraverser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
43
from mypy.nodes import (
54
AssertTypeExpr,
65
AssignmentStmt,

mypy/moduleinspect.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ def get_package_properties(package_id: str) -> ModuleProperties:
8686
)
8787

8888

89-
def worker(
90-
tasks: Queue[str], results: Queue[str | ModuleProperties], sys_path: list[str]
91-
) -> None:
89+
def worker(tasks: Queue[str], results: Queue[str | ModuleProperties], sys_path: list[str]) -> None:
9290
"""The main loop of a worker introspection process."""
9391
sys.path = sys_path
9492
while True:

mypy/nodes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,9 +1442,7 @@ class IfStmt(Statement):
14421442
body: list[Block]
14431443
else_body: Block | None
14441444

1445-
def __init__(
1446-
self, expr: list[Expression], body: list[Block], else_body: Block | None
1447-
) -> None:
1445+
def __init__(self, expr: list[Expression], body: list[Block], else_body: Block | None) -> None:
14481446
super().__init__()
14491447
self.expr = expr
14501448
self.body = body
@@ -2513,9 +2511,7 @@ class EnumCallExpr(Expression):
25132511
items: list[str]
25142512
values: list[Expression | None]
25152513

2516-
def __init__(
2517-
self, info: TypeInfo, items: list[str], values: list[Expression | None]
2518-
) -> None:
2514+
def __init__(self, info: TypeInfo, items: list[str], values: list[Expression | None]) -> None:
25192515
super().__init__()
25202516
self.info = info
25212517
self.items = items

mypy/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pprint
44
import re
55
import sys
6-
from typing import Any, Callable, Mapping, Pattern, TYPE_CHECKING
6+
from typing import TYPE_CHECKING, Any, Callable, Mapping, Pattern
77
from typing_extensions import Final
88

99
from mypy import defaults

0 commit comments

Comments
 (0)