Search code examples
pythontype-hintinglintpylint

Is there a python linter that checks if the type hint comes from the typing module?


I am looking for a python linter that checks if type hints come from the typing module.

As in, this:

def  func(arg: list)-> None:
   """ does something """

should be:

from typing import List

def  func(arg: List)-> None:
   """ does something """

Solution

  • To answer, you can use mypy. On a note typing.List is deprecated since 3.9