]> granicus.if.org Git - python/commitdiff
Merged revisions 73435 via svnmerge from
authorTarek Ziadé <ziade.tarek@gmail.com>
Sun, 28 Jun 2009 21:10:49 +0000 (21:10 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Sun, 28 Jun 2009 21:10:49 +0000 (21:10 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73435 | tarek.ziade | 2009-06-16 01:04:29 +0200 (Tue, 16 Jun 2009) | 1 line

  code cleanup
........

Lib/distutils/command/upload.py

index 3b4a036718f70c79cf7889ec9a8960a1b0c5cf44..2692377558154e0a8ce6d1ab7b2b5eba9e8aa756 100644 (file)
@@ -1,11 +1,6 @@
 """distutils.command.upload
 
 Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
-
-from distutils.errors import *
-from distutils.core import PyPIRCCommand
-from distutils.spawn import spawn
-from distutils import log
 import sys
 import os, io
 import socket
@@ -14,12 +9,12 @@ import configparser
 import http.client as httpclient
 import base64
 import urllib.parse
+from hashlib import md5
 
-# this keeps compatibility for 2.3 and 2.4
-if sys.version < "2.5":
-    from md5 import md5
-else:
-    from hashlib import md5
+from distutils.errors import *
+from distutils.core import PyPIRCCommand
+from distutils.spawn import spawn
+from distutils import log
 
 class upload(PyPIRCCommand):
 
@@ -137,10 +132,10 @@ class upload(PyPIRCCommand):
         for key, value in data.items():
             title = '\nContent-Disposition: form-data; name="%s"' % key
             # handle multiple entries for the same name
-            if type(value) != type([]):
+            if not isinstance(value, list):
                 value = [value]
             for value in value:
-                if type(value) is tuple:
+                if isinstance(value, tuple):
                     title += '; filename="%s"' % value[0]
                     value = value[1]
                 else: