Skip to content

Commit f909cbf

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 14095c8 commit f909cbf

File tree

2 files changed

+18
-62
lines changed

2 files changed

+18
-62
lines changed

mypy/config_parser.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,12 @@ def parse_config_file(
332332

333333
# Raise an error if there are any remaining empty strings
334334
if "" in files_split:
335-
raise ValueError("Invalid config: Empty filenames are not allowed except for trailing commas.")
335+
raise ValueError(
336+
"Invalid config: Empty filenames are not allowed except for trailing commas."
337+
)
336338

337339
options.files = files_split
338340

339-
340341
prefix = f"{file_read}: [mypy]: "
341342
updates, report_dirs = parse_section(
342343
prefix, options, set_strict_flags, section, config_types, stderr

mypy/test/testconfigparser.py

+15-60
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22
import tempfile
33
from unittest import TestCase, main
4-
from mypy.options import Options
4+
55
from mypy.config_parser import parse_config_file
6+
from mypy.options import Options
7+
68

79
class TestConfigParser(TestCase):
810
def test_parse_config_file_with_single_file(self):
@@ -20,13 +22,7 @@ def test_parse_config_file_with_single_file(self):
2022

2123
options = Options()
2224

23-
parse_config_file(
24-
options,
25-
lambda: None,
26-
config_path,
27-
stdout=None,
28-
stderr=None,
29-
)
25+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
3026

3127
self.assertEqual(options.files, ["file1.py"])
3228

@@ -45,13 +41,7 @@ def test_parse_config_file_with_no_spaces(self):
4541

4642
options = Options()
4743

48-
parse_config_file(
49-
options,
50-
lambda: None,
51-
config_path,
52-
stdout=None,
53-
stderr=None,
54-
)
44+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
5545

5646
self.assertEqual(options.files, ["file1.py", "file2.py", "file3.py"])
5747

@@ -64,19 +54,13 @@ def test_parse_config_file_with_extra_spaces(self):
6454
f.write(
6555
"""
6656
[mypy]
67-
files = file1.py , file2.py , file3.py
57+
files = file1.py , file2.py , file3.py
6858
"""
6959
)
7060

7161
options = Options()
7262

73-
parse_config_file(
74-
options,
75-
lambda: None,
76-
config_path,
77-
stdout=None,
78-
stderr=None,
79-
)
63+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
8064

8165
self.assertEqual(options.files, ["file1.py", "file2.py", "file3.py"])
8266

@@ -89,19 +73,13 @@ def test_parse_config_file_with_empty_files_key(self):
8973
f.write(
9074
"""
9175
[mypy]
92-
files =
76+
files =
9377
"""
9478
)
9579

9680
options = Options()
9781

98-
parse_config_file(
99-
options,
100-
lambda: None,
101-
config_path,
102-
stdout=None,
103-
stderr=None,
104-
)
82+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
10583

10684
self.assertEqual(options.files, [])
10785

@@ -121,13 +99,7 @@ def test_parse_config_file_with_only_comma(self):
12199
options = Options()
122100

123101
with self.assertRaises(ValueError) as cm:
124-
parse_config_file(
125-
options,
126-
lambda: None,
127-
config_path,
128-
stdout=None,
129-
stderr=None,
130-
)
102+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
131103

132104
self.assertIn("Invalid config", str(cm.exception))
133105

@@ -140,19 +112,13 @@ def test_parse_config_file_with_only_whitespace(self):
140112
f.write(
141113
"""
142114
[mypy]
143-
files =
115+
files =
144116
"""
145117
)
146118

147119
options = Options()
148120

149-
parse_config_file(
150-
options,
151-
lambda: None,
152-
config_path,
153-
stdout=None,
154-
stderr=None,
155-
)
121+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
156122

157123
self.assertEqual(options.files, [])
158124

@@ -172,13 +138,7 @@ def test_parse_config_file_with_mixed_valid_and_invalid_entries(self):
172138
options = Options()
173139

174140
with self.assertRaises(ValueError) as cm:
175-
parse_config_file(
176-
options,
177-
lambda: None,
178-
config_path,
179-
stdout=None,
180-
stderr=None,
181-
)
141+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
182142

183143
self.assertIn("Invalid config", str(cm.exception))
184144

@@ -199,15 +159,10 @@ def test_parse_config_file_with_newlines_between_files(self):
199159

200160
options = Options()
201161

202-
parse_config_file(
203-
options,
204-
lambda: None,
205-
config_path,
206-
stdout=None,
207-
stderr=None,
208-
)
162+
parse_config_file(options, lambda: None, config_path, stdout=None, stderr=None)
209163

210164
self.assertEqual(options.files, ["file1.py", "file2.py", "file3.py"])
211165

166+
212167
if __name__ == "__main__":
213168
main()

0 commit comments

Comments
 (0)