mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
98: Completed docstrings in Proxy
This commit is contained in:
parent
9712eae51c
commit
5315514f6c
@ -176,6 +176,13 @@ class Proxy(ReadOnly):
|
|||||||
self.__lock__()
|
self.__lock__()
|
||||||
|
|
||||||
def implements(self, arg):
|
def implements(self, arg):
|
||||||
|
"""
|
||||||
|
Returns True if this proxy implements `arg`. Calls the corresponding
|
||||||
|
classmethod on ProxyTarget.
|
||||||
|
|
||||||
|
Unlike ProxyTarget.implements(), this is not a classmethod as a Proxy
|
||||||
|
only implements anything as an instance.
|
||||||
|
"""
|
||||||
return self.__base.implements(arg)
|
return self.__base.implements(arg)
|
||||||
|
|
||||||
def __clone__(self, name_attr):
|
def __clone__(self, name_attr):
|
||||||
@ -196,8 +203,8 @@ class Proxy(ReadOnly):
|
|||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""
|
"""
|
||||||
If this proxy allowes access to an attribute named `key`, return that
|
If this proxy allows access to an attribute named `key`, return that
|
||||||
attrribute.
|
attribute.
|
||||||
"""
|
"""
|
||||||
if key in self.__public__:
|
if key in self.__public__:
|
||||||
return getattr(self.__target, key)
|
return getattr(self.__target, key)
|
||||||
@ -205,18 +212,25 @@ class Proxy(ReadOnly):
|
|||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
"""
|
"""
|
||||||
If this proxy allowes access to an attribute named `name`, return that
|
If this proxy allows access to an attribute named `name`, return that
|
||||||
attrribute.
|
attribute.
|
||||||
"""
|
"""
|
||||||
if name in self.__public__:
|
if name in self.__public__:
|
||||||
return getattr(self.__target, name)
|
return getattr(self.__target, name)
|
||||||
raise AttributeError('no proxy attribute %r' % name)
|
raise AttributeError('no proxy attribute %r' % name)
|
||||||
|
|
||||||
def __call__(self, *args, **kw):
|
def __call__(self, *args, **kw):
|
||||||
|
"""
|
||||||
|
Attempts to call target.__call__(); raises KeyError if `__call__` is
|
||||||
|
not an attribute this proxy allows access to.
|
||||||
|
"""
|
||||||
return self['__call__'](*args, **kw)
|
return self['__call__'](*args, **kw)
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
"""
|
||||||
|
Returns a Python expression that could be used to construct this Proxy
|
||||||
|
instance given the appropriate environment.
|
||||||
|
"""
|
||||||
return '%s(%s, %r, %r)' % (
|
return '%s(%s, %r, %r)' % (
|
||||||
self.__class__.__name__,
|
self.__class__.__name__,
|
||||||
self.__base.__name__,
|
self.__base.__name__,
|
||||||
|
Loading…
Reference in New Issue
Block a user