Skip to content

mypy produces errors when run on its own #8070

Open
@tianyizheng02

Description

@tianyizheng02

Feature description

Apologies if I'm misunderstanding about how mypy is set up with this repo. mypy currently produces a litany of errors when run on its own even though it passes when run as part of pre-commit:

> mypy --ignore-missing-imports --install-types --non-interactive .
dynamic_programming/fibonacci.py:37: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
dynamic_programming/fibonacci.py:42: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
searches/binary_tree_traversal.py:21: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
maths/sigmoid_linear_unit.py:20: error: Function "numpy.core.multiarray.array" is not valid as a type  [valid-type]
maths/sigmoid_linear_unit.py:20: note: Perhaps you need "Callable[...]" or a callback protocol?
maths/sigmoid_linear_unit.py:29: error: Unsupported operand type for unary - (np.array?)  [operator]
maths/sigmoid_linear_unit.py:32: error: Function "numpy.core.multiarray.array" is not valid as a type  [valid-type]
maths/sigmoid_linear_unit.py:32: note: Perhaps you need "Callable[...]" or a callback protocol?
maths/sigmoid_linear_unit.py:51: error: Unsupported left operand type for * (np.array?)  [operator]
maths/sigmoid.py:14: error: Function "numpy.core.multiarray.array" is not valid as a type  [valid-type]
...
Found 87 errors in 13 files (checked 1143 source files)

Is this expected behavior? Should we expect mypy, when run on its own, to agree with pre-commit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions