diff options
| author | Anthony Sottile <asottile@umich.edu> | 2019-05-19 17:01:14 -0700 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2019-05-19 17:31:04 -0700 |
| commit | fb7e9338cd06760a2f9096f976f0e246fc36a09e (patch) | |
| tree | c2a2a2a907d7540eef0dbd633d6cb52cc50da14a /src/flake8/plugins | |
| parent | b6ba6d4d03109965d3cf5174d5c2e6868d7d92bb (diff) | |
| download | flake8-fb7e9338cd06760a2f9096f976f0e246fc36a09e.tar.gz | |
mypy now passes
Diffstat (limited to 'src/flake8/plugins')
| -rw-r--r-- | src/flake8/plugins/manager.py | 21 | ||||
| -rw-r--r-- | src/flake8/plugins/pyflakes.py | 5 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/flake8/plugins/manager.py b/src/flake8/plugins/manager.py index 303c0f9..1554aa2 100644 --- a/src/flake8/plugins/manager.py +++ b/src/flake8/plugins/manager.py @@ -1,17 +1,12 @@ """Plugin loading and management logic and classes.""" import logging -import sys +from typing import Any, Dict, List, Set import entrypoints from flake8 import exceptions from flake8 import utils -if sys.version_info >= (3, 3): - import collections.abc as collections_abc -else: - import collections as collections_abc - LOG = logging.getLogger(__name__) __all__ = ("Checkers", "Plugin", "PluginManager", "ReportFormatters") @@ -37,7 +32,7 @@ class Plugin(object): self.name = name self.entry_point = entry_point self.local = local - self._plugin = None + self._plugin = None # type: Any self._parameters = None self._parameter_names = None self._group = None @@ -236,8 +231,8 @@ class PluginManager(object): # pylint: disable=too-few-public-methods Plugins from config (as "X = path.to:Plugin" strings). """ self.namespace = namespace - self.plugins = {} - self.names = [] + self.plugins = {} # type: Dict[str, Plugin] + self.names = [] # type: List[str] self._load_local_plugins(local_plugins or []) self._load_entrypoint_plugins() @@ -310,7 +305,7 @@ class PluginManager(object): # pylint: disable=too-few-public-methods :rtype: tuple """ - plugins_seen = set() + plugins_seen = set() # type: Set[str] for entry_point_name in self.names: plugin = self.plugins[entry_point_name] plugin_name = plugin.plugin_name @@ -345,7 +340,7 @@ def version_for(plugin): class PluginTypeManager(object): """Parent class for most of the specific plugin types.""" - namespace = None + namespace = None # type: str def __init__(self, local_plugins=None): """Initialize the plugin type's manager. @@ -398,9 +393,7 @@ class PluginTypeManager(object): def _generate_call_function(method_name, optmanager, *args, **kwargs): def generated_function(plugin): # noqa: D105 method = getattr(plugin, method_name, None) - if method is not None and isinstance( - method, collections_abc.Callable - ): + if method is not None and callable(method): return method(optmanager, *args, **kwargs) return generated_function diff --git a/src/flake8/plugins/pyflakes.py b/src/flake8/plugins/pyflakes.py index 2f233c4..9be0c81 100644 --- a/src/flake8/plugins/pyflakes.py +++ b/src/flake8/plugins/pyflakes.py @@ -10,6 +10,7 @@ except ImportError: else: demandimport.disable() import os +from typing import List import pyflakes import pyflakes.checker @@ -59,8 +60,8 @@ class FlakesChecker(pyflakes.checker.Checker): name = "pyflakes" version = pyflakes.__version__ with_doctest = False - include_in_doctest = [] - exclude_from_doctest = [] + include_in_doctest = [] # type: List[str] + exclude_from_doctest = [] # type: List[str] def __init__(self, tree, file_tokens, filename): """Initialize the PyFlakes plugin with an AST tree and filename.""" |
