Skip to content

Commit 598847a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7c066f3 commit 598847a

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

docs/source/stubgen.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ alter the default behavior:
139139

140140
Import and inspect modules instead of parsing source code. This is the default
141141
behavior for c modules and pyc-only packages. The flag is useful to force
142-
inspection for pure python modules that make use of dynamically generated
143-
members that would otherwiswe be omitted when using the default behavior of
142+
inspection for pure python modules that make use of dynamically generated
143+
members that would otherwiswe be omitted when using the default behavior of
144144
code parsing. Implies :option:`--no-analysis` as analysis requires source
145145
code.
146146

mypy/stubgen.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@
4242
from __future__ import annotations
4343

4444
import argparse
45-
import glob
4645
import keyword
4746
import os
4847
import os.path
4948
import sys
5049
import traceback
51-
from collections import defaultdict
52-
from typing import Final, Iterable, Mapping
50+
from typing import Final, Iterable
5351
from typing_extensions import Final
5452

5553
import mypy.build
@@ -113,10 +111,10 @@
113111
from mypy.stubdoc import ArgSig, FunctionSig
114112
from mypy.stubgenc import InspectionStubGenerator, generate_stub_for_c_module
115113
from mypy.stubutil import (
114+
BaseStubGenerator,
116115
CantImport,
117116
ClassInfo,
118117
FunctionContext,
119-
BaseStubGenerator,
120118
common_dir_prefix,
121119
fail_missing,
122120
find_module_path_and_all_py3,

mypy/stubgenc.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
import inspect
1212
import keyword
1313
import os.path
14-
import re
15-
from abc import abstractmethod
1614
from types import FunctionType, ModuleType
17-
from typing import Any, Final, Mapping
15+
from typing import Any, Mapping
1816

1917
from mypy.fastparse import parse_type_comment
2018
from mypy.moduleinspect import is_c_module
@@ -31,10 +29,10 @@
3129
parse_all_signatures,
3230
)
3331
from mypy.stubutil import (
32+
BaseStubGenerator,
3433
ClassInfo,
3534
FunctionContext,
3635
SignatureGenerator,
37-
BaseStubGenerator,
3836
infer_method_ret_type,
3937
)
4038

@@ -587,7 +585,7 @@ def _fix_iter(
587585
ctx.class_info
588586
and ctx.class_info.cls is not None
589587
and ctx.name == "__getitem__"
590-
and "__iter__" not in getattr(ctx.class_info.cls, "__dict__")
588+
and "__iter__" not in ctx.class_info.cls.__dict__
591589
):
592590
item_type: str | None = None
593591
for sig in inferred:

mypy/stubutil.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-
import keyword
65
import os.path
76
import re
87
import sys

test-data/unit/stubgen.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2853,7 +2853,7 @@ __uri__ = ''
28532853
__version__ = ''
28542854

28552855
[out]
2856-
from m import __version__ as __version__
2856+
from m import __version__ as __version__
28572857

28582858
class A: ...
28592859

0 commit comments

Comments
 (0)