summaryrefslogtreecommitdiff
path: root/contrib/mtn2git/mtn/genproxy.py
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2007-10-09 15:01:33 +0000
committerHolger Freyther <zecke@selfish.org>2007-10-09 15:01:33 +0000
commit109e6d019c1880eda9e0eb11c59ae926c4188faa (patch)
treed315697759c832780ba81ebc3e830841926e4c8d /contrib/mtn2git/mtn/genproxy.py
parentdc11f7ab4057b0c334dac98773efa66e090cc6f6 (diff)
contrib/mtn2git: mtn add is not recursive by default, actually add files ;)
Diffstat (limited to 'contrib/mtn2git/mtn/genproxy.py')
-rwxr-xr-xcontrib/mtn2git/mtn/genproxy.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/mtn2git/mtn/genproxy.py b/contrib/mtn2git/mtn/genproxy.py
new file mode 100755
index 0000000000..5ba67eefd6
--- /dev/null
+++ b/contrib/mtn2git/mtn/genproxy.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+class GeneratorProxy(object):
+ def __init__(self, generator):
+ self.generator = generator
+ def __iter__(self):
+ return self
+ def next(self):
+ return self.generator.next()
+
+class Seedy(GeneratorProxy):
+ def __del__(self):
+ print "testing"
+
+def test():
+ yield 2
+ yield 3
+ yield 4
+
+if __name__ == '__main__':
+ a = test()
+ b = Seedy(test())
+ for i in b:
+ print i
+ \ No newline at end of file