[Python-checkins] distutils2: Remove redundant conversions

tarek.ziade python-checkins at python.org
Sat Jul 3 16:19:06 CEST 2010


tarek.ziade pushed b2ec3efa9496 to distutils2:

http://hg.python.org/distutils2/rev/b2ec3efa9496
changeset:   250:b2ec3efa9496
user:        ?ric Araujo <merwok at netwok.org>
date:        Wed Jun 30 19:00:34 2010 +0200
summary:     Remove redundant conversions
files:       src/distutils2/dist.py, src/distutils2/log.py, src/distutils2/metadata.py, src/distutils2/tests/support.py

diff --git a/src/distutils2/dist.py b/src/distutils2/dist.py
--- a/src/distutils2/dist.py
+++ b/src/distutils2/dist.py
@@ -250,7 +250,7 @@
                 elif hasattr(self, key):
                     setattr(self, key, val)
                 else:
-                    msg = "Unknown distribution option: %s" % repr(key)
+                    msg = "Unknown distribution option: %r" % key
                     if warnings is not None:
                         warnings.warn(msg)
                     else:
diff --git a/src/distutils2/log.py b/src/distutils2/log.py
--- a/src/distutils2/log.py
+++ b/src/distutils2/log.py
@@ -18,7 +18,7 @@
 
     def _log(self, level, msg, args):
         if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
-            raise ValueError('%s wrong log level' % str(level))
+            raise ValueError('%s wrong log level' % level)
 
         if level >= self.threshold:
             if args:
diff --git a/src/distutils2/metadata.py b/src/distutils2/metadata.py
--- a/src/distutils2/metadata.py
+++ b/src/distutils2/metadata.py
@@ -517,7 +517,7 @@
             raise NameError(value)
 
     def _nonsense_op(self):
-        msg = 'This operation is not supported : "%s"' % str(self)
+        msg = 'This operation is not supported : "%s"' % self
         raise SyntaxError(msg)
 
     def __call__(self):
diff --git a/src/distutils2/tests/support.py b/src/distutils2/tests/support.py
--- a/src/distutils2/tests/support.py
+++ b/src/distutils2/tests/support.py
@@ -41,7 +41,7 @@
 
     def _log(self, level, msg, args):
         if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
-            raise ValueError('%s wrong log level' % str(level))
+            raise ValueError('%s wrong log level' % level)
         self.logs.append((level, msg, args))
 
     def get_logs(self, *levels):

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


More information about the Python-checkins mailing list