175: Renamed Proxy to PluginProxy

This commit is contained in:
Jason Gerard DeRose 2008-08-15 03:32:38 +00:00
parent ec0596b429
commit 233293fb4a
4 changed files with 16 additions and 16 deletions

View File

@ -351,7 +351,7 @@ class Plugin(ReadOnly):
)
class Proxy(ReadOnly):
class PluginProxy(ReadOnly):
"""
Allows access to only certain attributes on a `Plugin`.
@ -692,7 +692,7 @@ class API(DictProxy):
if klass not in instances:
instances[klass] = klass()
plugin = instances[klass]
yield Proxy(base, plugin)
yield PluginProxy(base, plugin)
for (base, classes) in self.register:
namespace = NameSpace(plugin_iter(base, classes))

View File

@ -160,7 +160,7 @@ class cmd(plugable.Plugin):
assert inspect.isclass(cls)
o = cls()
o.__lock__()
yield plugable.Proxy(option, o)
yield plugable.PluginProxy(option, o)
def __get_options(self):
"""

View File

@ -412,9 +412,9 @@ class test_Plugin(ClassChecker):
class test_Proxy(ClassChecker):
"""
Tests the `plugable.Proxy` class.
Tests the `plugable.PluginProxy` class.
"""
_cls = plugable.Proxy
_cls = plugable.PluginProxy
def test_class(self):
assert self.cls.__bases__ == (plugable.ReadOnly,)
@ -484,7 +484,7 @@ class test_Proxy(ClassChecker):
def test_implements(self):
"""
Tests the `plugable.Proxy.implements` method.
Tests the `plugable.PluginProxy.implements` method.
"""
class base(object):
__public__ = frozenset()
@ -509,7 +509,7 @@ class test_Proxy(ClassChecker):
def test_clone(self):
"""
Tests the `plugable.Proxy.__clone__` method.
Tests the `plugable.PluginProxy.__clone__` method.
"""
class base(object):
__public__ = frozenset()
@ -581,7 +581,7 @@ class test_NameSpace(ClassChecker):
def get_proxies(n):
for i in xrange(n):
yield plugable.Proxy(base, plugin(get_name(i)))
yield plugable.PluginProxy(base, plugin(get_name(i)))
cnt = 10
ns = self.cls(get_proxies(cnt))
@ -600,7 +600,7 @@ class test_NameSpace(ClassChecker):
# Test __call__
i = None
for (i, proxy) in enumerate(ns()):
assert type(proxy) is plugable.Proxy
assert type(proxy) is plugable.PluginProxy
assert proxy.name == get_name(i)
assert i == cnt - 1
@ -611,7 +611,7 @@ class test_NameSpace(ClassChecker):
assert name in ns
proxy = ns[name]
assert proxy.name == name
assert type(proxy) is plugable.Proxy
assert type(proxy) is plugable.PluginProxy
assert proxy in proxies
assert read_only(ns, name) is proxy
@ -802,7 +802,7 @@ def test_API():
for p in xrange(3):
plugin_name = get_plugin(b, p)
proxy = ns[plugin_name]
assert isinstance(proxy, plugable.Proxy)
assert isinstance(proxy, plugable.PluginProxy)
assert proxy.name == plugin_name
assert read_only(ns, plugin_name) is proxy
assert read_only(proxy, 'method')(7) == 7 + b

View File

@ -193,7 +193,7 @@ class test_cmd(ClassChecker):
assert list(self.cls().get_options()) == []
sub = self.subcls()
for (i, proxy) in enumerate(sub.get_options()):
assert isinstance(proxy, plugable.Proxy)
assert isinstance(proxy, plugable.PluginProxy)
assert read_only(proxy, 'name') == 'option%d' % i
assert proxy.implements(public.option)
assert i == 1
@ -211,7 +211,7 @@ class test_cmd(ClassChecker):
assert name in options
proxy = options[name]
assert getattr(options, name) is proxy
assert isinstance(proxy, plugable.Proxy)
assert isinstance(proxy, plugable.PluginProxy)
assert proxy.name == name
def test_normalize(self):
@ -339,8 +339,8 @@ class test_mthd(ClassChecker):
def __get_prop(self):
if self.__prop is None:
self.__prop = (
plugable.Proxy(public.prop, example_prop0(), 'attr_name'),
plugable.Proxy(public.prop, example_prop1(), 'attr_name'),
plugable.PluginProxy(public.prop, example_prop0(), 'attr_name'),
plugable.PluginProxy(public.prop, example_prop1(), 'attr_name'),
)
return self.__prop
prop = property(__get_prop)
@ -359,7 +359,7 @@ class test_mthd(ClassChecker):
assert len(proxies) == 4
for (i, proxy) in enumerate(proxies):
assert proxy.name == names[i]
assert isinstance(proxy, plugable.Proxy)
assert isinstance(proxy, plugable.PluginProxy)
assert proxy.implements(public.option)