本文整理汇总了Python中pyamf.unregister_class函数的典型用法代码示例。如果您正苦于以下问题:Python unregister_class函数的具体用法?Python unregister_class怎么用?Python unregister_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unregister_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_dynamic
def test_dynamic(self):
class Foo(pyamf.ASObject):
pass
def attr_func(obj):
self.assertTrue(isinstance(obj, Foo))
return ['hello']
x = Foo()
x.foo = 'bar'
x.hello = 'world'
y = Foo()
y.hello = x.hello
pyamf.register_class(Foo, 'x', attr_func=attr_func,
metadata=['dynamic'])
self._run([(x, '\x10\x00\x01x\x00\x03foo\x02\x00\x03bar\x00\x05hello'
'\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Foo)
pyamf.register_class(Foo, 'x', attrs=['hello'], attr_func=attr_func,
metadata=['dynamic'])
self._run([(x, '\x10\x00\x01x\x00\x03foo\x02\x00\x03bar\x00\x05hello'
'\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Foo)
pyamf.register_class(Foo, 'x', attrs=['foo'], attr_func=attr_func,
metadata=['dynamic'])
self._run([(x, '\x10\x00\x01x\x00\x03foo\x02\x00\x03bar\x00\x05hello'
'\x02\x00\x05world\x00\x00\t')])
开发者ID:AbsMate,项目名称:bluecop-xbmc-repo,代码行数:34,代码来源:test_amf0.py
示例2: tearDown
def tearDown(self):
import pyamf
pyamf.unregister_class(status.Status)
if self._old_alias:
pyamf.register_class(self._old_alias)
开发者ID:Arlex,项目名称:rtmpy,代码行数:7,代码来源:test_status.py
示例3: tearDown
def tearDown(self):
self.class_mapper.unmapClass(self.TestObject)
self.class_mapper.unmapClass(self.TestSubObject)
if use_pyamf is True:
pyamf.unregister_class(self.TestObject)
pyamf.unregister_class(self.TestSubObject)
开发者ID:NGFieldScope,项目名称:amfast,代码行数:7,代码来源:speed_test.py
示例4: test_klass
def test_klass(self):
alias = pyamf.register_class(Spam, 'spam.eggs')
pyamf.unregister_class(Spam)
self.assertTrue('spam.eggs' not in pyamf.CLASS_CACHE.keys())
self.assertTrue(Spam not in pyamf.CLASS_CACHE.keys())
self.assertTrue(alias not in pyamf.CLASS_CACHE)
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_basic.py
示例5: test_simple
def test_simple(self):
class A(object):
pass
pyamf.register_class(A, 'A', attrs=['a'])
class B(A):
pass
pyamf.register_class(B, 'B', attrs=['b'])
x = B()
x.a = 'spam'
x.b = 'eggs'
stream = util.BufferedByteStream()
encoder = pyamf._get_encoder_class(pyamf.AMF0)(stream)
encoder.writeElement(x)
self.assertEquals(stream.getvalue(), '\x10\x00\x01B\x00\x01b\x02\x00'
'\x04eggs\x00\x01a\x02\x00\x04spam\x00\x00\t')
pyamf.unregister_class(A)
pyamf.unregister_class(B)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:25,代码来源:test_amf0.py
示例6: test_setstate_classic
def test_setstate_classic(self):
self.executed = False
class Foo:
tc = self
def __init__(self, *args, **kwargs):
self.tc.fail("__init__ called")
def __setstate__(self, state):
self.tc.executed = True
self.__dict__.update(state)
pyamf.register_class(Foo, 'foo')
self.buf.write('\x10\x00\x03\x66\x6f\x6f\x00\x04\x65\x67\x67\x73\x01\x01\x00\x04')
self.buf.write('\x73\x70\x61\x6d\x02\x00\x05\x68\x65\x6c\x6c\x6f\x00\x00\x09')
self.buf.seek(0)
foo = self.decoder.readElement()
self.assertTrue(self.executed)
self.assertTrue(isinstance(foo, Foo))
self.assertEquals(foo.spam, 'hello')
self.assertEquals(foo.eggs, True)
pyamf.unregister_class(Foo)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:27,代码来源:test_amf0.py
示例7: test_dynamic
def test_dynamic(self):
pyamf.register_class(Spam, 'abc.xyz', metadata='dynamic')
x = Spam({'spam': 'eggs'})
self.encoder.writeElement(x)
self.assertEquals(self.stream.getvalue(), '\n\x0b\x0fabc.xyz\tspam\x06\teggs\x01')
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:9,代码来源:test_amf3.py
示例8: test_class_references
def test_class_references(self):
pyamf.register_class(Spam, 'abc.xyz')
x = Spam({'spam': 'eggs'})
y = Spam({'spam': 'baz'})
self.encoder.writeElement(x)
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:9,代码来源:test_amf3.py
示例9: test_force_amf3
def test_force_amf3(self):
pyamf.register_class(Spam, 'spam.eggs', metadata=['amf3'])
x = Spam()
x.x = 'y'
self._run([
(x, '\x11\n\x0b\x13spam.eggs\x03x\x06\x03y\x01')])
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:10,代码来源:test_amf0.py
示例10: test_typed_object
def test_typed_object(self):
pyamf.register_class(Spam, alias='org.pyamf.spam')
x = Spam()
x.baz = 'hello'
self.encoder.writeElement(x)
self.assertEquals(self.buf.getvalue(),
'\x10\x00\x0eorg.pyamf.spam\x00\x03baz\x02\x00\x05hello\x00\x00\t')
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:12,代码来源:test_amf0.py
示例11: tearDown
def tearDown(self):
try:
self.jessica.delete()
except:
pass
if self.jessica_expando.is_saved():
self.jessica_expando.delete()
try:
pyamf.unregister_class(PetModel)
except:
pass
开发者ID:Armedite,项目名称:xbmc-catchuptv-au,代码行数:13,代码来源:test_google.py
示例12: test_dynamic
def test_dynamic(self):
class Foo(pyamf.ASObject):
pass
x = Foo()
x.foo = 'bar'
alias = pyamf.register_class(Foo, 'x')
alias.exclude_attrs = ['hello']
self._run([(x, '\x10\x00\x01x\x00\x03foo\x02\x00\x03bar\x00\x05hello'
'\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Foo)
开发者ID:cardmagic,项目名称:PyAMF,代码行数:14,代码来源:test_amf0.py
示例13: test_combined
def test_combined(self):
def wf(obj):
return ['eggs']
pyamf.register_class(Spam, 'abc.xyz', attrs=['spam'], attr_func=wf)
x = Spam({'spam': 'foo', 'eggs': 'bar'})
self.encoder.writeElement(x)
buf = self.stream.getvalue()
self.assertEquals(buf, '\n\x1b\x0fabc.xyz\tspam\x06\x07foo\teggs\x06\x07bar\x01')
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:14,代码来源:test_amf3.py
示例14: test_get_alias
def test_get_alias(self):
pyamf.register_class(Spam, 'spam.eggs')
x = amf3.ClassDefinition('spam.eggs')
alias = x.getClassAlias()
self.assertEquals(alias.klass, Spam)
self.assertEquals(alias.alias, 'spam.eggs')
pyamf.unregister_class(Spam)
x = amf3.ClassDefinition(None)
self.assertRaises(pyamf.UnknownClassAlias, x.getClassAlias)
x = amf3.ClassDefinition('')
self.assertRaises(pyamf.UnknownClassAlias, x.getClassAlias)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:16,代码来源:test_amf3.py
示例15: test_object
def test_object(self):
self._run([
({'a': u'spam', 'b': 5},
'\n\x0b\x01\x03a\x06\tspam\x03b\x04\x05\x01')])
pyamf.register_class(Spam, 'org.pyamf.spam')
obj = Spam()
obj.baz = 'hello'
self.encoder.writeElement(obj)
self.assertEqual(self.buf.getvalue(), '\n\x0b\x1dorg.pyamf.spam\x07baz'
'\x06\x0bhello\x01')
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:16,代码来源:test_amf3.py
示例16: test_static
def test_static(self):
pyamf.register_class(Spam, 'abc.xyz', metadata='static', attrs=[])
x = Spam({'spam': 'eggs'})
self.encoder.writeElement(x)
self.assertEquals(self.stream.getvalue(), '\n\x03\x0fabc.xyz')
pyamf.unregister_class(Spam)
self.stream.truncate()
self.encoder.context.clear()
pyamf.register_class(Spam, 'abc.xyz', metadata='static', attrs=['spam'])
x = Spam({'spam': 'eggs'})
self.encoder.writeElement(x)
self.assertEquals(self.stream.getvalue(), '\n\x13\x0fabc.xyz\tspam\x06\teggs')
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:16,代码来源:test_amf3.py
示例17: test_old_style_classes
def test_old_style_classes(self):
class Person:
pass
pyamf.register_class(Person, 'spam.eggs.Person')
u = Person()
u.family_name = 'Doe'
u.given_name = 'Jane'
self.encoder.writeElement(u)
self.assertEquals(self.buf.getvalue(), '\n\x0b!spam.eggs.Person\x17'
'family_name\x06\x07Doe\x15given_name\x06\tJane\x01')
pyamf.unregister_class(Person)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:16,代码来源:test_amf3.py
示例18: test_external
def test_external(self):
pyamf.register_class(Spam, 'abc.xyz', metadata=['external'])
x = Spam({'spam': 'eggs'})
self.encoder.writeElement(x)
buf = self.stream.getvalue()
# an inline object with and inline class-def, encoding = 0x01, 1 attr
self.assertEquals(buf[:2], '\x0a\x07')
# class alias name
self.assertEquals(buf[2:10], '\x0fabc.xyz')
self.assertEquals(len(buf), 10)
pyamf.unregister_class(Spam)
开发者ID:wayne-abarquez,项目名称:vizzuality,代码行数:17,代码来源:test_amf3.py
示例19: test_static
def test_static(self):
alias = pyamf.register_class(Spam, 'abc.xyz')
alias.dynamic = False
x = Spam({'spam': 'eggs'})
self.encoder.writeElement(x)
self.assertEqual(self.buf.getvalue(), '\n\x03\x0fabc.xyz')
pyamf.unregister_class(Spam)
self.buf.truncate()
self.encoder.context.clear()
alias = pyamf.register_class(Spam, 'abc.xyz')
alias.dynamic = False
alias.static_attrs = ['spam']
x = Spam({'spam': 'eggs', 'foo': 'bar'})
self.encoder.writeElement(x)
self.assertEqual(self.buf.getvalue(), '\n\x13\x0fabc.xyz\tspam\x06\teggs')
开发者ID:MyaThandarKyaw,项目名称:pyamf,代码行数:19,代码来源:test_amf3.py
示例20: test_anonymous
def test_anonymous(self):
alias = ClassAlias(Spam, defer=True)
pyamf.CLASS_CACHE['foo'] = alias
pyamf.CLASS_CACHE[Spam] = alias
self.assertTrue(alias.anonymous)
ret = pyamf.unregister_class(Spam)
self.assertTrue('foo' in pyamf.CLASS_CACHE)
self.assertFalse(Spam in pyamf.CLASS_CACHE)
self.assertTrue(ret is alias)
开发者ID:notnola,项目名称:pinychat,代码行数:12,代码来源:test_alias.py
注:本文中的pyamf.unregister_class函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论