Skip to content

dmypy gives errors that mypy does not give, also the error makes no sense #18763

Open
@johnfn

Description

@johnfn

Bug Report

When running dmypy I get this error sometimes:

Linting...
Function is missing a type annotation

>>> 78 class ApplicationDataBaseApplicationModel):

This doesn't make sense for two reasons:

  • mypy does not ever error on this line
  • There is no function on this line, let alone an unannotated one

The surrounding code looks like this:

class SomeReturnType:
    ...

def my_function(team_id: int, job_id: int) -> type[SomeReturnType]:
    # do some initial work, set some variables etc

    class ApplicationData(BaseApplicationModel):
        # ... more class properties here

To Reproduce

Can't say exactly because dmypy doesn't always give an error.

Expected Behavior

No error.

Your Environment

  • Mypy version used: v1.15
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): see my previous issues
  • Python version used: 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions