Skip to content

strange work with .pyi files #16672

@ZeN220

Description

@ZeN220

I generate stub files for GRPC client/server with mypy-protobuf. As far as I can tell, they are generated correctly, and mypy should detect the Response and Data classes, for they are defined in the .pyi file

To Reproduce
https://gist.github.com/ZeN220/5ed2f6b4f841929860ce111d16940aaa

Actual Behavior

> mypy a_pb2.py
__init__.py:1: error: Module "aaa.a_pb2" has no attribute "Response"  [attr-defined]
__init__.py:1: error: Module "aaa.a_pb2" has no attribute "Data"  [attr-defined]
Found 2 errors in 1 file (checked 1 source file)

But if running:

> mypy .
Success: no issues found in 2 source files
  • Mypy version used: 1.7.1
  • Mypy command-line flags: nothing
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
disable_error_code = ["assignment"]
  • Python version used: 3.9.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions