Skip to content

More Features

KotlinIsland edited this page Mar 16, 2022 · 19 revisions

--legacy

Alters the configuration of basedmypy to be much more similar to mypy, it is not completely compatible though, and baseline functionality is still active.
To disable the baseline, invoke basedmypy specifying the baseline file as an empty string: mypy --baseline-file= src

--default-return

Causes an unannotated return type to be inferred as None.

def foo(i: int):
  print(i)

reveal_type(foo)  # revealed type is "def(int)"

It is recommended to only apply this option in the specific modules that will use it, as partially typed third party code can cause problems.

[[tool.mypy-overrides]]
module = ["mypackage.*"]
default_return = true

--nonlocal-partial-types

The --local-partial-types flag in mypy is confusing, so in basedmypy it's removed in favor of the inverse --nonlocal-partial-types

Clone this wiki locally