diff options
| author | Anthony Sottile <asottile@umich.edu> | 2019-11-28 17:30:52 -0800 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2019-11-28 17:30:52 -0800 |
| commit | d3c95f00d0ac14adcceb423173ff7106aa42d116 (patch) | |
| tree | b38f7fe434ac2adffaf171a92b0c13082af0f0d9 /src/flake8/exceptions.py | |
| parent | 15de413f9e04a9fe360d6a22a66ba163d21a7cf4 (diff) | |
| download | flake8-d3c95f00d0ac14adcceb423173ff7106aa42d116.tar.gz | |
Switch from entrypoints to importlib_metadata
Diffstat (limited to 'src/flake8/exceptions.py')
| -rw-r--r-- | src/flake8/exceptions.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/flake8/exceptions.py b/src/flake8/exceptions.py index 53ca4b7..bef6f4b 100644 --- a/src/flake8/exceptions.py +++ b/src/flake8/exceptions.py @@ -1,10 +1,6 @@ """Exception classes for all of Flake8.""" - from typing import Dict -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 - from flake8.plugins.manager import Plugin - class Flake8Exception(Exception): """Plain Flake8 exception.""" @@ -23,18 +19,17 @@ class FailedToLoadPlugin(Flake8Exception): FORMAT = 'Flake8 failed to load plugin "%(name)s" due to %(exc)s.' - def __init__(self, plugin, exception): - # type: (Plugin, Exception) -> None + def __init__(self, plugin_name, exception): + # type: (str, Exception) -> None """Initialize our FailedToLoadPlugin exception.""" - self.plugin = plugin - self.ep_name = self.plugin.name + self.plugin_name = plugin_name self.original_exception = exception - super(FailedToLoadPlugin, self).__init__(plugin, exception) + super(FailedToLoadPlugin, self).__init__(plugin_name, exception) def __str__(self): # type: () -> str """Format our exception message.""" return self.FORMAT % { - "name": self.ep_name, + "name": self.plugin_name, "exc": self.original_exception, } |
