]> crepu.dev Git - config.git/blame_incremental - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/flake8/exceptions.py
Configuracion en desarrollo PC pega
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / flake8 / exceptions.py
... / ...
CommitLineData
1"""Exception classes for all of Flake8."""
2from __future__ import annotations
3
4
5class Flake8Exception(Exception):
6 """Plain Flake8 exception."""
7
8
9class EarlyQuit(Flake8Exception):
10 """Except raised when encountering a KeyboardInterrupt."""
11
12
13class ExecutionError(Flake8Exception):
14 """Exception raised during execution of Flake8."""
15
16
17class FailedToLoadPlugin(Flake8Exception):
18 """Exception raised when a plugin fails to load."""
19
20 FORMAT = 'Flake8 failed to load plugin "%(name)s" due to %(exc)s.'
21
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)
27
28 def __str__(self) -> str:
29 """Format our exception message."""
30 return self.FORMAT % {
31 "name": self.plugin_name,
32 "exc": self.original_exception,
33 }
34
35
36class PluginRequestedUnknownParameters(Flake8Exception):
37 """The plugin requested unknown parameters."""
38
39 FORMAT = '"%(name)s" requested unknown parameters causing %(exc)s'
40
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)
46
47 def __str__(self) -> str:
48 """Format our exception message."""
49 return self.FORMAT % {
50 "name": self.plugin_name,
51 "exc": self.original_exception,
52 }
53
54
55class PluginExecutionFailed(Flake8Exception):
56 """The plugin failed during execution."""
57
58 FORMAT = '{fname}: "{plugin}" failed during execution due to {exc!r}'
59
60 def __init__(
61 self,
62 filename: str,
63 plugin_name: str,
64 exception: Exception,
65 ) -> None:
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)
71
72 def __str__(self) -> str:
73 """Format our exception message."""
74 return self.FORMAT.format(
75 fname=self.filename,
76 plugin=self.plugin_name,
77 exc=self.original_exception,
78 )