Skip to content

Commit 1ae0e62

Browse files
committed
deleted unrelate file changes
1 parent e802b54 commit 1ae0e62

File tree

8 files changed

+19
-58
lines changed

8 files changed

+19
-58
lines changed

mypy.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

mypy/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from mypy.version import __version__
2727

2828
try:
29-
from lxml import etree
29+
from lxml import etree # type: ignore[import-untyped]
3030

3131
LXML_INSTALLED = True
3232
except ImportError:

mypy/stubtest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ def verify_mypyfile(
337337
if isinstance(runtime, Missing):
338338
yield Error(object_path, "is not present at runtime", stub, runtime)
339339
return
340-
# if not isinstance(runtime, types.ModuleType):
341-
# Can possibly happen:
342-
# yield Error(object_path, "is not a module", stub, runtime)
343-
# return
340+
if not isinstance(runtime, types.ModuleType):
341+
# Can possibly happen:
342+
yield Error(object_path, "is not a module", stub, runtime) # type: ignore[unreachable]
343+
return
344344

345345
runtime_all_as_set: set[str] | None
346346

mypy/suggestions.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,13 @@ def extract_from_decorator(self, node: Decorator) -> FuncDef | None:
651651
if not isinstance(typ, FunctionLike):
652652
return None
653653
for ct in typ.items:
654-
if len(ct.arg_types) != 1:
654+
if not (
655+
len(ct.arg_types) == 1
656+
and isinstance(ct.arg_types[0], TypeVarType)
657+
and ct.arg_types[0] == ct.ret_type
658+
):
655659
return None
656-
657-
arg_type = get_proper_type(ct.arg_types[0])
658-
ret_type = get_proper_type(ct.ret_type)
659-
660-
if isinstance(arg_type, TypeVarType) and arg_type == ret_type:
661-
continue
662-
663-
return None
664-
660+
665661
return node.func
666662

667663
def try_type(self, func: FuncDef, typ: ProperType) -> list[str]:

mypy/test/testcheck.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import os
66
import re
77
import sys
8-
import types
98

10-
import pytest
119

1210
from mypy import build
1311
from mypy.build import Graph
@@ -29,12 +27,12 @@
2927

3028
lxml: types.ModuleType | None
3129
try:
32-
import importlib
33-
34-
lxml = importlib.import_module("lxml")
30+
import lxml # type: ignore[import-untyped]
3531
except ImportError:
3632
lxml = None
3733

34+
import pytest
35+
3836
# List of files that contain test case descriptions.
3937
# Includes all check-* files with the .test extension in the test-data/unit directory
4038
typecheck_files = find_test_files(pattern="check-*.test")
@@ -58,10 +56,8 @@ class TypeCheckSuite(DataSuite):
5856
files = typecheck_files
5957

6058
def run_case(self, testcase: DataDrivenTestCase) -> None:
61-
if lxml is None:
62-
# if os.path.basename(testcase.file) == "check-reports.test":
59+
if lxml is None and os.path.basename(testcase.file) == "check-reports.test":
6360
pytest.skip("Cannot import lxml. Is it installed?")
64-
# return
6561
incremental = (
6662
"incremental" in testcase.name.lower()
6763
or "incremental" in testcase.file

mypy/test/testcmdline.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import re
1111
import subprocess
1212
import sys
13-
import types
1413

1514
from mypy.test.config import PREFIX, test_temp_dir
1615
from mypy.test.data import DataDrivenTestCase, DataSuite
@@ -20,15 +19,11 @@
2019
normalize_error_messages,
2120
)
2221

23-
lxml: types.ModuleType | None
2422
try:
25-
import importlib
26-
27-
lxml = importlib.import_module("lxml")
23+
import lxml # type: ignore[import-untyped]
2824
except ImportError:
2925
lxml = None
3026

31-
3227
import pytest
3328

3429
# Path to Python 3 interpreter
@@ -43,7 +38,7 @@ class PythonCmdlineSuite(DataSuite):
4338
native_sep = True
4439

4540
def run_case(self, testcase: DataDrivenTestCase) -> None:
46-
if os.path.basename(testcase.file) == "reports.test" and lxml is None:
41+
if lxml is None and os.path.basename(testcase.file) == "reports.test":
4742
pytest.skip("Cannot import lxml. Is it installed?")
4843
for step in [1] + sorted(testcase.output2):
4944
test_python_cmdline(testcase, step)

mypy/test/testreports.py

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

33
from __future__ import annotations
44

5-
import importlib.util
65
import textwrap
7-
import types
86

97
from mypy.report import CoberturaPackage, get_line_rate
108
from mypy.test.helpers import Suite, assert_equal
119

12-
lxml: types.ModuleType | None
1310
try:
14-
import importlib
15-
16-
lxml = importlib.import_module("lxml")
11+
import lxml # type: ignore[import-untyped]
1712
except ImportError:
1813
lxml = None
1914

@@ -28,7 +23,7 @@ def test_get_line_rate(self) -> None:
2823

2924
@pytest.mark.skipif(lxml is None, reason="Cannot import lxml. Is it installed?")
3025
def test_as_xml(self) -> None:
31-
import lxml.etree as etree
26+
import lxml.etree as etree # type: ignore[import-untyped]
3227

3328
cobertura_package = CoberturaPackage("foobar")
3429
cobertura_package.covered_lines = 21

mypy/test_decorator_suggestion.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)