Skip to content

Commit 439389b

Browse files
committed
Revert to treating exclude in .ini as single string
Modifies existing unit tests. Fixes python#11830.
1 parent f96446c commit 439389b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

docs/source/config_file.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,19 @@ section of the command line docs.
197197

198198
.. confval:: exclude
199199

200-
:type: newline separated list of regular expressions
200+
:type: regular expressions
201201

202-
A newline list of regular expression that matches file names, directory names and paths
202+
A regular expression that matches file names, directory names and paths
203203
which mypy should ignore while recursively discovering files to check.
204204
Use forward slashes on all platforms.
205205

206206
.. code-block:: ini
207207
208208
[mypy]
209-
exclude =
209+
exclude = (?x)(
210210
^file1\.py$
211-
^file2\.py$
211+
|^file2\.py$
212+
)
212213
213214
For more details, see :option:`--exclude <mypy --exclude>`.
214215

mypy/config_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def check_follow_imports(choice: str) -> str:
126126
'cache_dir': expand_path,
127127
'python_executable': expand_path,
128128
'strict': bool,
129-
'exclude': lambda s: [p.strip() for p in s.split('\n') if p.strip()],
129+
'exclude': lambda s: [s.strip()],
130130
}
131131

132132
# Reuse the ini_config_types and overwrite the diff

test-data/unit/cmdline.test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,10 @@ b/bpkg.py:1: error: "int" not callable
13541354
# cmd: mypy .
13551355
[file mypy.ini]
13561356
\[mypy]
1357-
exclude =
1358-
abc
1359-
b
1357+
exclude = (?x)(
1358+
^abc/
1359+
|^b/
1360+
)
13601361
[file abc/apkg.py]
13611362
1()
13621363
[file b/bpkg.py]

0 commit comments

Comments
 (0)