From ec103fe7b3dfdda1dbfb8fe68320a19555c52535 Mon Sep 17 00:00:00 2001 From: Niklas Gustafson Date: Sun, 1 Aug 2021 16:04:37 +0200 Subject: [PATCH 1/2] Add new regex example to --exclude docs Adds an example on how to use the OR-operator to combine two regular expressions in order to ignore multiple file or directory names. --- docs/source/command_line.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 2d82d2b83517..c38e9d49ce35 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -58,7 +58,9 @@ for full details, see :ref:`running-mypy`. For instance, to avoid discovering any files named `setup.py` you could pass ``--exclude '/setup\.py$'``. Similarly, you can ignore discovering directories with a given name by e.g. ``--exclude /build/`` or - those matching a subpath with ``--exclude /project/vendor/``. + those matching a subpath with ``--exclude /project/vendor/``. In adition, + to ignore multiple file or directory names, you can combine expressions + with ``|`` and pass e.g ``--exclude '/setup\.py$|/build/'``. Note that this flag only affects recursive discovery, that is, when mypy is discovering files within a directory tree or submodules of a package to From 84a6417f5f008960a67a11733ba37ee4d1d16d9a Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sun, 1 Aug 2021 13:48:06 -0700 Subject: [PATCH 2/2] Update docs/source/command_line.rst --- docs/source/command_line.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index c38e9d49ce35..c4e502b425da 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -58,9 +58,9 @@ for full details, see :ref:`running-mypy`. For instance, to avoid discovering any files named `setup.py` you could pass ``--exclude '/setup\.py$'``. Similarly, you can ignore discovering directories with a given name by e.g. ``--exclude /build/`` or - those matching a subpath with ``--exclude /project/vendor/``. In adition, - to ignore multiple file or directory names, you can combine expressions - with ``|`` and pass e.g ``--exclude '/setup\.py$|/build/'``. + those matching a subpath with ``--exclude /project/vendor/``. To ignore + multiple files / directories / paths, you can combine expressions with + ``|``, e.g ``--exclude '/setup\.py$|/build/'``. Note that this flag only affects recursive discovery, that is, when mypy is discovering files within a directory tree or submodules of a package to