]>
crepu.dev Git - config.git/blob - djavu-asus/emacs/elpy/rpc-venv/lib/python3.11/site-packages/flake8/exceptions.py
1 """Exception classes for all of Flake8."""
2 from __future__
import annotations
5 class Flake8Exception(Exception):
6 """Plain Flake8 exception."""
9 class EarlyQuit(Flake8Exception
):
10 """Except raised when encountering a KeyboardInterrupt."""
13 class ExecutionError(Flake8Exception
):
14 """Exception raised during execution of Flake8."""
17 class FailedToLoadPlugin(Flake8Exception
):
18 """Exception raised when a plugin fails to load."""
20 FORMAT
= 'Flake8 failed to load plugin "%(name)s" due to %(exc)s.'
22 def __init__(self
, plugin_name
: str, exception
: Exception) -> None:
23 """Initialize our FailedToLoadPlugin exception."""
24 self
.plugin_name
= plugin_name
25 self
.original_exception
= exception
26 super().__init
__(plugin_name
, exception
)
28 def __str__(self
) -> str:
29 """Format our exception message."""
30 return self
.FORMAT
% {
31 "name": self
.plugin_name
,
32 "exc": self
.original_exception
,
36 class PluginRequestedUnknownParameters(Flake8Exception
):
37 """The plugin requested unknown parameters."""
39 FORMAT
= '"%(name)s" requested unknown parameters causing %(exc)s'
41 def __init__(self
, plugin_name
: str, exception
: Exception) -> None:
42 """Pop certain keyword arguments for initialization."""
43 self
.plugin_name
= plugin_name
44 self
.original_exception
= exception
45 super().__init
__(plugin_name
, exception
)
47 def __str__(self
) -> str:
48 """Format our exception message."""
49 return self
.FORMAT
% {
50 "name": self
.plugin_name
,
51 "exc": self
.original_exception
,
55 class PluginExecutionFailed(Flake8Exception
):
56 """The plugin failed during execution."""
58 FORMAT
= '{fname}: "{plugin}" failed during execution due to {exc!r}'
66 """Utilize keyword arguments for message generation."""
67 self
.filename
= filename
68 self
.plugin_name
= plugin_name
69 self
.original_exception
= exception
70 super().__init
__(filename
, plugin_name
, exception
)
72 def __str__(self
) -> str:
73 """Format our exception message."""
74 return self
.FORMAT
.format(
76 plugin
=self
.plugin_name
,
77 exc
=self
.original_exception
,