Skip to content

Commit

Permalink
Type Annotations: core.plugin
Browse files Browse the repository at this point in the history
    - Resolves Issue #707
    - Related to PR #628
  • Loading branch information
derks committed Jul 13, 2024
1 parent 52e9ee2 commit 3de886d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 9 additions & 7 deletions cement/core/plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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``.
Expand All @@ -34,7 +35,7 @@ def load_plugin(plugin_name):
pass # pragma: nocover

@abstractmethod
def load_plugins(self, plugins):
def load_plugins(self, plugins: List[str]) -> None:
"""
Load all plugins from ``plugins``.
Expand All @@ -45,17 +46,17 @@ def load_plugins(self, plugins):
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

Expand All @@ -67,4 +68,5 @@ class PluginHandler(PluginInterface, Handler):
"""

pass # pragma: nocover
class Meta(Handler.Meta):
pass # pragma: nocover

0 comments on commit 3de886d

Please sign in to comment.