improved the acess for special attributes
Dieser Commit ist enthalten in:
Ursprung
c957e2ddcb
Commit
38beda7ab4
|
@ -30,9 +30,11 @@ class _Type(type):
|
|||
if key.startswith("_"):
|
||||
if key == "__getattr__":
|
||||
virtfunc = value
|
||||
special[key] = value
|
||||
elif key == "__dir__":
|
||||
virtual = tuple(value(None))
|
||||
elif key in ("__doc__",):
|
||||
special[key] = value
|
||||
elif key in ("__doc__", "__module__", "__qualname__"):
|
||||
special[key] = value
|
||||
else:
|
||||
individual[key] = value
|
||||
|
@ -67,7 +69,7 @@ class _Type(type):
|
|||
return self._vfunc(self, __name)
|
||||
if __name in self._individual:
|
||||
return partial(self._individual[__name], self)
|
||||
raise AttributeError(f"Attribut {__name} not found.")
|
||||
return super().__getattribute__(__name)
|
||||
|
||||
def __dir__(self):
|
||||
data = set()
|
||||
|
@ -115,6 +117,7 @@ class Types(metaclass=_Type):
|
|||
choices: Optional[Sequence] = None,
|
||||
default: Optional[Any] = None,
|
||||
):
|
||||
"""Simple wrapper for Ansible {0} argument dict"""
|
||||
output = _sdict(type=name, required=required)
|
||||
if choices is not None:
|
||||
output["choices"] = choices
|
||||
|
@ -124,4 +127,5 @@ class Types(metaclass=_Type):
|
|||
return output
|
||||
|
||||
argument.__name__ = name
|
||||
argument.__doc__ = argument.__doc__.format(name)
|
||||
return argument
|
||||
|
|
Laden…
In neuem Issue referenzieren