mirror of
https://github.com/ansible/ansible.git
synced 2026-02-03 20:40:24 -05:00
* See changelog fragment for most changes. * Defer early config warnings until display is functioning, eliminating related fallback display logic. * Added more type annotations and docstrings. * ansible-test - pylint sanity for deprecations improved. * Refactored inline legacy resolutions in PluginLoader. Co-authored-by: Matt Clay <matt@mystile.com>
25 lines
679 B
Python
25 lines
679 B
Python
from __future__ import annotations
|
|
|
|
import typing as t
|
|
|
|
from ..common import messages as _messages
|
|
|
|
|
|
class HasPluginInfo(t.Protocol):
|
|
"""Protocol to type-annotate and expose PluginLoader-set values."""
|
|
|
|
@property
|
|
def ansible_name(self) -> str | None:
|
|
"""Fully resolved plugin name."""
|
|
|
|
@property
|
|
def plugin_type(self) -> str:
|
|
"""Plugin type name."""
|
|
|
|
|
|
def get_plugin_info(value: HasPluginInfo) -> _messages.PluginInfo:
|
|
"""Utility method that returns a `PluginInfo` from an object implementing the `HasPluginInfo` protocol."""
|
|
return _messages.PluginInfo(
|
|
resolved_name=value.ansible_name,
|
|
type=value.plugin_type,
|
|
)
|