Commits

Lennart Regebro committed b81cbe0

Got rid of 2to3, it's really not needed on something as simple as this.

Comments (0)

Files changed (10)

pyroma/projectdata.py

 import re
 import sys
 import logging
-from collections import defaultdict
 
 IMPORTS = re.compile('^import (.*)$|^from (.*?) import .*$', re.MULTILINE)
 

pyroma/pypidata.py

-import xmlrpclib
 import urllib
 import tempfile
 import os
-import contextlib
 import re
 import logging
 from pyroma import distributiondata
+try:
+    from xmlrpc import client as xmlrpclib
+    from urllib import request as urllib
+except ImportError:
+    import xmlrpclib
+    import urllib
 
 OWNER_RE = re.compile(r'<strong>Package Index Owner:</strong>\s*?<span>(.*?)</span>')
 READTHEDOCS_RE = re.compile(r'(https?://.*?\.readthedocs.org)')

pyroma/ratings.py

 #                 False for fail and None for not applicable (meaning it will
 #                 not be counted).
 
-import sys, os, re
+import re
 from docutils.core import publish_parts
 from docutils.utils import SystemMessage
 
     def test(self, data):
         source = data['long_description']
         try:
-            parts = publish_parts(source=source, writer_name='html4css1')
+            # Try to publish to HTML and see if we get an error or not.
+            publish_parts(source=source, writer_name='html4css1')
         except SystemMessage as e:
             self._message = e.args[0].strip()
             return False

pyroma/testdata/complete/complete/__init__.py

 import zope.event
+# Stop pyflakes complaining:
+zope.event

pyroma/testdata/complete/complete/tests.py

 import unittest
-import six
 
 class PackageDataTest(unittest.TestCase):
     
     def test_test(self):
+        # Stop pyflakes from compaining:
         pass
     

pyroma/testdata/complete/setup.py

 from setuptools import setup, find_packages
-import sys, os
 
 version = '1.0'
 

pyroma/testdata/minimal/minimal/__init__.py

-# Various forms of imports, to test dependency detection:
-import external1

pyroma/testdata/minimal/setup.py

 from setuptools import setup, find_packages
-import sys, os
 
 version = '0.0foo'
 
+from __future__ import print_function
 import unittest
 import os
-import xmlrpclib
-import urlparse
-import urllib
 import sys
 import collections
 
+try:
+    from xmlrpc import client as xmlrpclib
+    from urllib import request as urllib
+except ImportError:
+    import xmlrpclib
+    import urllib
+    
 from pyroma import projectdata, distributiondata, pypidata
 from pyroma.ratings import rate
 from pkg_resources import resource_filename, resource_string
         def _proxy_method(*args, **kw):
             if self._real is None:
                 raise AttributeError('ProxyStub unkown method ' + name)
-            print
-            print "== ProxyStub unknown method =="
-            print name, ':', args, kw
+            print()
+            print("== ProxyStub unknown method ==")
+            print(name, ':', args, kw)
             result = getattr(self._real, name)(*args, **kw)
-            print "Result :"
-            print result
+            print("Result :")
+            print(result)
             return result
             
         return _proxy_method
           ],
       },
       test_suite='pyroma',
-      use_2to3=True,
       )