← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/python-oops-twisted/py3 into lp:python-oops-twisted

 

Colin Watson has proposed merging lp:~cjwatson/python-oops-twisted/py3 into lp:python-oops-twisted.

Commit message:
Add Python 3 support.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/python-oops-twisted/py3/+merge/341280

Requires https://code.launchpad.net/~cjwatson/python-oops-wsgi/py3/+merge/341275 in order to work on Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/python-oops-twisted/py3 into lp:python-oops-twisted.
=== modified file '.bzrignore'
--- .bzrignore	2011-11-04 04:08:22 +0000
+++ .bzrignore	2018-03-10 23:13:58 +0000
@@ -1,3 +1,4 @@
+__pycache__
 ./eggs/*
 ./.installed.cfg
 ./develop-eggs

=== modified file 'NEWS'
--- NEWS	2017-09-04 10:07:26 +0000
+++ NEWS	2018-03-10 23:13:58 +0000
@@ -6,6 +6,8 @@
 NEXT
 ----
 
+* Add Python 3 support. (Colin Watson)
+
 0.0.7
 -----
 

=== modified file 'README'
--- README	2011-12-09 06:10:41 +0000
+++ README	2018-03-10 23:13:58 +0000
@@ -24,7 +24,7 @@
 Dependencies
 ============
 
-* Python 2.6+
+* Python 2.6+ or 3.3+
 
 * oops (http://pypi.python.org/pypi/oops)
 

=== modified file 'oops_twisted/__init__.py'
--- oops_twisted/__init__.py	2017-09-04 10:07:26 +0000
+++ oops_twisted/__init__.py	2018-03-10 23:13:58 +0000
@@ -133,6 +133,8 @@
 """
 
 
+from __future__ import absolute_import, print_function
+
 # same format as sys.version_info: "A tuple containing the five components of
 # the version number: major, minor, micro, releaselevel, and serial. All
 # values except releaselevel are integers; the release level is 'alpha',

=== modified file 'oops_twisted/config.py'
--- oops_twisted/config.py	2017-09-02 12:47:40 +0000
+++ oops_twisted/config.py	2018-03-10 23:13:58 +0000
@@ -24,6 +24,8 @@
 publisher.
 """
 
+from __future__ import absolute_import, print_function
+
 from functools import partial
 import warnings
 
@@ -81,7 +83,7 @@
                 "instead, with an oops_twisted.publishers.publish_to_many "
                 "object if multiple publishers are needed",
                 DeprecationWarning, stacklevel=2)
-        old_publishers = map(convert_result_to_list, self.publishers)
+        old_publishers = [convert_result_to_list(p) for p in self.publishers]
         if self.publisher:
             publisher = publish_to_many(self.publisher, *old_publishers)
         else:

=== modified file 'oops_twisted/createhooks.py'
--- oops_twisted/createhooks.py	2011-12-09 06:06:25 +0000
+++ oops_twisted/createhooks.py	2018-03-10 23:13:58 +0000
@@ -15,6 +15,8 @@
 
 """Extensions to permit creatings OOPS reports with twisted types."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 __all__ = [

=== modified file 'oops_twisted/log.py'
--- oops_twisted/log.py	2011-12-09 06:10:41 +0000
+++ oops_twisted/log.py	2018-03-10 23:13:58 +0000
@@ -15,8 +15,11 @@
 
 """twisted.log observer to create OOPSes for failures."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
+import collections
 import datetime
 
 from pytz import utc
@@ -24,7 +27,7 @@
     ILogObserver,
     textFromEventDict,
     )
-from zope.interface import implements
+from zope.interface import implementer
 
 
 __all__ = [
@@ -32,11 +35,10 @@
     ]
 
 
+@implementer(ILogObserver)
 class OOPSObserver:
     """Convert twisted log events to OOPSes if they are failures."""
 
-    implements(ILogObserver)
-
     def __init__(self, config, fallback=None):
         """"Create an OOPSObserver.
 
@@ -46,7 +48,7 @@
             occurred.
         """
         self.config = config
-        assert fallback is None or callable(fallback)
+        assert fallback is None or isinstance(fallback, collections.Callable)
         self.fallback = fallback
 
     def emit(self, eventDict):

=== modified file 'oops_twisted/publishers.py'
--- oops_twisted/publishers.py	2017-09-02 12:47:40 +0000
+++ oops_twisted/publishers.py	2018-03-10 23:13:58 +0000
@@ -15,6 +15,8 @@
 
 """Asynchronous publisher utilities."""
 
+from __future__ import absolute_import, print_function
+
 __all__ = [
     'convert_result_to_list',
     'publish_to_many',

=== modified file 'oops_twisted/tests/__init__.py'
--- oops_twisted/tests/__init__.py	2011-12-09 06:06:25 +0000
+++ oops_twisted/tests/__init__.py	2018-03-10 23:13:58 +0000
@@ -14,6 +14,8 @@
 
 """Tests for oops_twisted."""
 
+from __future__ import absolute_import, print_function
+
 from unittest import TestLoader
 
 

=== modified file 'oops_twisted/tests/test_config.py'
--- oops_twisted/tests/test_config.py	2017-09-02 12:47:40 +0000
+++ oops_twisted/tests/test_config.py	2018-03-10 23:13:58 +0000
@@ -15,6 +15,8 @@
 
 """Tests for the twisted oops config."""
 
+from __future__ import absolute_import, print_function
+
 from testtools import TestCase
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 

=== modified file 'oops_twisted/tests/test_createhooks.py'
--- oops_twisted/tests/test_createhooks.py	2011-12-09 06:06:25 +0000
+++ oops_twisted/tests/test_createhooks.py	2018-03-10 23:13:58 +0000
@@ -15,6 +15,8 @@
 
 """Tests for the twisted specific creation hooks."""
 
+from __future__ import absolute_import, print_function
+
 from testtools import TestCase
 from twisted.python.failure import Failure
 

=== modified file 'oops_twisted/tests/test_log.py'
--- oops_twisted/tests/test_log.py	2011-12-09 06:10:41 +0000
+++ oops_twisted/tests/test_log.py	2018-03-10 23:13:58 +0000
@@ -15,7 +15,8 @@
 
 """Tests for the twisted log observer."""
 
-from functools import partial
+from __future__ import absolute_import, print_function
+
 import datetime
 import time
 

=== modified file 'oops_twisted/tests/test_publishers.py'
--- oops_twisted/tests/test_publishers.py	2017-09-02 12:47:40 +0000
+++ oops_twisted/tests/test_publishers.py	2018-03-10 23:13:58 +0000
@@ -15,6 +15,8 @@
 
 """Tests for the publishers module."""
 
+from __future__ import absolute_import, print_function
+
 __metaclass__ = type
 
 import testtools

=== modified file 'oops_twisted/tests/test_wsgi.py'
--- oops_twisted/tests/test_wsgi.py	2011-12-09 06:06:25 +0000
+++ oops_twisted/tests/test_wsgi.py	2018-03-10 23:13:58 +0000
@@ -15,16 +15,17 @@
 
 """Tests for the twisted wsgi body tracker."""
 
+from __future__ import absolute_import, print_function
+
 from operator import methodcaller
 
-from oops_wsgi.middleware import generator_tracker
 from testtools import TestCase
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 from testtools.matchers import MatchesException
 from twisted.internet import reactor
 from twisted.internet.defer import Deferred
 from twisted.web.iweb import IBodyProducer
-from zope.interface import implements
+from zope.interface import implementer
 from zope.interface.verify import verifyObject
 
 from oops_twisted.wsgi import body_producer_tracker
@@ -211,13 +212,13 @@
         self.received.append(data)
 
 
+@implementer(IBodyProducer)
 class ListProducer:
     """A simple producer for testing.
-    
+
     Possibly something to put into twisted itself.
     """
-    implements(IBodyProducer)
-    
+
     def __init__(self, chunks, length=None, error_chunk=None,
             delay_write=False):
         """Create a ListProducer.

=== modified file 'oops_twisted/wsgi.py'
--- oops_twisted/wsgi.py	2011-12-09 06:06:25 +0000
+++ oops_twisted/wsgi.py	2018-03-10 23:13:58 +0000
@@ -15,10 +15,12 @@
   
 """Extended WSGI support for Twisted."""
 
+from __future__ import absolute_import, print_function
+
 from oops_wsgi.middleware import generator_tracker
 from twisted.internet.defer import Deferred
 from twisted.web.iweb import IBodyProducer
-from zope.interface import implements
+from zope.interface import implementer
 
 
 __all__ = [
@@ -49,14 +51,13 @@
     return ProducerWrapper(on_first_bytes, on_finish, on_error, app_body)
 
 
+@implementer(IBodyProducer)
 class ProducerWrapper:
     """Wrap an IBodyProducer and call callbacks at key points.
 
     :seealso: body_producer_tracker - the main user of ProducerWrapper.
     """
 
-    implements(IBodyProducer)
-
     def __init__(self, on_first_bytes, on_finish, on_error, app_body):
         self.on_first_bytes = on_first_bytes
         self.on_finish = on_finish

=== modified file 'setup.py'
--- setup.py	2017-09-04 10:07:26 +0000
+++ setup.py	2018-03-10 23:13:58 +0000
@@ -18,8 +18,8 @@
 from distutils.core import setup
 import os.path
 
-description = file(
-        os.path.join(os.path.dirname(__file__), 'README'), 'rb').read()
+with open(os.path.join(os.path.dirname(__file__), 'README')) as f:
+    description = f.read()
 
 setup(name="oops_twisted",
       version="0.0.7",
@@ -37,12 +37,15 @@
           'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
           'Operating System :: OS Independent',
           'Programming Language :: Python',
+          'Programming Language :: Python :: 2',
+          'Programming Language :: Python :: 3',
           ],
       install_requires = [
           'oops>=0.0.11',
           'oops_wsgi',
           'pytz',
           'Twisted',
+          'zope.interface>=3.6.0',
           ],
       extras_require = dict(
           test=[

=== modified file 'versions.cfg'
--- versions.cfg	2017-09-02 12:47:40 +0000
+++ versions.cfg	2018-03-10 23:13:58 +0000
@@ -15,4 +15,4 @@
 z3c.recipe.filetemplate = 2.1.0
 z3c.recipe.scripts = 1.0.1
 zc.buildout = 1.5.1
-zope.interface = 3.5.2
+zope.interface = 4.4.3