Merge ~cjwatson/lazr.restful:remove-six-moves into lazr.restful:main
- Git
- lp:~cjwatson/lazr.restful
- remove-six-moves
- Merge into main
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 9086d701e62d10fb64f53ff846cafbf9d184e6a3 |
Proposed branch: | ~cjwatson/lazr.restful:remove-six-moves |
Merge into: | lazr.restful:main |
Diff against target: |
265 lines (+25/-25) 16 files modified
src/lazr/restful/docs/multiversion.rst (+1/-1) src/lazr/restful/docs/webservice-declarations.rst (+2/-2) src/lazr/restful/docs/webservice.rst (+2/-2) src/lazr/restful/example/base/tests/collection.txt (+1/-1) src/lazr/restful/example/base/tests/entry.txt (+1/-1) src/lazr/restful/example/base/tests/field.txt (+1/-1) src/lazr/restful/example/base/tests/hostedfile.txt (+1/-1) src/lazr/restful/example/base/tests/representation-cache.txt (+1/-1) src/lazr/restful/example/base/tests/service.txt (+1/-1) src/lazr/restful/example/base/tests/wadl.txt (+1/-1) src/lazr/restful/example/base/traversal.py (+2/-2) src/lazr/restful/marshallers.py (+1/-1) src/lazr/restful/publisher.py (+3/-3) src/lazr/restful/simple.py (+2/-2) src/lazr/restful/tales.py (+1/-1) src/lazr/restful/testing/webservice.py (+4/-4) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+413797@code.launchpad.net |
Commit message
Remove uses of six.moves
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/src/lazr/restful/docs/multiversion.rst b/src/lazr/restful/docs/multiversion.rst | |||
2 | index 6f3fd68..8a3faca 100644 | |||
3 | --- a/src/lazr/restful/docs/multiversion.rst | |||
4 | +++ b/src/lazr/restful/docs/multiversion.rst | |||
5 | @@ -163,7 +163,7 @@ contacts. | |||
6 | 163 | 163 | ||
7 | 164 | Here's a simple implementation of IContact. | 164 | Here's a simple implementation of IContact. |
8 | 165 | 165 | ||
10 | 166 | >>> from six.moves.urllib.parse import quote | 166 | >>> from urllib.parse import quote |
11 | 167 | >>> from zope.interface import implementer | 167 | >>> from zope.interface import implementer |
12 | 168 | >>> from lazr.restful.security import protect_schema | 168 | >>> from lazr.restful.security import protect_schema |
13 | 169 | >>> @implementer(IContact, ILocation) | 169 | >>> @implementer(IContact, ILocation) |
14 | diff --git a/src/lazr/restful/docs/webservice-declarations.rst b/src/lazr/restful/docs/webservice-declarations.rst | |||
15 | index 964f5ff..2a8eb46 100644 | |||
16 | --- a/src/lazr/restful/docs/webservice-declarations.rst | |||
17 | +++ b/src/lazr/restful/docs/webservice-declarations.rst | |||
18 | @@ -55,8 +55,8 @@ These declarations add tagged values to the original interface elements. | |||
19 | 55 | The tags are in the lazr.restful namespace and are dictionaries of | 55 | The tags are in the lazr.restful namespace and are dictionaries of |
20 | 56 | elements. | 56 | elements. |
21 | 57 | 57 | ||
22 | 58 | >>> from collections.abc import Mapping | ||
23 | 58 | >>> from pprint import pformat | 59 | >>> from pprint import pformat |
24 | 59 | >>> from six.moves.collections_abc import Mapping | ||
25 | 60 | >>> def print_export_tag(element): | 60 | >>> def print_export_tag(element): |
26 | 61 | ... """Print the content of the 'lazr.restful.exported' tag.""" | 61 | ... """Print the content of the 'lazr.restful.exported' tag.""" |
27 | 62 | ... def format_value(value): | 62 | ... def format_value(value): |
28 | @@ -1285,7 +1285,7 @@ URL to the newly created object. The body of the response will be empty. | |||
29 | 1285 | (For the URL generation to work, we need to register an IAbsoluteURL | 1285 | (For the URL generation to work, we need to register an IAbsoluteURL |
30 | 1286 | adapter and set the request as the current interaction.) | 1286 | adapter and set the request as the current interaction.) |
31 | 1287 | 1287 | ||
33 | 1288 | >>> from six.moves.urllib.parse import quote | 1288 | >>> from urllib.parse import quote |
34 | 1289 | >>> from zope.component import provideAdapter | 1289 | >>> from zope.component import provideAdapter |
35 | 1290 | >>> from zope.traversing.browser.interfaces import IAbsoluteURL | 1290 | >>> from zope.traversing.browser.interfaces import IAbsoluteURL |
36 | 1291 | >>> from zope.publisher.interfaces.http import IHTTPApplicationRequest | 1291 | >>> from zope.publisher.interfaces.http import IHTTPApplicationRequest |
37 | diff --git a/src/lazr/restful/docs/webservice.rst b/src/lazr/restful/docs/webservice.rst | |||
38 | index 6397038..5289633 100644 | |||
39 | --- a/src/lazr/restful/docs/webservice.rst | |||
40 | +++ b/src/lazr/restful/docs/webservice.rst | |||
41 | @@ -114,7 +114,7 @@ interface, and the URL of an object is found by using the IAbsoluteURL | |||
42 | 114 | interface. | 114 | interface. |
43 | 115 | 115 | ||
44 | 116 | 116 | ||
46 | 117 | >>> from six.moves.urllib.parse import quote | 117 | >>> from urllib.parse import quote |
47 | 118 | >>> from zope.component import ( | 118 | >>> from zope.component import ( |
48 | 119 | ... adapter, getSiteManager, getMultiAdapter) | 119 | ... adapter, getSiteManager, getMultiAdapter) |
49 | 120 | >>> from zope.interface import implementer | 120 | >>> from zope.interface import implementer |
50 | @@ -201,7 +201,7 @@ interface. | |||
51 | 201 | 201 | ||
52 | 202 | >>> protect_schema(Cookbook, ICookbook, write_permission=CheckerPublic) | 202 | >>> protect_schema(Cookbook, ICookbook, write_permission=CheckerPublic) |
53 | 203 | 203 | ||
55 | 204 | >>> from six.moves.urllib.parse import unquote | 204 | >>> from urllib.parse import unquote |
56 | 205 | >>> @implementer(IPublishTraverse) | 205 | >>> @implementer(IPublishTraverse) |
57 | 206 | ... @adapter(ICookbook, IBrowserRequest) | 206 | ... @adapter(ICookbook, IBrowserRequest) |
58 | 207 | ... class CookbookTraversal: | 207 | ... class CookbookTraversal: |
59 | diff --git a/src/lazr/restful/example/base/tests/collection.txt b/src/lazr/restful/example/base/tests/collection.txt | |||
60 | index 08009ad..c2a47dc 100644 | |||
61 | --- a/src/lazr/restful/example/base/tests/collection.txt | |||
62 | +++ b/src/lazr/restful/example/base/tests/collection.txt | |||
63 | @@ -85,7 +85,7 @@ results in a 400 error. | |||
64 | 85 | 85 | ||
65 | 86 | A collection may be empty. | 86 | A collection may be empty. |
66 | 87 | 87 | ||
68 | 88 | >>> from six.moves.urllib.parse import quote | 88 | >>> from urllib.parse import quote |
69 | 89 | >>> url = quote("/cookbooks/Cooking Without Recipes/recipes") | 89 | >>> url = quote("/cookbooks/Cooking Without Recipes/recipes") |
70 | 90 | >>> result = webservice.get(url) | 90 | >>> result = webservice.get(url) |
71 | 91 | >>> list(result.jsonBody()['entries']) | 91 | >>> list(result.jsonBody()['entries']) |
72 | diff --git a/src/lazr/restful/example/base/tests/entry.txt b/src/lazr/restful/example/base/tests/entry.txt | |||
73 | index ba48787..c260361 100644 | |||
74 | --- a/src/lazr/restful/example/base/tests/entry.txt | |||
75 | +++ b/src/lazr/restful/example/base/tests/entry.txt | |||
76 | @@ -22,7 +22,7 @@ GET request to the entry's URL. | |||
77 | 22 | 22 | ||
78 | 23 | Here we see that the cookbook 'Everyday Greens' is a vegetarian cookbook. | 23 | Here we see that the cookbook 'Everyday Greens' is a vegetarian cookbook. |
79 | 24 | 24 | ||
81 | 25 | >>> from six.moves.urllib.parse import quote | 25 | >>> from urllib.parse import quote |
82 | 26 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 26 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
83 | 27 | >>> print(webservice.get(greens_url).jsonBody()['cuisine']) | 27 | >>> print(webservice.get(greens_url).jsonBody()['cuisine']) |
84 | 28 | Vegetarian | 28 | Vegetarian |
85 | diff --git a/src/lazr/restful/example/base/tests/field.txt b/src/lazr/restful/example/base/tests/field.txt | |||
86 | index aa09231..a1e51c7 100644 | |||
87 | --- a/src/lazr/restful/example/base/tests/field.txt | |||
88 | +++ b/src/lazr/restful/example/base/tests/field.txt | |||
89 | @@ -8,7 +8,7 @@ field resource itself, rather than PUT/PATCH to the entry. | |||
90 | 8 | >>> from lazr.restful.testing.webservice import WebServiceCaller | 8 | >>> from lazr.restful.testing.webservice import WebServiceCaller |
91 | 9 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') | 9 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') |
92 | 10 | 10 | ||
94 | 11 | >>> from six.moves.urllib.parse import quote | 11 | >>> from urllib.parse import quote |
95 | 12 | >>> cookbook_url = quote("/cookbooks/The Joy of Cooking") | 12 | >>> cookbook_url = quote("/cookbooks/The Joy of Cooking") |
96 | 13 | >>> field_url = cookbook_url + "/description" | 13 | >>> field_url = cookbook_url + "/description" |
97 | 14 | 14 | ||
98 | diff --git a/src/lazr/restful/example/base/tests/hostedfile.txt b/src/lazr/restful/example/base/tests/hostedfile.txt | |||
99 | index 4725646..53ff057 100644 | |||
100 | --- a/src/lazr/restful/example/base/tests/hostedfile.txt | |||
101 | +++ b/src/lazr/restful/example/base/tests/hostedfile.txt | |||
102 | @@ -15,7 +15,7 @@ File resources | |||
103 | 15 | 15 | ||
104 | 16 | A cookbook starts out with a link to a cover image, but no actual cover. | 16 | A cookbook starts out with a link to a cover image, but no actual cover. |
105 | 17 | 17 | ||
107 | 18 | >>> from six.moves.urllib.parse import quote | 18 | >>> from urllib.parse import quote |
108 | 19 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 19 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
109 | 20 | >>> greens = webservice.get(greens_url).jsonBody() | 20 | >>> greens = webservice.get(greens_url).jsonBody() |
110 | 21 | >>> print(greens['cover_link']) | 21 | >>> print(greens['cover_link']) |
111 | diff --git a/src/lazr/restful/example/base/tests/representation-cache.txt b/src/lazr/restful/example/base/tests/representation-cache.txt | |||
112 | index 7870eac..0b6a340 100644 | |||
113 | --- a/src/lazr/restful/example/base/tests/representation-cache.txt | |||
114 | +++ b/src/lazr/restful/example/base/tests/representation-cache.txt | |||
115 | @@ -211,7 +211,7 @@ POST did. | |||
116 | 211 | >>> print(list(dictionary.keys())[0]) | 211 | >>> print(list(dictionary.keys())[0]) |
117 | 212 | http://.../devel/cookbooks/Everyday%20Greens,application/json | 212 | http://.../devel/cookbooks/Everyday%20Greens,application/json |
118 | 213 | 213 | ||
120 | 214 | >>> from six.moves.urllib.parse import quote | 214 | >>> from urllib.parse import quote |
121 | 215 | >>> greens_url = quote("/cookbooks/Everyday Greens") | 215 | >>> greens_url = quote("/cookbooks/Everyday Greens") |
122 | 216 | >>> ignore = webservice.named_post( | 216 | >>> ignore = webservice.named_post( |
123 | 217 | ... greens_url, "replace_cover", cover="foo") | 217 | ... greens_url, "replace_cover", cover="foo") |
124 | diff --git a/src/lazr/restful/example/base/tests/service.txt b/src/lazr/restful/example/base/tests/service.txt | |||
125 | index dcaf6cf..67e7ac3 100644 | |||
126 | --- a/src/lazr/restful/example/base/tests/service.txt | |||
127 | +++ b/src/lazr/restful/example/base/tests/service.txt | |||
128 | @@ -59,7 +59,7 @@ resource yields a 405 error. | |||
129 | 59 | Allow: GET POST | 59 | Allow: GET POST |
130 | 60 | ... | 60 | ... |
131 | 61 | 61 | ||
133 | 62 | >>> from six.moves.urllib.parse import quote | 62 | >>> from urllib.parse import quote |
134 | 63 | >>> print(webservice.delete(quote("/dishes/Roast chicken"))) | 63 | >>> print(webservice.delete(quote("/dishes/Roast chicken"))) |
135 | 64 | HTTP/1.1 405 Method Not Allowed... | 64 | HTTP/1.1 405 Method Not Allowed... |
136 | 65 | Allow: GET PUT PATCH | 65 | Allow: GET PUT PATCH |
137 | diff --git a/src/lazr/restful/example/base/tests/wadl.txt b/src/lazr/restful/example/base/tests/wadl.txt | |||
138 | index e9ba3e9..47ea28f 100644 | |||
139 | --- a/src/lazr/restful/example/base/tests/wadl.txt | |||
140 | +++ b/src/lazr/restful/example/base/tests/wadl.txt | |||
141 | @@ -12,7 +12,7 @@ Entry resources | |||
142 | 12 | Let's get a WADL representation of an entry resource (in this case, a | 12 | Let's get a WADL representation of an entry resource (in this case, a |
143 | 13 | cookbook), and see what's inside. | 13 | cookbook), and see what's inside. |
144 | 14 | 14 | ||
146 | 15 | >>> from six.moves.urllib.parse import quote | 15 | >>> from urllib.parse import quote |
147 | 16 | >>> from lazr.restful.testing.webservice import WebServiceCaller | 16 | >>> from lazr.restful.testing.webservice import WebServiceCaller |
148 | 17 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') | 17 | >>> webservice = WebServiceCaller(domain='cookbooks.dev') |
149 | 18 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") | 18 | >>> entry_url = quote("/cookbooks/The Joy of Cooking") |
150 | diff --git a/src/lazr/restful/example/base/traversal.py b/src/lazr/restful/example/base/traversal.py | |||
151 | index 4ae07a9..a48f346 100644 | |||
152 | --- a/src/lazr/restful/example/base/traversal.py | |||
153 | +++ b/src/lazr/restful/example/base/traversal.py | |||
154 | @@ -9,11 +9,11 @@ __all__ = [ | |||
155 | 9 | "TraverseWithGet", | 9 | "TraverseWithGet", |
156 | 10 | ] | 10 | ] |
157 | 11 | 11 | ||
160 | 12 | 12 | from urllib.parse import ( | |
159 | 13 | from six.moves.urllib.parse import ( | ||
161 | 14 | unquote, | 13 | unquote, |
162 | 15 | urlparse, | 14 | urlparse, |
163 | 16 | ) | 15 | ) |
164 | 16 | |||
165 | 17 | from zope.component import getUtility | 17 | from zope.component import getUtility |
166 | 18 | from zope.publisher.interfaces import IPublishTraverse, NotFound | 18 | from zope.publisher.interfaces import IPublishTraverse, NotFound |
167 | 19 | from zope.publisher.interfaces.browser import IDefaultBrowserLayer | 19 | from zope.publisher.interfaces.browser import IDefaultBrowserLayer |
168 | diff --git a/src/lazr/restful/marshallers.py b/src/lazr/restful/marshallers.py | |||
169 | index 3439106..20f6f9e 100644 | |||
170 | --- a/src/lazr/restful/marshallers.py | |||
171 | +++ b/src/lazr/restful/marshallers.py | |||
172 | @@ -25,10 +25,10 @@ from collections import OrderedDict | |||
173 | 25 | from datetime import datetime | 25 | from datetime import datetime |
174 | 26 | from io import BytesIO | 26 | from io import BytesIO |
175 | 27 | import re | 27 | import re |
176 | 28 | from urllib.parse import unquote | ||
177 | 28 | 29 | ||
178 | 29 | import pytz | 30 | import pytz |
179 | 30 | import simplejson | 31 | import simplejson |
180 | 31 | from six.moves.urllib.parse import unquote | ||
181 | 32 | 32 | ||
182 | 33 | from zope.datetime import ( | 33 | from zope.datetime import ( |
183 | 34 | DateTimeError, | 34 | DateTimeError, |
184 | diff --git a/src/lazr/restful/publisher.py b/src/lazr/restful/publisher.py | |||
185 | index 92b668a..67e4ea0 100644 | |||
186 | --- a/src/lazr/restful/publisher.py | |||
187 | +++ b/src/lazr/restful/publisher.py | |||
188 | @@ -12,13 +12,13 @@ __all__ = [ | |||
189 | 12 | "WebServiceRequestTraversal", | 12 | "WebServiceRequestTraversal", |
190 | 13 | ] | 13 | ] |
191 | 14 | 14 | ||
195 | 15 | 15 | from urllib.parse import ( | |
193 | 16 | import simplejson | ||
194 | 17 | from six.moves.urllib.parse import ( | ||
196 | 18 | quote, | 16 | quote, |
197 | 19 | urlsplit, | 17 | urlsplit, |
198 | 20 | urlunsplit, | 18 | urlunsplit, |
199 | 21 | ) | 19 | ) |
200 | 20 | |||
201 | 21 | import simplejson | ||
202 | 22 | from zope.component import ( | 22 | from zope.component import ( |
203 | 23 | adapter, | 23 | adapter, |
204 | 24 | getMultiAdapter, | 24 | getMultiAdapter, |
205 | diff --git a/src/lazr/restful/simple.py b/src/lazr/restful/simple.py | |||
206 | index 2c58320..3a2b271 100644 | |||
207 | --- a/src/lazr/restful/simple.py | |||
208 | +++ b/src/lazr/restful/simple.py | |||
209 | @@ -16,11 +16,11 @@ __all__ = [ | |||
210 | 16 | ] | 16 | ] |
211 | 17 | 17 | ||
212 | 18 | import traceback | 18 | import traceback |
215 | 19 | 19 | from urllib.parse import ( | |
214 | 20 | from six.moves.urllib.parse import ( | ||
216 | 21 | quote, | 20 | quote, |
217 | 22 | unquote, | 21 | unquote, |
218 | 23 | ) | 22 | ) |
219 | 23 | |||
220 | 24 | from zope.component import ( | 24 | from zope.component import ( |
221 | 25 | adapter, | 25 | adapter, |
222 | 26 | getMultiAdapter, | 26 | getMultiAdapter, |
223 | diff --git a/src/lazr/restful/tales.py b/src/lazr/restful/tales.py | |||
224 | index 0be2185..6b975fe 100644 | |||
225 | --- a/src/lazr/restful/tales.py | |||
226 | +++ b/src/lazr/restful/tales.py | |||
227 | @@ -30,6 +30,7 @@ import operator | |||
228 | 30 | import re | 30 | import re |
229 | 31 | import simplejson | 31 | import simplejson |
230 | 32 | import textwrap | 32 | import textwrap |
231 | 33 | from urllib.parse import quote | ||
232 | 33 | 34 | ||
233 | 34 | from docutils import io | 35 | from docutils import io |
234 | 35 | from docutils.core import Publisher | 36 | from docutils.core import Publisher |
235 | @@ -45,7 +46,6 @@ from docutils.writers.html4css1 import ( | |||
236 | 45 | Writer as HTMLWriter, | 46 | Writer as HTMLWriter, |
237 | 46 | ) | 47 | ) |
238 | 47 | from docutils.writers.null import Writer as NullWriter | 48 | from docutils.writers.null import Writer as NullWriter |
239 | 48 | from six.moves.urllib.parse import quote | ||
240 | 49 | from zope.component import ( | 49 | from zope.component import ( |
241 | 50 | adapter, | 50 | adapter, |
242 | 51 | getGlobalSiteManager, | 51 | getGlobalSiteManager, |
243 | diff --git a/src/lazr/restful/testing/webservice.py b/src/lazr/restful/testing/webservice.py | |||
244 | index 148fd4c..85e8ba6 100644 | |||
245 | --- a/src/lazr/restful/testing/webservice.py | |||
246 | +++ b/src/lazr/restful/testing/webservice.py | |||
247 | @@ -27,14 +27,14 @@ import simplejson | |||
248 | 27 | import sys | 27 | import sys |
249 | 28 | from types import ModuleType | 28 | from types import ModuleType |
250 | 29 | import unittest | 29 | import unittest |
251 | 30 | from urllib.parse import ( | ||
252 | 31 | quote, | ||
253 | 32 | urljoin, | ||
254 | 33 | ) | ||
255 | 30 | 34 | ||
256 | 31 | import wsgi_intercept | 35 | import wsgi_intercept |
257 | 32 | 36 | ||
258 | 33 | import six | 37 | import six |
259 | 34 | from six.moves.urllib.parse import ( | ||
260 | 35 | quote, | ||
261 | 36 | urljoin, | ||
262 | 37 | ) | ||
263 | 38 | from zope.component import adapter, getGlobalSiteManager, getUtility | 38 | from zope.component import adapter, getGlobalSiteManager, getUtility |
264 | 39 | from zope.configuration import xmlconfig | 39 | from zope.configuration import xmlconfig |
265 | 40 | from zope.interface import alsoProvides, implementer, Interface | 40 | from zope.interface import alsoProvides, implementer, Interface |
LGTM