From 8a1139383004b5cc60f8b8dde6a69f9cc0691005 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Thu, 20 Apr 2023 23:08:43 +0200 Subject: [PATCH] added an proper __dir__ method to _Types metaclass --- plugins/module_utils/generic.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/module_utils/generic.py b/plugins/module_utils/generic.py index 8b43f71..1f8e0f5 100644 --- a/plugins/module_utils/generic.py +++ b/plugins/module_utils/generic.py @@ -71,10 +71,18 @@ class _Type(type): return partial(self._individual[__name], self) raise AttributeError(f"Attribut {__name} not found.") + def __dir__(self): + data = set() + data.update(("__dir__", "__doc__", "__annotations__")) + data.update(self._virtual) + data.update(self._individual.keys()) + return tuple(data) + class Types(metaclass=_Type): """Provides helpers for the ansible types""" + @staticmethod def list( self, elements: Union[Type[object], str],