Skip to content

Commit 867958e

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f45652d commit 867958e

File tree

8 files changed

+19
-13
lines changed

8 files changed

+19
-13
lines changed

mypy/checker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
from mypy.mro import MroError, calculate_mro
4444
from mypy.nodes import (
4545
ARG_NAMED,
46-
SYMBOL_FUNCBASE_TYPES,
4746
ARG_POS,
4847
ARG_STAR,
4948
CONTRAVARIANT,
@@ -57,6 +56,7 @@
5756
LITERAL_TYPE,
5857
MDEF,
5958
NOT_ABSTRACT,
59+
SYMBOL_FUNCBASE_TYPES,
6060
AssertStmt,
6161
AssignmentExpr,
6262
AssignmentStmt,
@@ -4341,7 +4341,9 @@ def simple_rvalue(self, rvalue: Expression) -> bool:
43414341
if isinstance(rvalue, (IntExpr, StrExpr, BytesExpr, FloatExpr, RefExpr)):
43424342
return True
43434343
if isinstance(rvalue, CallExpr):
4344-
if isinstance(rvalue.callee, RefExpr) and isinstance(rvalue.callee.node, SYMBOL_FUNCBASE_TYPES):
4344+
if isinstance(rvalue.callee, RefExpr) and isinstance(
4345+
rvalue.callee.node, SYMBOL_FUNCBASE_TYPES
4346+
):
43454347
typ = rvalue.callee.node.type
43464348
if isinstance(typ, CallableType):
43474349
return not typ.variables

mypy/constraints.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ def infer_constraints_for_callable(
240240
)
241241
c = infer_constraints(callee.arg_types[i], actual_type, SUPERTYPE_OF)
242242
constraints.extend(c)
243-
if (
244-
param_spec
245-
and not any(c.type_var == param_spec.id for c in constraints)
246-
):
243+
if param_spec and not any(c.type_var == param_spec.id for c in constraints):
247244
# Use ParamSpec constraint from arguments only if there are no other constraints,
248245
# since as explained above it is quite ad-hoc.
249246
constraints.append(

mypy/errors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from mypy import errorcodes as codes
1212
from mypy.error_formatter import ErrorFormatter
1313
from mypy.errorcodes import IMPORT, IMPORT_NOT_FOUND, IMPORT_UNTYPED, ErrorCode, mypy_error_codes
14-
from mypy.message_registry import ErrorMessage
1514
from mypy.options import Options
1615
from mypy.scope import Scope
1716
from mypy.util import DEFAULT_SOURCE_OFFSET, is_typeshed_file

mypy/nodes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2548,9 +2548,10 @@ def name(self) -> str:
25482548
def fullname(self) -> str:
25492549
return self._fullname
25502550

2551+
25512552
# All types that are both SymbolNodes and Expressions.
25522553
# Use when common children of them are needed.
2553-
SYMBOL_NODE_EXPRESSION_TYPES: Final = (TypeVarLikeExpr, )
2554+
SYMBOL_NODE_EXPRESSION_TYPES: Final = (TypeVarLikeExpr,)
25542555

25552556

25562557
class TypeVarExpr(TypeVarLikeExpr):

mypy/plugins/functools.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
import mypy.plugin
99
import mypy.semanal
1010
from mypy.argmap import map_actuals_to_formals
11-
from mypy.nodes import SYMBOL_FUNCBASE_TYPES, ARG_POS, ARG_STAR2, ArgKind, Argument, CallExpr, FuncItem, NameExpr, Var
11+
from mypy.nodes import (
12+
ARG_POS,
13+
ARG_STAR2,
14+
SYMBOL_FUNCBASE_TYPES,
15+
ArgKind,
16+
Argument,
17+
CallExpr,
18+
NameExpr,
19+
Var,
20+
)
1221
from mypy.plugins.common import add_method_to_class
1322
from mypy.typeops import get_all_type_vars
1423
from mypy.types import (

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
from mypy.mro import MroError, calculate_mro
7272
from mypy.nodes import (
7373
ARG_NAMED,
74-
SYMBOL_FUNCBASE_TYPES,
7574
ARG_POS,
7675
ARG_STAR2,
7776
CONTRAVARIANT,
@@ -87,6 +86,7 @@
8786
REVEAL_LOCALS,
8887
REVEAL_TYPE,
8988
RUNTIME_PROTOCOL_DECOS,
89+
SYMBOL_FUNCBASE_TYPES,
9090
TYPE_VAR_KIND,
9191
TYPE_VAR_TUPLE_KIND,
9292
VARIANCE_NOT_READY,

mypy/server/astdiff.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ class level -- these are handled at attribute level (say, 'mod.Cls.method'
5858

5959
from mypy.expandtype import expand_type
6060
from mypy.nodes import (
61-
UNBOUND_IMPORTED,
6261
SYMBOL_FUNCBASE_TYPES,
62+
UNBOUND_IMPORTED,
6363
Decorator,
64-
FuncBase,
6564
FuncDef,
6665
FuncItem,
6766
MypyFile,

mypy/test/testmerge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
UNBOUND_IMPORTED,
1414
Expression,
1515
MypyFile,
16-
Node,
1716
SymbolTable,
1817
SymbolTableNode,
1918
TypeInfo,

0 commit comments

Comments
 (0)