basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

make `work_not_properly_function_names` per module

Open DetachHead opened this issue 1 year ago • 3 comments

[[tool.mypy.overrides]]
module = "among.us"
work_not_properly_function_names = true

DetachHead avatar Jan 09 '24 23:01 DetachHead

I am new and i am trying to understand the issue. Can you describe it little bit more?

bvedang avatar Jan 10 '24 01:01 bvedang

@bvedang upstream mypy does not complain when overridden methods have incoorect argument names:

from typing import override

class Foo:
    def foo(self, a: object): ...


class Bar(Foo):
    @override
    def foo(self, b: object): ... # no error

foo: Foo = Bar()
foo.foo(a=1) # no error, crashes at runtime

basedmypy fixes this, but it also introduces an undocumented option to disable it (work_not_properly_function_names), because the mypy codebase itself is full of overrides that have different argument names so it needs to be turned off when type-checking mypy itself

however the option cannot be set per-module, only globally.

DetachHead avatar Jan 10 '24 04:01 DetachHead

take a look at mypy.options.PER_MODULE_OPTIONS

KotlinIsland avatar Jan 10 '24 05:01 KotlinIsland