# HG changeset patch
# User Sigurd Meldgaard <[EMAIL PROTECTED]>
# Date 1221574030 -7200
# Node ID f879ad687faab381f1208885a5c1330265e3e119
# Parent 5aa168c8778a1e2909cda7c1ea08da8501b66a95
Added a function viff.runtime.make_runtime_class, that creates a new runtime
class with mixins
diff -r 5aa168c8778a -r f879ad687faa viff/runtime.py
--- a/viff/runtime.py Tue Sep 16 16:11:10 2008 +0200
+++ b/viff/runtime.py Tue Sep 16 16:07:10 2008 +0200
@@ -1079,6 +1079,19 @@
result.addCallback(shamir.recombine)
return result
+def make_runtime_class(runtime_class = Runtime, mixins = ()):
+ """Creates a new runtime class with runtime_class as a base class
+ mixing in the mixins.
+
+ mixins must be a list or tuple of mixin-classes.
+ """
+
+ # We must include at least one new-style class in bases. We
+ # include it last to avoid overriding __init__ from the other base
+ # classes.
+ bases = (runtime_class,) + tuple(mixins) + (object,)
+
+ return type("ExtendedRuntime", bases, {})
def create_runtime(id, players, threshold, options=None,
runtime_class=Runtime):
"""Create a :class:`Runtime` and connect to the other players.
_______________________________________________
viff-patches mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk