1
0
Fork 0

added an proper __dir__ method to _Types metaclass

Dieser Commit ist enthalten in:
Sebastian Tobie 2023-04-20 23:08:43 +02:00
Ursprung ac2fbcd29a
Commit 8a11393830
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -71,10 +71,18 @@ class _Type(type):
return partial(self._individual[__name], self) return partial(self._individual[__name], self)
raise AttributeError(f"Attribut {__name} not found.") 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): class Types(metaclass=_Type):
"""Provides helpers for the ansible types""" """Provides helpers for the ansible types"""
@staticmethod
def list( def list(
self, self,
elements: Union[Type[object], str], elements: Union[Type[object], str],