[tor-commits] [compass/master] Remove abstractions

karsten at torproject.org karsten at torproject.org
Sun Sep 9 21:10:42 UTC 2012


commit 1623a83ecc078f3848dc73f6665cefc104975fee
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Sun Sep 9 20:00:01 2012 +0530

    Remove abstractions
    
    We really don't need abstractions in a dynamically typed language.
    That said, it'd be nice to throw an error when someone doesn't
    implement "accept()".
---
 compass.py |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/compass.py b/compass.py
index 428812f..8b00bf6 100755
--- a/compass.py
+++ b/compass.py
@@ -13,12 +13,10 @@ import os
 from optparse import OptionParser, OptionGroup
 import urllib
 import re
-from abc import abstractmethod
 
 class BaseFilter(object):
-    @abstractmethod
     def accept(self, relay):
-        pass
+        raise NotImplementedError("This isn't implemented by the subclass")
 
     def load(self, relays):
         return filter(self.accept, relays)





More information about the tor-commits mailing list