/rev/0c57d87411b9
changeset: 1304:0c57d87411b9
user:      Martin Geisler <[email protected]>
date:      Fri Sep 25 11:30:58 2009 +0200
summary:   Raise correct error for abstract methods.

The NotImplemented value is a special return value used in operator
overloading -- the exception we want is called NotImplementedError.

diffstat:

 apps/benchmark_classes.py |  10 +++++-----
 viff/runtime.py           |   8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (86 lines):

diff -r deb7659465d2 -r 0c57d87411b9 apps/benchmark_classes.py
--- a/apps/benchmark_classes.py Mon Oct 19 11:48:08 2009 +0200
+++ b/apps/benchmark_classes.py Fri Sep 25 11:30:58 2009 +0200
@@ -87,7 +87,7 @@
         return sync
 
     def run_test(self, _):
-        raise NotImplemented("Override this abstract method in a sub class.")
+        raise NotImplementedError
 
     def finished(self, needed_data, termination_function):
         sys.stdout.flush()
@@ -155,7 +155,7 @@
 
         Returns: None.
         """
-        raise NotImplemented("Override this abstract method in subclasses")
+        raise NotImplementedError
 
     def is_operation_done(self):
         """Returns true if there are no more operations to perform.
@@ -163,14 +163,14 @@
 
         Returns: Boolean.
         """
-        raise NotImplemented("Override this abstract method in subclasses")
+        raise NotImplementedError
 
     def do_operation(self):
         """Perform the operation.
 
         Returns: A share containing the result of the operation.
         """
-        raise NotImplemented("Override this abstract method in subclasses")
+        raise NotImplementedError
 
 class BinaryOperation(Operation):
     """A binary operation."""
@@ -220,7 +220,7 @@
     """A benchmark strategy defines how the benchmark is done."""
 
     def benchmark(self, *args):
-        raise NotImplemented("Override this abstract method in subclasses")
+        raise NotImplementedError
 
 
 class SelfcontainedBenchmarkStrategy(BenchmarkStrategy):
diff -r deb7659465d2 -r 0c57d87411b9 viff/runtime.py
--- a/viff/runtime.py   Mon Oct 19 11:48:08 2009 +0200
+++ b/viff/runtime.py   Fri Sep 25 11:30:58 2009 +0200
@@ -863,7 +863,7 @@
         listed in *inputters*, then a :class:`Share` is given back
         directly.
         """
-        raise NotImplemented("Override this abstract method in a subclass.")
+        raise NotImplementedError
 
     def output(self, share, receivers=None):
         """Open *share* to *receivers* (defaults to all players).
@@ -871,7 +871,7 @@
         Returns a :class:`Share` to players with IDs in *receivers*
         and :const:`None` to the remaining players.
         """
-        raise NotImplemented("Override this abstract method in a subclass.")
+        raise NotImplementedError
 
     def add(self, share_a, share_b):
         """Secure addition.
@@ -879,7 +879,7 @@
         At least one of the arguments must be a :class:`Share`, the
         other can be a :class:`FieldElement` or a (possible long)
         Python integer."""
-        raise NotImplemented("Override this abstract method in a subclass.")
+        raise NotImplementedError
 
     def mul(self, share_a, share_b):
         """Secure multiplication.
@@ -887,7 +887,7 @@
         At least one of the arguments must be a :class:`Share`, the
         other can be a :class:`FieldElement` or a (possible long)
         Python integer."""
-        raise NotImplemented("Override this abstract method in a subclass.")
+        raise NotImplementedError
 
     def handle_deferred_data(self, deferred, data):
         """Put deferred and data into the queue if the ViffReactor is running. 
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to