Miscellaneous strictness flags

  • allow_untyped_globals (bool, default False)
  • Causes mypy to suppress errors caused by not being able to fullyinfer the types of global and class variables.
  • allow_redefinition (bool, default False)
  • Allows variables to be redefined with an arbitrary type, as long as the redefinitionis in the same block and nesting level as the original definition.
  • implicit_reexport (bool, default True)
  • By default, imported values to a module are treated as exported and mypy allowsother modules to import them. When false, mypy will not re-export unlessthe item is imported using from-as or is included in all. Note that mypytreats stub files as if this is always disabled. For example:
  1. # This won't re-export the value
  2. from foo import bar
  3. # This will re-export it as bar and allow other modules to import it
  4. from foo import bar as bar
  5. # This will also re-export bar
  6. from foo import bar
  7. __all__ = ['bar']
  • strict_equality (bool, default False)
  • Prohibit equality checks, identity checks, and container checks betweennon-overlapping types.