[Python-checkins] cpython: Cleanup in packaging: don’t unnecessarily instantiate exceptions

eric.araujo python-checkins at python.org
Mon Jun 6 17:14:08 CEST 2011


http://hg.python.org/cpython/rev/9682744cac83
changeset:   70672:9682744cac83
user:        Éric Araujo <merwok at netwok.org>
date:        Sat Jun 04 22:33:16 2011 +0200
summary:
  Cleanup in packaging: don’t unnecessarily instantiate exceptions

files:
  Lib/packaging/pypi/dist.py            |  2 +-
  Lib/packaging/pypi/simple.py          |  2 +-
  Lib/packaging/run.py                  |  2 +-
  Lib/packaging/tests/test_uninstall.py |  2 +-
  4 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Lib/packaging/pypi/dist.py b/Lib/packaging/pypi/dist.py
--- a/Lib/packaging/pypi/dist.py
+++ b/Lib/packaging/pypi/dist.py
@@ -135,7 +135,7 @@
         not return one existing distribution.
         """
         if len(self.dists) == 0:
-            raise LookupError()
+            raise LookupError
         if dist_type:
             return self[dist_type]
         if prefer_source:
diff --git a/Lib/packaging/pypi/simple.py b/Lib/packaging/pypi/simple.py
--- a/Lib/packaging/pypi/simple.py
+++ b/Lib/packaging/pypi/simple.py
@@ -189,7 +189,7 @@
         self._process_index_page(predicate.name)
 
         if predicate.name.lower() not in self._projects:
-            raise ProjectNotFound()
+            raise ProjectNotFound
 
         releases = self._projects.get(predicate.name.lower())
         releases.sort_releases(prefer_final=prefer_final)
diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py
--- a/Lib/packaging/run.py
+++ b/Lib/packaging/run.py
@@ -383,7 +383,7 @@
     """
     #opts = _parse_args(args[1:], '', ['simple', 'xmlrpc'])
     # 1. what kind of index is requested ? (xmlrpc / simple)
-    raise NotImplementedError()
+    raise NotImplementedError
 
 
 actions = [
diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py
--- a/Lib/packaging/tests/test_uninstall.py
+++ b/Lib/packaging/tests/test_uninstall.py
@@ -111,7 +111,7 @@
         old = os.rename
 
         def _rename(source, target):
-            raise OSError()
+            raise OSError
 
         os.rename = _rename
         try:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list