OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
zope
/
interface
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/09/2024 07:14:32 AM
rwxr-xr-x
📄
__init__.py
481 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📁
__pycache__
-
05/09/2024 07:14:32 AM
rwxr-xr-x
📄
advisory_testing.py
1.23 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
dummy.py
888 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
idummy.py
889 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
ifoo.py
851 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
ifoo_other.py
851 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
m1.py
812 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
m2.py
689 bytes
09/05/2016 06:11:08 AM
rw-r--r--
📄
odd.py
3.01 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_adapter.py
52.49 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_advice.py
11.22 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_declarations.py
58.65 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_document.py
16.46 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_element.py
1.29 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_exceptions.py
2.66 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_interface.py
71.17 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_interfaces.py
3.48 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_odd_declarations.py
6.75 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_registry.py
99.79 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_ro.py
3.23 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_sorting.py
1.57 KB
09/05/2016 06:11:08 AM
rw-r--r--
📄
test_verify.py
15.32 KB
09/05/2016 06:11:08 AM
rw-r--r--
Editing: odd.py
Close
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Odd meta class that doesn't subclass type. This is used for testing support for ExtensionClass in new interfaces. >>> class A(object): ... __metaclass__ = MetaClass ... a = 1 ... >>> A.__name__ 'A' >>> A.__bases__ == (object,) True >>> class B(object): ... __metaclass__ = MetaClass ... b = 1 ... >>> class C(A, B): pass ... >>> C.__name__ 'C' >>> int(C.__bases__ == (A, B)) 1 >>> a = A() >>> aa = A() >>> a.a 1 >>> aa.a 1 >>> aa.a = 2 >>> a.a 1 >>> aa.a 2 >>> c = C() >>> c.a 1 >>> c.b 1 >>> c.b = 2 >>> c.b 2 >>> C.c = 1 >>> c.c 1 >>> import sys >>> if sys.version[0] == '2': # This test only makes sense under Python 2.x ... from types import ClassType ... assert not isinstance(C, (type, ClassType)) >>> int(C.__class__.__class__ is C.__class__) 1 """ # class OddClass is an odd meta class class MetaMetaClass(type): def __getattribute__(self, name): if name == '__class__': return self return type.__getattribute__(self, name) class MetaClass(object): """Odd classes """ __metaclass__ = MetaMetaClass def __init__(self, name, bases, dict): self.__name__ = name self.__bases__ = bases self.__dict__.update(dict) def __call__(self): return OddInstance(self) def __getattr__(self, name): for b in self.__bases__: v = getattr(b, name, self) if v is not self: return v raise AttributeError(name) def __repr__(self): return "<odd class %s at %s>" % (self.__name__, hex(id(self))) class OddInstance(object): def __init__(self, cls): self.__dict__['__class__'] = cls def __getattribute__(self, name): dict = object.__getattribute__(self, '__dict__') if name == '__dict__': return dict v = dict.get(name, self) if v is not self: return v return getattr(dict['__class__'], name) def __setattr__(self, name, v): self.__dict__[name] = v def __delattr__(self, name): del self.__dict__[name] def __repr__(self): return "<odd %s instance at %s>" % ( self.__class__.__name__, hex(id(self))) # DocTest: if __name__ == "__main__": import doctest, __main__ doctest.testmod(__main__, isprivate=lambda *a: False)