]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Demo/metaclasses/Simple.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Demo / metaclasses / Simple.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Demo/metaclasses/Simple.py b/AppPkg/Applications/Python/Python-2.7.2/Demo/metaclasses/Simple.py
deleted file mode 100644 (file)
index 5334860..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-import types\r
-\r
-class Tracing:\r
-    def __init__(self, name, bases, namespace):\r
-        """Create a new class."""\r
-        self.__name__ = name\r
-        self.__bases__ = bases\r
-        self.__namespace__ = namespace\r
-    def __call__(self):\r
-        """Create a new instance."""\r
-        return Instance(self)\r
-\r
-class Instance:\r
-    def __init__(self, klass):\r
-        self.__klass__ = klass\r
-    def __getattr__(self, name):\r
-        try:\r
-            value = self.__klass__.__namespace__[name]\r
-        except KeyError:\r
-            raise AttributeError, name\r
-        if type(value) is not types.FunctionType:\r
-            return value\r
-        return BoundMethod(value, self)\r
-\r
-class BoundMethod:\r
-    def __init__(self, function, instance):\r
-        self.function = function\r
-        self.instance = instance\r
-    def __call__(self, *args):\r
-        print "calling", self.function, "for", self.instance, "with", args\r
-        return apply(self.function, (self.instance,) + args)\r
-\r
-Trace = Tracing('Trace', (), {})\r
-\r
-class MyTracedClass(Trace):\r
-    def method1(self, a):\r
-        self.a = a\r
-    def method2(self):\r
-        return self.a\r
-\r
-aninstance = MyTracedClass()\r
-\r
-aninstance.method1(10)\r
-\r
-print aninstance.method2()\r