Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 28, 2023
1 parent 7c066f3 commit 598847a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions docs/source/stubgen.rst
Expand Up @@ -139,8 +139,8 @@ alter the default behavior:

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

Expand Down
6 changes: 2 additions & 4 deletions mypy/stubgen.py
Expand Up @@ -42,14 +42,12 @@
from __future__ import annotations

import argparse
import glob
import keyword
import os
import os.path
import sys
import traceback
from collections import defaultdict
from typing import Final, Iterable, Mapping
from typing import Final, Iterable
from typing_extensions import Final

import mypy.build
Expand Down Expand Up @@ -113,10 +111,10 @@
from mypy.stubdoc import ArgSig, FunctionSig
from mypy.stubgenc import InspectionStubGenerator, generate_stub_for_c_module
from mypy.stubutil import (
BaseStubGenerator,
CantImport,
ClassInfo,
FunctionContext,
BaseStubGenerator,
common_dir_prefix,
fail_missing,
find_module_path_and_all_py3,
Expand Down
8 changes: 3 additions & 5 deletions mypy/stubgenc.py
Expand Up @@ -11,10 +11,8 @@
import inspect
import keyword
import os.path
import re
from abc import abstractmethod
from types import FunctionType, ModuleType
from typing import Any, Final, Mapping
from typing import Any, Mapping

from mypy.fastparse import parse_type_comment
from mypy.moduleinspect import is_c_module
Expand All @@ -31,10 +29,10 @@
parse_all_signatures,
)
from mypy.stubutil import (
BaseStubGenerator,
ClassInfo,
FunctionContext,
SignatureGenerator,
BaseStubGenerator,
infer_method_ret_type,
)

Expand Down Expand Up @@ -587,7 +585,7 @@ def _fix_iter(
ctx.class_info
and ctx.class_info.cls is not None
and ctx.name == "__getitem__"
and "__iter__" not in getattr(ctx.class_info.cls, "__dict__")
and "__iter__" not in ctx.class_info.cls.__dict__
):
item_type: str | None = None
for sig in inferred:
Expand Down
1 change: 0 additions & 1 deletion mypy/stubutil.py
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import keyword
import os.path
import re
import sys
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/stubgen.test
Expand Up @@ -2853,7 +2853,7 @@ __uri__ = ''
__version__ = ''

[out]
from m import __version__ as __version__
from m import __version__ as __version__

class A: ...

Expand Down

0 comments on commit 598847a

Please sign in to comment.