util.py: make functions return NotImplemented
authorMaxim Belkin <maxim.belkin@gmail.com>
Tue, 22 May 2018 12:25:02 +0000 (07:25 -0500)
committerMaxim Belkin <maxim.belkin@gmail.com>
Tue, 22 May 2018 12:25:02 +0000 (07:25 -0500)
bin/util.py

index 5bc7e9ba8418187b74f9fe452e5ce7aca7fc88bd..8d958150f8607e0fe3d7a549708055d303241267 100644 (file)
@@ -74,8 +74,9 @@ class Reporter(object):
             return location + ': ' + message
         elif isinstance(location, tuple):
             return '{0}:{1}: '.format(*location) + message
-        else:
-            assert False, 'Unknown item "{0}"'.format(item)
+
+        print('Unknown item "{0}"'.format(item), file=sys.stderr)
+        return NotImplemented
 
     @staticmethod
     def key(item):
@@ -86,8 +87,9 @@ class Reporter(object):
             return (location, -1, message)
         elif isinstance(location, tuple):
             return (location[0], location[1], message)
-        else:
-            assert False, 'Unknown item "{0}"'.format(item)
+
+        print('Unknown item "{0}"'.format(item), file=sys.stderr)
+        return NotImplemented
 
     def report(self, stream=sys.stdout):
         """Report all messages in order."""