diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-02-02 16:53:24 -0600 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-02-02 16:53:24 -0600 |
| commit | 0645ec3ef771c8e2e6ef39bdd5eb360067d147b9 (patch) | |
| tree | 2c63c48e47bdaa5429d8028b4671557dea895300 /flake8/plugins/manager.py | |
| parent | 91327c75e0da54fb7f4479499009fb6946f59820 (diff) | |
| download | flake8-0645ec3ef771c8e2e6ef39bdd5eb360067d147b9.tar.gz | |
Move __contains__ and __getitem__ to proper class
Diffstat (limited to 'flake8/plugins/manager.py')
| -rw-r--r-- | flake8/plugins/manager.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/flake8/plugins/manager.py b/flake8/plugins/manager.py index 4a06c75..02a136c 100644 --- a/flake8/plugins/manager.py +++ b/flake8/plugins/manager.py @@ -152,16 +152,6 @@ class PluginManager(object): self.names = [] self._load_all_plugins() - def __contains__(self, name): - """Check if the entry-point name is in this plugin manager.""" - LOG.debug('Checking for "%s" in plugin manager.', name) - return name in self.plugins - - def __getitem__(self, name): - """Retrieve a plugin by its entry-point name.""" - LOG.debug('Retrieving plugin for "%s".', name) - return self.plugins[name] - def _load_all_plugins(self): LOG.debug('Loading entry-points for "%s".', self.namespace) for entry_point in pkg_resources.iter_entry_points(self.namespace): @@ -203,6 +193,16 @@ class PluginTypeManager(object): self.manager = PluginManager(self.namespace) self.plugins_loaded = False + def __contains__(self, name): + """Check if the entry-point name is in this plugin type manager.""" + LOG.debug('Checking for "%s" in plugin type manager.', name) + return name in self.plugins + + def __getitem__(self, name): + """Retrieve a plugin by its name.""" + LOG.debug('Retrieving plugin for "%s".', name) + return self.plugins[name] + @property def names(self): """Proxy attribute to underlying manager.""" |
