|
11 | 11 | def _message_append_combine_hint(message: str, is_combining: bool) -> str:
|
12 | 12 | """Append information about the combine command to error messages."""
|
13 | 13 | if not is_combining:
|
14 |
| - message += " Perhaps `coverage combine` must be run first." |
| 14 | + message += " Perhaps 'coverage combine' must be run first." |
15 | 15 | return message
|
16 | 16 |
|
17 | 17 |
|
@@ -43,48 +43,48 @@ class NoDataError(CoverageException):
|
43 | 43 | class DataFileOrDirectoryNotFoundError(NoDataError):
|
44 | 44 | """A data file or data directory could be found."""
|
45 | 45 | @classmethod
|
46 |
| - def new_for_data_file_or_directory( |
| 46 | + def new( |
47 | 47 | cls, data_file_or_directory_path: str, *, is_combining: bool = False
|
48 |
| - ) -> 'DataFileOrDirectoryNotFoundError': |
| 48 | + ) -> DataFileOrDirectoryNotFoundError: |
49 | 49 | """
|
50 | 50 | Create a new instance.
|
51 | 51 | """
|
52 | 52 | message = (
|
53 |
| - f"The data file or directory `{os.path.abspath(data_file_or_directory_path)}` could not" |
54 |
| - " be found." |
| 53 | + f"The data file or directory '{os.path.abspath(data_file_or_directory_path)}' could not" |
| 54 | + + " be found." |
55 | 55 | )
|
56 | 56 | return cls(_message_append_combine_hint(message, is_combining))
|
57 | 57 |
|
58 | 58 |
|
59 | 59 | class NoDataFilesFoundError(NoDataError):
|
60 | 60 | """No data files could be found in a data directory."""
|
61 | 61 | @classmethod
|
62 |
| - def new_for_data_directory( |
| 62 | + def new( |
63 | 63 | cls, data_directory_path: str, *, is_combining: bool = False
|
64 | 64 | ) -> 'NoDataFilesFoundError':
|
65 | 65 | """
|
66 | 66 | Create a new instance.
|
67 | 67 | """
|
68 | 68 | message = (
|
69 |
| - f"The data directory `{os.path.abspath(data_directory_path)}` does not contain any data" |
70 |
| - " files." |
| 69 | + f"The data directory '{os.path.abspath(data_directory_path)}' does not contain any data" |
| 70 | + + " files." |
71 | 71 | )
|
72 | 72 | return cls(_message_append_combine_hint(message, is_combining))
|
73 | 73 |
|
74 | 74 |
|
75 | 75 | class UnusableDataFilesError(NoDataError):
|
76 | 76 | """The given data files are unusable."""
|
77 | 77 | @classmethod
|
78 |
| - def new_for_data_files(cls, *data_file_paths: str) -> 'UnusableDataFilesError': |
| 78 | + def new(cls, *data_file_paths: str) -> 'UnusableDataFilesError': |
79 | 79 | """
|
80 | 80 | Create a new instance.
|
81 | 81 | """
|
82 | 82 | message = (
|
83 | 83 | "The following data files are unusable, perhaps because they do not contain valid"
|
84 |
| - " coverage information:" |
| 84 | + + " coverage information:" |
85 | 85 | )
|
86 | 86 | for data_file_path in data_file_paths:
|
87 |
| - message += f"\n- `{os.path.abspath(data_file_path)}`" |
| 87 | + message += f"\n- '{os.path.abspath(data_file_path)}'" |
88 | 88 |
|
89 | 89 | return cls(message)
|
90 | 90 |
|
|
0 commit comments