Skip to content

Commit 7670ac9

Browse files
ilinumgvanrossum
authored andcommitted
Document --disallow-any=generics (#3677)
1 parent 3a17dbd commit 7670ac9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

docs/source/command_line.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ Here are some more useful flags:
278278

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

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

308+
``generics`` disallows usage of generic types that do not specify explicit
309+
type parameters. Moreover, built-in collections (such as ``list`` and
310+
``dict``) become disallowed as you should use their aliases from the typing
311+
module (such as ``List[int]`` and ``Dict[str, str]``).
312+
307313
- ``--disallow-untyped-defs`` reports an error whenever it encounters
308314
a function definition without type annotations.
309315

docs/source/config_file.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ overridden by the pattern sections matching the module name.
150150
- ``disallow_any`` (Comma-separated list, default empty) is an option to
151151
disallow various types of ``Any`` in a module. The flag takes a
152152
comma-separated list of the following arguments: ``unimported``,
153-
``unannotated``, ``expr``, ``decorated``, ``explicit``. For explanations
154-
see the discussion for the :ref:`--disallow-any <disallow-any>` option.
153+
``unannotated``, ``expr``, ``decorated``, ``explicit``, ``generics``.
154+
For explanations see the discussion for the :ref:`--disallow-any <disallow-any>` option.
155155

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

0 commit comments

Comments
 (0)