Module continuous_delivery_scripts.language_specifics

Language plugins Loader.

Functions

def all_language_plugins() ‑> Dict[str, BaseLanguage]
Expand source code
def all_language_plugins() -> Dict[str, BaseLanguage]:
    """Fetches all language plugins which inherit from BaseLanguage.

    Returns:
        A list of classes containing language plugins
    """
    all_plugins = _retrieve_all_subclasses(BaseLanguage)
    return {la.get_related_language().lower().strip(): la for la in [lang() for lang in all_plugins]}

Fetches all language plugins which inherit from BaseLanguage.

Returns -----= A list of classes containing language plugins

def fetch_project_language_plugin(all_plugins: Dict[str, BaseLanguage],
language: str) ‑> BaseLanguage
Expand source code
def fetch_project_language_plugin(all_plugins: Dict[str, BaseLanguage], language: str) -> BaseLanguage:
    """Fetches a language CD flow.

    Arguments:
        all_plugins: all the plugins at disposal
        language: the language to select

    Returns:
        A language plugin corresponding to the language requested
    """
    return cast(BaseLanguage, all_plugins.get(_sanitise_program_language(language)))

Fetches a language CD flow.

Arguments -----= all_plugins: all the plugins at disposal language: the language to select

Returns -----= A language plugin corresponding to the language requested

def get_language_specifics() ‑> BaseLanguage
Expand source code
def get_language_specifics() -> BaseLanguage:
    """Gets the language specific actions."""
    return PluginLoader().languageSpecifics

Gets the language specific actions.

Classes

class PluginLoader
Expand source code
class PluginLoader:
    """Plugin loader."""

    _instance: Optional[BaseLanguage] = None

    def __init__(self) -> None:
        """Initialiser."""
        if not PluginLoader._instance:
            PluginLoader._instance = _fetch_project_language_specifics()

    @property
    def languageSpecifics(self) -> BaseLanguage:
        """Gets project language specifics."""
        return cast(BaseLanguage, PluginLoader._instance)

Plugin loader.

Initialiser.

Instance variables

prop languageSpecifics : BaseLanguage
Expand source code
@property
def languageSpecifics(self) -> BaseLanguage:
    """Gets project language specifics."""
    return cast(BaseLanguage, PluginLoader._instance)

Gets project language specifics.