Check that each name is defined once [no-redef]

Mypy may generate an error if you have multiple definitions for a namein the same namespace. The reason is that this is often an error, asthe second definition may overwrite the first one. Also, mypy oftencan’t be able to determine whether references point to the first orthe second definition, which would compromise type checking.

If you silence this error, all references to the defined name refer tothe first definition.

Example:

  1. class A:
  2. def __init__(self, x: int) -> None: ...
  3.  
  4. class A: # Error: Name 'A' already defined on line 1 [no-redef]
  5. def __init__(self, x: str) -> None: ...
  6.  
  7. # Error: Argument 1 to "A" has incompatible type "str"; expected "int"
  8. # (the first definition wins!)
  9. A('x')