Skip to content

Document --disallow-any=generics #3677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ Here are some more useful flags:

- ``--disallow-any`` disallows various types of ``Any`` in a module.
The option takes a comma-separated list of the following values:
``unimported``, ``unannotated``, ``expr``, ``decorated``, ``explicit``.
``unimported``, ``unannotated``, ``expr``, ``decorated``, ``explicit``,
``generics``.

``unimported`` disallows usage of types that come from unfollowed imports
(such types become aliases for ``Any``). Unfollowed imports occur either
Expand All @@ -304,6 +305,11 @@ Here are some more useful flags:
``explicit`` disallows explicit ``Any`` in type positions such as type
annotations and generic type parameters.

``generics`` disallows usage of generic types that do not specify explicit
type parameters. Moreover, built-in collections (such as ``list`` and
``dict``) become disallowed as you should use their aliases from the typing
module (such as ``List[int]`` and ``Dict[str, str]``).

- ``--disallow-untyped-defs`` reports an error whenever it encounters
a function definition without type annotations.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ overridden by the pattern sections matching the module name.
- ``disallow_any`` (Comma-separated list, default empty) is an option to
disallow various types of ``Any`` in a module. The flag takes a
comma-separated list of the following arguments: ``unimported``,
``unannotated``, ``expr``, ``decorated``, ``explicit``. For explanations
see the discussion for the :ref:`--disallow-any <disallow-any>` option.
``unannotated``, ``expr``, ``decorated``, ``explicit``, ``generics``.
For explanations see the discussion for the :ref:`--disallow-any <disallow-any>` option.

- ``disallow_untyped_calls`` (Boolean, default False) disallows
calling functions without type annotations from functions with type
Expand Down