Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find code that is missing type annotations?

I have a project that is fully annotated. Or at least I hope so, because it is entirely possible that there is a function or two somewhere in there that is missing type annotations. How can I find such functions (or any other blocks of code)?

like image 372
frnhr Avatar asked Jan 24 '20 14:01

frnhr


1 Answers

You can use mypy for this. Just add some switches to the command call:

$ mypy --disallow-untyped-calls --disallow-untyped-defs --disallow-incomplete-defs projectname

This will find you all untyped defines plus incomplete defines and also warns you if you call a untyped function.

For further information have a look at the untyped-definitions-and-calls section of the mypy documentation.

like image 199
MrLeeh Avatar answered Oct 21 '22 07:10

MrLeeh