mirror of
https://github.com/datafolklabs/cement.git
synced 2026-02-06 13:42:03 +00:00
Type Annotations: core.plugin
- Resolves Issue #707 - Related to PR #628
This commit is contained in:
parent
52e9ee20f9
commit
3de886dc62
@ -41,6 +41,7 @@ Refactoring:
|
||||
- `[core.mail]` [Issue #704](https://github.com/datafolklabs/cement/issues/704)
|
||||
- `[core.meta]` [Issue #705](https://github.com/datafolklabs/cement/issues/705)
|
||||
- `[core.output]` [Issue #706](https://github.com/datafolklabs/cement/issues/706)
|
||||
- `[core.plugin]` [Issue #707](https://github.com/datafolklabs/cement/issues/707)
|
||||
- `[utils.fs]` [Issue #688](https://github.com/datafolklabs/cement/issues/688)
|
||||
- `[utils.misc]` [Issue #689](https://github.com/datafolklabs/cement/issues/689)
|
||||
- `[utils.shell]` [Issue #690](https://github.com/datafolklabs/cement/issues/690)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
"""Cement core plugins module."""
|
||||
|
||||
from abc import abstractmethod
|
||||
from typing import List
|
||||
from ..core.interface import Interface
|
||||
from ..core.handler import Handler
|
||||
from ..utils.misc import minimal_logger
|
||||
@ -17,13 +18,13 @@ class PluginInterface(Interface):
|
||||
:class:`PluginHandler` base class as a starting point.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
class Meta(Interface.Meta):
|
||||
|
||||
#: String identifier of the interface.
|
||||
interface = 'plugin'
|
||||
|
||||
@abstractmethod
|
||||
def load_plugin(plugin_name):
|
||||
def load_plugin(self, plugin_name: str) -> None:
|
||||
"""
|
||||
Load a plugin whose name is ``plugin_name``.
|
||||
|
||||
@ -34,7 +35,7 @@ class PluginInterface(Interface):
|
||||
pass # pragma: nocover
|
||||
|
||||
@abstractmethod
|
||||
def load_plugins(self, plugins):
|
||||
def load_plugins(self, plugins: List[str]) -> None:
|
||||
"""
|
||||
Load all plugins from ``plugins``.
|
||||
|
||||
@ -45,17 +46,17 @@ class PluginInterface(Interface):
|
||||
pass # pragma: nocover
|
||||
|
||||
@abstractmethod
|
||||
def get_loaded_plugins(self):
|
||||
def get_loaded_plugins(self) -> List[str]:
|
||||
"""Returns a list of plugins that have been loaded."""
|
||||
pass # pragma: nocover
|
||||
|
||||
@abstractmethod
|
||||
def get_enabled_plugins(self):
|
||||
def get_enabled_plugins(self) -> List[str]:
|
||||
"""Returns a list of plugins that are enabled in the config."""
|
||||
pass # pragma: nocover
|
||||
|
||||
@abstractmethod
|
||||
def get_disabled_plugins(self):
|
||||
def get_disabled_plugins(self) -> List[str]:
|
||||
"""Returns a list of plugins that are disabled in the config."""
|
||||
pass # pragma: nocover
|
||||
|
||||
@ -67,4 +68,5 @@ class PluginHandler(PluginInterface, Handler):
|
||||
|
||||
"""
|
||||
|
||||
pass # pragma: nocover
|
||||
class Meta(Handler.Meta):
|
||||
pass # pragma: nocover
|
||||
|
||||
Loading…
Reference in New Issue
Block a user