Merge lp:~cjwatson/lazr.restful/py3-stringio into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 260
Proposed branch: lp:~cjwatson/lazr.restful/py3-stringio
Merge into: lp:lazr.restful
Diff against target: 63 lines (+7/-6)
4 files modified
src/lazr/restful/debug.py (+1/-1)
src/lazr/restful/docs/utils.rst (+0/-1)
src/lazr/restful/example/base/tests/wadl.txt (+1/-1)
src/lazr/restful/tests/test_webservice.py (+5/-3)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/py3-stringio
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+390202@code.launchpad.net

Commit message

Avoid the Python 2-specific cStringIO and StringIO modules.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lazr/restful/debug.py'
2--- src/lazr/restful/debug.py 2020-02-04 11:52:59 +0000
3+++ src/lazr/restful/debug.py 2020-09-02 22:29:00 +0000
4@@ -11,7 +11,7 @@
5 ]
6
7
8-from cStringIO import StringIO
9+from six import StringIO
10 import zope.proxy
11
12 from zope.security.checker import getChecker, Checker, CheckerPublic, Proxy
13
14=== modified file 'src/lazr/restful/docs/utils.rst'
15--- src/lazr/restful/docs/utils.rst 2020-08-10 15:05:58 +0000
16+++ src/lazr/restful/docs/utils.rst 2020-09-02 22:29:00 +0000
17@@ -178,7 +178,6 @@
18
19 >>> from zope.schema import TextLine
20 >>> from zope.interface import Interface
21- >>> from StringIO import StringIO
22 >>> class ITwoFields(Interface):
23 ... field_1 = TextLine(title=u"field 1", default=u"field_1 default")
24 ... field_2 = TextLine(title=u"field 2")
25
26=== modified file 'src/lazr/restful/example/base/tests/wadl.txt'
27--- src/lazr/restful/example/base/tests/wadl.txt 2020-02-04 13:17:32 +0000
28+++ src/lazr/restful/example/base/tests/wadl.txt 2020-09-02 22:29:00 +0000
29@@ -36,7 +36,7 @@
30 >>> from lazr.restful import WADL_SCHEMA_FILE
31
32 >>> wadl_schema = etree.XMLSchema(etree.parse(open(WADL_SCHEMA_FILE)))
33- >>> from StringIO import StringIO
34+ >>> from io import StringIO
35 >>> def validate(body):
36 ... res = wadl_schema.validate(
37 ... etree.parse(StringIO(body.decode('utf8'))))
38
39=== modified file 'src/lazr/restful/tests/test_webservice.py'
40--- src/lazr/restful/tests/test_webservice.py 2020-08-17 11:46:51 +0000
41+++ src/lazr/restful/tests/test_webservice.py 2020-09-02 22:29:00 +0000
42@@ -7,8 +7,10 @@
43 __metaclass__ = type
44
45 from contextlib import contextmanager
46-from cStringIO import StringIO
47-from io import BytesIO
48+from io import (
49+ BytesIO,
50+ StringIO,
51+ )
52 from lxml import etree
53 from operator import attrgetter
54 from textwrap import dedent
55@@ -167,7 +169,7 @@
56 def wadl(self):
57 """Get a parsed WADL description of the web service."""
58 with self.request() as request:
59- return request.publication.application.toWADL().encode('utf-8')
60+ return request.publication.application.toWADL()
61
62 @contextmanager
63 def entry_resource(self, entry_interface, entry_implementation,

Subscribers

People subscribed via source and target branches