32
32
# When adding to this file, alphabetization is important. Look for
33
33
# "alphabetize" comments throughout.
34
34
35
+
36
+ def oneline (text : str ) -> str :
37
+ """Turn a multi-line string into one line for help to reformat nicely."""
38
+ return " " .join (text .split ())
39
+
40
+
35
41
class Opts :
36
42
"""A namespace class for individual options we'll build parsers from."""
37
43
@@ -48,9 +54,11 @@ class Opts:
48
54
)
49
55
concurrency = optparse .make_option (
50
56
"" , "--concurrency" , action = "store" , metavar = "LIBS" ,
51
- help = (
52
- "Properly measure code using a concurrency library. " +
53
- "Valid values are: {}, or a comma-list of them."
57
+ help = oneline (
58
+ """
59
+ Properly measure code using a concurrency library.
60
+ Valid values are: {}, or a comma-list of them.
61
+ """
54
62
).format (", " .join (sorted (CoverageConfig .CONCURRENCY_CHOICES ))),
55
63
)
56
64
context = optparse .make_option (
@@ -59,30 +67,38 @@ class Opts:
59
67
)
60
68
contexts = optparse .make_option (
61
69
"" , "--contexts" , action = "store" , metavar = "REGEX1,REGEX2,..." ,
62
- help = (
63
- "Only display data from lines covered in the given contexts. " +
64
- "Accepts Python regexes, which must be quoted."
70
+ help = oneline (
71
+ """
72
+ Only display data from lines covered in the given contexts.
73
+ Accepts Python regexes, which must be quoted.
74
+ """
65
75
),
66
76
)
67
77
datafile = optparse .make_option (
68
78
"" , "--data-file" , action = "store" , metavar = "DATAFILE" ,
69
- help = (
70
- "Base name of the data files to operate on. " +
71
- "Defaults to '.coverage'. [env: COVERAGE_FILE]"
79
+ help = oneline (
80
+ """
81
+ Base name of the data files to operate on.
82
+ Defaults to '.coverage'. [env: COVERAGE_FILE]
83
+ """
72
84
),
73
85
)
74
86
datafle_input = optparse .make_option (
75
87
"" , "--data-file" , action = "store" , metavar = "INFILE" ,
76
- help = (
77
- "Read coverage data for report generation from this file. " +
78
- "Defaults to '.coverage'. [env: COVERAGE_FILE]"
88
+ help = oneline (
89
+ """
90
+ Read coverage data for report generation from this file.
91
+ Defaults to '.coverage'. [env: COVERAGE_FILE]
92
+ """
79
93
),
80
94
)
81
95
datafile_output = optparse .make_option (
82
96
"" , "--data-file" , action = "store" , metavar = "OUTFILE" ,
83
- help = (
84
- "Write the recorded coverage data to this file. " +
85
- "Defaults to '.coverage'. [env: COVERAGE_FILE]"
97
+ help = oneline (
98
+ """
99
+ Write the recorded coverage data to this file.
100
+ Defaults to '.coverage'. [env: COVERAGE_FILE]
101
+ """
86
102
),
87
103
)
88
104
debug = optparse .make_option (
@@ -111,9 +127,11 @@ class Opts:
111
127
)
112
128
include = optparse .make_option (
113
129
"" , "--include" , action = "store" , metavar = "PAT1,PAT2,..." ,
114
- help = (
115
- "Include only files whose paths match one of these patterns. " +
116
- "Accepts shell-style wildcards, which must be quoted."
130
+ help = oneline (
131
+ """
132
+ Include only files whose paths match one of these patterns.
133
+ Accepts shell-style wildcards, which must be quoted.
134
+ """
117
135
),
118
136
)
119
137
keep = optparse .make_option (
@@ -122,9 +140,11 @@ class Opts:
122
140
)
123
141
pylib = optparse .make_option (
124
142
"-L" , "--pylib" , action = "store_true" ,
125
- help = (
126
- "Measure coverage even inside the Python installed library, " +
127
- "which isn't done by default."
143
+ help = oneline (
144
+ """
145
+ Measure coverage even inside the Python installed library,
146
+ which isn't done by default.
147
+ """
128
148
),
129
149
)
130
150
show_missing = optparse .make_option (
@@ -133,16 +153,20 @@ class Opts:
133
153
)
134
154
module = optparse .make_option (
135
155
"-m" , "--module" , action = "store_true" ,
136
- help = (
137
- "<pyfile> is an importable Python module, not a script path, " +
138
- "to be run as 'python -m' would run it."
156
+ help = oneline (
157
+ """
158
+ <pyfile> is an importable Python module, not a script path,
159
+ to be run as 'python -m' would run it.
160
+ """
139
161
),
140
162
)
141
163
omit = optparse .make_option (
142
164
"" , "--omit" , action = "store" , metavar = "PAT1,PAT2,..." ,
143
- help = (
144
- "Omit files whose paths match one of these patterns. " +
145
- "Accepts shell-style wildcards, which must be quoted."
165
+ help = oneline (
166
+ """
167
+ Omit files whose paths match one of these patterns.
168
+ Accepts shell-style wildcards, which must be quoted.
169
+ """
146
170
),
147
171
)
148
172
output_xml = optparse .make_option (
@@ -163,16 +187,20 @@ class Opts:
163
187
)
164
188
parallel_mode = optparse .make_option (
165
189
"-p" , "--parallel-mode" , action = "store_true" ,
166
- help = (
167
- "Append a unique suffix to the data file name to collect separate " +
168
- "data from multiple processes."
190
+ help = oneline (
191
+ """
192
+ Append a unique suffix to the data file name to collect separate
193
+ data from multiple processes.
194
+ """
169
195
),
170
196
)
171
197
precision = optparse .make_option (
172
198
"" , "--precision" , action = "store" , metavar = "N" , type = int ,
173
- help = (
174
- "Number of digits after the decimal point to display for " +
175
- "reported coverage percentages."
199
+ help = oneline (
200
+ """
201
+ Number of digits after the decimal point to display for
202
+ reported coverage percentages.
203
+ """
176
204
),
177
205
)
178
206
quiet = optparse .make_option (
@@ -181,18 +209,22 @@ class Opts:
181
209
)
182
210
rcfile = optparse .make_option (
183
211
"" , "--rcfile" , action = "store" ,
184
- help = (
185
- "Specify configuration file. " +
186
- "By default '.coveragerc', 'setup.cfg', 'tox.ini', and " +
187
- "'pyproject.toml' are tried. [env: COVERAGE_RCFILE]"
212
+ help = oneline (
213
+ """
214
+ Specify configuration file.
215
+ By default '.coveragerc', 'setup.cfg', 'tox.ini', and
216
+ 'pyproject.toml' are tried. [env: COVERAGE_RCFILE]
217
+ """
188
218
),
189
219
)
190
220
save_signal = optparse .make_option (
191
221
"" , "--save-signal" , action = "store" , metavar = "SIGNAL" ,
192
222
choices = ["USR1" , "USR2" ],
193
- help = (
194
- "Specify a signal that will trigger coverage to write its collected data. " +
195
- "Supported values are: USR1, USR2. Not available on Windows."
223
+ help = oneline (
224
+ """
225
+ Specify a signal that will trigger coverage to write its collected data.
226
+ Supported values are: USR1, USR2. Not available on Windows.
227
+ """
196
228
),
197
229
)
198
230
show_contexts = optparse .make_option (
@@ -213,9 +245,11 @@ class Opts:
213
245
)
214
246
sort = optparse .make_option (
215
247
"--sort" , action = "store" , metavar = "COLUMN" ,
216
- help = (
217
- "Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. " +
218
- "Default is name."
248
+ help = oneline (
249
+ """
250
+ Sort the report by the named column: name, stmts, miss, branch, brpart, or cover.
251
+ Default is name.
252
+ """
219
253
),
220
254
)
221
255
source = optparse .make_option (
@@ -383,9 +417,11 @@ def get_prog_name(self) -> str:
383
417
Opts .omit ,
384
418
] + GLOBAL_ARGS ,
385
419
usage = "[options] [modules]" ,
386
- description = (
387
- "Make annotated copies of the given files, marking statements that are executed " +
388
- "with > and statements that are missed with !."
420
+ description = oneline (
421
+ """
422
+ Make annotated copies of the given files, marking statements that are executed
423
+ with > and statements that are missed with !.
424
+ """
389
425
),
390
426
),
391
427
@@ -398,28 +434,31 @@ def get_prog_name(self) -> str:
398
434
Opts .quiet ,
399
435
] + GLOBAL_ARGS ,
400
436
usage = "[options] <path1> <path2> ... <pathN>" ,
401
- description = (
402
- "Combine data from multiple coverage files. " +
403
- "The combined results are written to a single " +
404
- "file representing the union of the data. The positional " +
405
- "arguments are data files or directories containing data files. " +
406
- "If no paths are provided, data files in the default data file's " +
407
- "directory are combined."
437
+ description = oneline (
438
+ """
439
+ Combine data from multiple coverage files.
440
+ The combined results are written to a single
441
+ file representing the union of the data. The positional
442
+ arguments are data files or directories containing data files.
443
+ If no paths are provided, data files in the default data file's
444
+ directory are combined.
445
+ """
408
446
),
409
447
),
410
-
411
448
"debug" : CmdOptionParser (
412
449
"debug" , GLOBAL_ARGS ,
413
450
usage = "<topic>" ,
414
- description = (
415
- "Display information about the internals of coverage.py, " +
416
- "for diagnosing problems. " +
417
- "Topics are: " +
418
- "'data' to show a summary of the collected data; " +
419
- "'sys' to show installation information; " +
420
- "'config' to show the configuration; " +
421
- "'premain' to show what is calling coverage; " +
422
- "'pybehave' to show internal flags describing Python behavior."
451
+ description = oneline (
452
+ """
453
+ Display information about the internals of coverage.py,
454
+ for diagnosing problems.
455
+ Topics are:
456
+ 'data' to show a summary of the collected data;
457
+ 'sys' to show installation information;
458
+ 'config' to show the configuration;
459
+ 'premain' to show what is calling coverage;
460
+ 'pybehave' to show internal flags describing Python behavior.
461
+ """
423
462
),
424
463
),
425
464
@@ -456,10 +495,12 @@ def get_prog_name(self) -> str:
456
495
Opts .title ,
457
496
] + GLOBAL_ARGS ,
458
497
usage = "[options] [modules]" ,
459
- description = (
460
- "Create an HTML report of the coverage of the files. " +
461
- "Each file gets its own page, with the source decorated to show " +
462
- "executed, excluded, and missed lines."
498
+ description = oneline (
499
+ """
500
+ Create an HTML report of the coverage of the files.
501
+ Each file gets its own page, with the source decorated to show
502
+ executed, excluded, and missed lines.
503
+ """
463
504
),
464
505
),
465
506
@@ -968,10 +1009,11 @@ def unglob_args(args: list[str]) -> list[str]:
968
1009
969
1010
Use "{program_name} help <command>" for detailed help on any command.
970
1011
""" ,
971
-
972
- "minimum_help" : (
973
- "Code coverage for Python, version {__version__} {extension_modifier}. " +
974
- "Use '{program_name} help' for help."
1012
+ "minimum_help" : oneline (
1013
+ """
1014
+ Code coverage for Python, version {__version__} {extension_modifier}.
1015
+ Use '{program_name} help' for help.
1016
+ """
975
1017
),
976
1018
977
1019
"version" : "Coverage.py, version {__version__} {extension_modifier}" ,
0 commit comments