Merge lp:~nataliabidart/magicicada-protocol/update-copyright-headers into lp:magicicada-protocol

Proposed by Natalia Bidart on 2018-04-08
Status: Merged
Approved by: Natalia Bidart on 2018-04-08
Approved revision: 170
Merged at revision: 170
Proposed branch: lp:~nataliabidart/magicicada-protocol/update-copyright-headers
Merge into: lp:magicicada-protocol
Diff against target: 1468 lines (+175/-254)
36 files modified
run-tests (+2/-2)
samples/easy_client.py (+12/-14)
samples/ping_client.py (+4/-7)
ubuntuone/__init__.py (+5/-2)
ubuntuone/storageprotocol/__init__.py (+3/-1)
ubuntuone/storageprotocol/client.py (+5/-13)
ubuntuone/storageprotocol/content_hash.py (+3/-4)
ubuntuone/storageprotocol/context.py (+5/-4)
ubuntuone/storageprotocol/delta.py (+8/-9)
ubuntuone/storageprotocol/dircontent.proto (+1/-2)
ubuntuone/storageprotocol/dircontent.py (+3/-6)
ubuntuone/storageprotocol/errors.py (+4/-5)
ubuntuone/storageprotocol/protocol.proto (+1/-1)
ubuntuone/storageprotocol/proxy_tunnel.py (+9/-10)
ubuntuone/storageprotocol/public_file_info.py (+3/-1)
ubuntuone/storageprotocol/request.py (+9/-18)
ubuntuone/storageprotocol/sharersp.py (+3/-7)
ubuntuone/storageprotocol/tests/__init__.py (+3/-3)
ubuntuone/storageprotocol/tests/test_bytesproducer.py (+5/-7)
ubuntuone/storageprotocol/tests/test_client.py (+7/-11)
ubuntuone/storageprotocol/tests/test_context.py (+15/-10)
ubuntuone/storageprotocol/tests/test_delta_info.py (+2/-2)
ubuntuone/storageprotocol/tests/test_dircontent.py (+3/-4)
ubuntuone/storageprotocol/tests/test_errors.py (+7/-13)
ubuntuone/storageprotocol/tests/test_hashes.py (+4/-13)
ubuntuone/storageprotocol/tests/test_proxy_tunnel.py (+7/-15)
ubuntuone/storageprotocol/tests/test_public_file_info.py (+2/-2)
ubuntuone/storageprotocol/tests/test_putcontent.py (+4/-6)
ubuntuone/storageprotocol/tests/test_query.py (+7/-10)
ubuntuone/storageprotocol/tests/test_request.py (+5/-11)
ubuntuone/storageprotocol/tests/test_sharersp.py (+5/-5)
ubuntuone/storageprotocol/tests/test_throttling.py (+5/-8)
ubuntuone/storageprotocol/tests/test_volumes.py (+3/-14)
ubuntuone/storageprotocol/utils.py (+3/-3)
ubuntuone/storageprotocol/validators.py (+6/-7)
ubuntuone/storageprotocol/volumes.py (+2/-4)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-protocol/update-copyright-headers
Reviewer Review Type Date Requested Status
Natalia Bidart Approve on 2018-04-08
Review via email: mp+342841@code.launchpad.net

Commit message

- Added proper copyright notices and coding headers.

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Trivial.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests'
2--- run-tests 2016-09-18 23:26:42 +0000
3+++ run-tests 2018-04-08 19:37:28 +0000
4@@ -21,11 +21,11 @@
5
6 /usr/bin/env python setup.py build
7 # run the tests with pure python protobuf
8-SSL_CERTIFICATES_DIR=tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial tests
9+SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python u1trial ubuntuone/storageprotocol/tests
10 if [ "$SYSNAME" != "Darwin" ]; then
11 # and with the cpp extension, for server (linux) only:
12 if [ $PROTOC_VERSION_AS_INT -lt 2500 ]; then
13- SSL_CERTIFICATES_DIR=tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial tests
14+ SSL_CERTIFICATES_DIR=ubuntuone/storageprotocol/tests/certs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp u1trial ubuntuone/storageprotocol/tests
15 fi
16 fi
17
18
19=== modified file 'samples/easy_client.py'
20--- samples/easy_client.py 2016-09-19 02:00:32 +0000
21+++ samples/easy_client.py 2018-04-08 19:37:28 +0000
22@@ -1,8 +1,7 @@
23-# ubuntuone.storageprotocol.samples.easy_client - a simple client
24-#
25-# Author: Lucio Torre <lucio.torre@canonical.com>
26+# -*- coding: utf-8 -*-
27 #
28 # Copyright 2009-2012 Canonical Ltd.
29+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
30 #
31 # This program is free software: you can redistribute it and/or modify it
32 # under the terms of the GNU Affero General Public License version 3,
33@@ -28,8 +27,9 @@
34 # do not wish to do so, delete this exception statement from your
35 # version. If you delete this exception statement from all source
36 # files in the program, then also delete it here.
37-"""A simple client with some tests
38-"""
39+
40+"""A simple client with some tests."""
41+
42 import os
43 import time
44 import math
45@@ -41,8 +41,8 @@
46 from ubuntuone.storageprotocol.client import (
47 StorageClientFactory, StorageClient)
48 from ubuntuone.storageprotocol import request, protocol_pb2
49-from ubuntuone.storageprotocol.dircontent_pb2 import \
50- DirectoryContent, DIRECTORY
51+from ubuntuone.storageprotocol.dircontent_pb2 import (
52+ DirectoryContent, DIRECTORY)
53
54
55 class NotDirectory(Exception):
56@@ -51,8 +51,7 @@
57
58 def delay_time(step):
59 """generates a delay for each step"""
60- return (((math.exp(step) - 1) / 10) /
61- (1 + random.random()))
62+ return ((math.exp(step) - 1) / 10) / (1 + random.random())
63
64
65 def retry(function):
66@@ -91,7 +90,6 @@
67
68 def connectionMade(self):
69 """Setup and call callback."""
70- # pylint: disable=W0201
71 StorageClient.connectionMade(self)
72 self.factory.clientConnectionMade(self)
73
74@@ -158,15 +156,15 @@
75 def mkfile(self, name):
76 """make a file named name in cwd."""
77 d = self.get_cwd_id()
78- d.addCallback(lambda _:
79- self.make_file(request.ROOT, self.cwd_id, name))
80+ d.addCallback(
81+ lambda _: self.make_file(request.ROOT, self.cwd_id, name))
82 return d
83
84 def mkdir(self, name):
85 """make a dir named name in cwd."""
86 d = self.get_cwd_id()
87- d.addCallback(lambda _:
88- self.make_dir(request.ROOT, self.cwd_id, name))
89+ d.addCallback(
90+ lambda _: self.make_dir(request.ROOT, self.cwd_id, name))
91 return d
92
93 def put(self, name, content):
94
95=== modified file 'samples/ping_client.py'
96--- samples/ping_client.py 2016-09-19 02:00:32 +0000
97+++ samples/ping_client.py 2018-04-08 19:37:28 +0000
98@@ -1,8 +1,7 @@
99-# ubuntuone.storageprotocol.samples.ping_client - a ping client
100-#
101-# Author: Lucio Torre <lucio.torre@canonical.com>
102+# -*- coding: utf-8 -*-
103 #
104 # Copyright 2009-2012 Canonical Ltd.
105+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
106 #
107 # This program is free software: you can redistribute it and/or modify it
108 # under the terms of the GNU Affero General Public License version 3,
109@@ -28,8 +27,8 @@
110 # do not wish to do so, delete this exception statement from your
111 # version. If you delete this exception statement from all source
112 # files in the program, then also delete it here.
113-"""A simple ping client
114-"""
115+
116+"""A simple ping client."""
117
118 from twisted.internet import reactor
119
120@@ -42,7 +41,6 @@
121
122 def connectionMade(self):
123 """Setup and call callback."""
124- # pylint: disable=W0201
125 StorageClient.connectionMade(self)
126 print "Connection made."
127 d = self.ping()
128@@ -63,7 +61,6 @@
129
130 class PingClientFactory(StorageClientFactory):
131 """A test oriented protocol factory."""
132- # no init: pylint: disable=W0232
133
134 protocol = PingClient
135
136
137=== modified file 'ubuntuone/__init__.py'
138--- ubuntuone/__init__.py 2012-03-29 20:28:09 +0000
139+++ ubuntuone/__init__.py 2018-04-08 19:37:28 +0000
140@@ -1,6 +1,7 @@
141-# __init__.py
142+# -*- coding: utf-8 -*-
143 #
144 # Copyright 2009-2012 Canonical Ltd.
145+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
146 #
147 # This program is free software: you can redistribute it and/or modify it
148 # under the terms of the GNU Affero General Public License version 3,
149@@ -26,5 +27,7 @@
150 # do not wish to do so, delete this exception statement from your
151 # version. If you delete this exception statement from all source
152 # files in the program, then also delete it here.
153-"""ubuntuone package"""
154+
155+"""ubuntuone package."""
156+
157 __import__('pkg_resources').declare_namespace(__name__)
158
159=== modified file 'ubuntuone/storageprotocol/__init__.py'
160--- ubuntuone/storageprotocol/__init__.py 2012-03-29 20:28:09 +0000
161+++ ubuntuone/storageprotocol/__init__.py 2018-04-08 19:37:28 +0000
162@@ -1,6 +1,7 @@
163-# __init__.py
164+# -*- coding: utf-8 -*-
165 #
166 # Copyright 2009-2012 Canonical Ltd.
167+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
168 #
169 # This program is free software: you can redistribute it and/or modify it
170 # under the terms of the GNU Affero General Public License version 3,
171@@ -26,4 +27,5 @@
172 # do not wish to do so, delete this exception statement from your
173 # version. If you delete this exception statement from all source
174 # files in the program, then also delete it here.
175+
176 """ubuntuone.storageprotocol package."""
177
178=== modified file 'ubuntuone/storageprotocol/client.py'
179--- ubuntuone/storageprotocol/client.py 2016-11-15 23:37:49 +0000
180+++ ubuntuone/storageprotocol/client.py 2018-04-08 19:37:28 +0000
181@@ -1,5 +1,7 @@
182+# -*- coding: utf-8 -*-
183+#
184 # Copyright 2009-2015 Canonical Ltd.
185-# Copyright 2016 Chicharreros (https://launchpad.net/~chicharreros)
186+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
187 #
188 # This program is free software: you can redistribute it and/or modify it
189 # under the terms of the GNU Affero General Public License version 3,
190@@ -616,7 +618,6 @@
191
192 def processMessage(self, message):
193 """Process messages."""
194- # pylint: disable=W0201
195 if message.type == protocol_pb2.Message.NODE_ATTR:
196 if self.node_attr_callback is not None:
197 self.node_attr_callback(
198@@ -667,7 +668,6 @@
199
200 def _start(self):
201 """Send the LIST_SHARES message to the server."""
202- # pylint: disable=W0201
203 message = protocol_pb2.Message()
204 message.type = protocol_pb2.Message.LIST_SHARES
205 self.sendMessage(message)
206@@ -935,7 +935,6 @@
207
208 @ivar new_generation: the generation that the volume is at now
209 """
210- # pylint: disable=C0111
211
212 __slots__ = ('share', 'node', 'new_generation')
213
214@@ -1361,7 +1360,6 @@
215
216 def processMessage(self, message):
217 """Handle messages."""
218- # pylint: disable=W0201
219 if message.type == self.create_response:
220 self.new_id = message.new.node
221 self.new_parent_id = message.new.parent_node
222@@ -1406,7 +1404,6 @@
223
224 def processMessage(self, message):
225 """Handle messages."""
226- # pylint: disable=W0201
227 if message.type == protocol_pb2.Message.PROTOCOL_VERSION:
228 self.other_protocol_version = message.protocol.version
229 self.done()
230@@ -1520,7 +1517,6 @@
231
232 def _start(self):
233 """Send the FREE_SPACE_INQUIRY message to the server."""
234- # pylint: disable=W0201
235 message = protocol_pb2.Message()
236 message.type = protocol_pb2.Message.FREE_SPACE_INQUIRY
237 message.free_space_inquiry.share_id = self.share_id
238@@ -1529,7 +1525,6 @@
239
240 def processMessage(self, message):
241 """Process the answer from the server."""
242- # pylint: disable=W0201
243 if message.type == protocol_pb2.Message.FREE_SPACE_INFO:
244 self.free_bytes = message.free_space_info.free_bytes
245 self.done()
246@@ -1544,7 +1539,6 @@
247
248 def _start(self):
249 """Send the FREE_SPACE_INQUIRY message to the server."""
250- # pylint: disable=W0201
251 message = protocol_pb2.Message()
252 message.type = protocol_pb2.Message.ACCOUNT_INQUIRY
253 self.sendMessage(message)
254@@ -1552,7 +1546,6 @@
255
256 def processMessage(self, message):
257 """Process the answer from the server."""
258- # pylint: disable=W0201
259 if message.type == protocol_pb2.Message.ACCOUNT_INFO:
260 self.purchased_bytes = message.account_info.purchased_bytes
261 self.done()
262@@ -1682,7 +1675,7 @@
263
264 class StorageClientFactory(ClientFactory):
265 """StorageClient factory."""
266- # pylint: disable=W0232
267+
268 protocol = StorageClient
269
270
271@@ -1735,10 +1728,9 @@
272 if not self.valid_limit(limit):
273 raise ValueError('Read limit must be greater than 0.')
274 self._readLimit = limit
275- # it's a property, pylint: disable=W0212
276+
277 readLimit = property(lambda self: self._readLimit, _set_read_limit)
278 writeLimit = property(lambda self: self._writeLimit, _set_write_limit)
279- # pylint: enable=W0212
280
281 def callLater(self, period, func, *args, **kwargs):
282 """Wrapper around L{reactor.callLater} for test purpose."""
283
284=== modified file 'ubuntuone/storageprotocol/content_hash.py'
285--- ubuntuone/storageprotocol/content_hash.py 2016-09-19 02:00:32 +0000
286+++ ubuntuone/storageprotocol/content_hash.py 2018-04-08 19:37:28 +0000
287@@ -1,9 +1,7 @@
288-# ubuntuone.storageprotocol.content_hash - content hash handling
289-#
290-# Author: Lucio Torre <lucio.torre@canonical.com>
291-# Natalia B. Bidart <natalia.bidart@canonical.com>
292+# -*- coding: utf-8 -*-
293 #
294 # Copyright 2009-2012 Canonical Ltd.
295+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
296 #
297 # This program is free software: you can redistribute it and/or modify it
298 # under the terms of the GNU Affero General Public License version 3,
299@@ -29,6 +27,7 @@
300 # do not wish to do so, delete this exception statement from your
301 # version. If you delete this exception statement from all source
302 # files in the program, then also delete it here.
303+
304 """Hash Handling Stuffs."""
305
306 import copy
307
308=== modified file 'ubuntuone/storageprotocol/context.py'
309--- ubuntuone/storageprotocol/context.py 2015-07-17 12:59:41 +0000
310+++ ubuntuone/storageprotocol/context.py 2018-04-08 19:37:28 +0000
311@@ -1,6 +1,7 @@
312-# ubuntuone.storageprotocol.context - ssl context creation
313+# -*- coding: utf-8 -*-
314 #
315 # Copyright 2009-2015 Canonical Ltd.
316+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
317 #
318 # This program is free software: you can redistribute it and/or modify it
319 # under the terms of the GNU Affero General Public License version 3,
320@@ -26,9 +27,9 @@
321 # do not wish to do so, delete this exception statement from your
322 # version. If you delete this exception statement from all source
323 # files in the program, then also delete it here.
324-"""
325-Standard Routines for working with ssl context creation
326-"""
327+
328+"""Standard Routines for working with ssl context creation."""
329+
330 import os
331
332 from OpenSSL import SSL
333
334=== modified file 'ubuntuone/storageprotocol/delta.py'
335--- ubuntuone/storageprotocol/delta.py 2012-12-03 19:45:43 +0000
336+++ ubuntuone/storageprotocol/delta.py 2018-04-08 19:37:28 +0000
337@@ -1,8 +1,7 @@
338-# ubuntuone.storageprotocol.delta - delta nodes wrappers
339-#
340-# Author: Lucio Torre <lucio.torre@canonical.com>
341+# -*- coding: utf-8 -*-
342 #
343 # Copyright 2009-2012 Canonical Ltd.
344+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
345 #
346 # This program is free software: you can redistribute it and/or modify it
347 # under the terms of the GNU Affero General Public License version 3,
348@@ -28,18 +27,18 @@
349 # do not wish to do so, delete this exception statement from your
350 # version. If you delete this exception statement from all source
351 # files in the program, then also delete it here.
352-"""
353-Provides wrapper classes for delta nodes messages
354-"""
355+
356+"""Provides wrapper classes for delta nodes messages."""
357
358 from ubuntuone.storageprotocol import protocol_pb2
359
360 FILE = 0
361 DIRECTORY = 1
362
363-file_type_registry = {protocol_pb2.FileInfo.FILE: FILE,
364- protocol_pb2.FileInfo.DIRECTORY: DIRECTORY,
365- }
366+file_type_registry = {
367+ protocol_pb2.FileInfo.FILE: FILE,
368+ protocol_pb2.FileInfo.DIRECTORY: DIRECTORY,
369+}
370
371
372 class FileInfoDelta(object):
373
374=== modified file 'ubuntuone/storageprotocol/dircontent.proto'
375--- ubuntuone/storageprotocol/dircontent.proto 2012-03-29 20:28:09 +0000
376+++ ubuntuone/storageprotocol/dircontent.proto 2018-04-08 19:37:28 +0000
377@@ -1,7 +1,6 @@
378 /*
379- ubuntuone.storageprotocol.dircontent_pb2 - dircontent protocol
380-
381 Copyright 2009-2012 Canonical Ltd.
382+ Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
383
384 This program is free software: you can redistribute it and/or modify it
385 under the terms of the GNU Affero General Public License version 3,
386
387=== modified file 'ubuntuone/storageprotocol/dircontent.py'
388--- ubuntuone/storageprotocol/dircontent.py 2013-05-21 17:22:58 +0000
389+++ ubuntuone/storageprotocol/dircontent.py 2018-04-08 19:37:28 +0000
390@@ -1,8 +1,7 @@
391-# ubuntuone.storageprotocol.dircontent - directory content handling
392-#
393-# Author: Tim Cole <tim.cole@canonical.com>
394+# -*- coding: utf-8 -*-
395 #
396 # Copyright 2009-2012 Canonical Ltd.
397+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
398 #
399 # This program is free software: you can redistribute it and/or modify it
400 # under the terms of the GNU Affero General Public License version 3,
401@@ -28,10 +27,8 @@
402 # do not wish to do so, delete this exception statement from your
403 # version. If you delete this exception statement from all source
404 # files in the program, then also delete it here.
405-"""
406-Standard routines for working with directory content.
407
408-"""
409+"""Standard routines for working with directory content."""
410
411 import re
412 from ubuntuone.storageprotocol.dircontent_pb2 import DirectoryContent
413
414=== modified file 'ubuntuone/storageprotocol/errors.py'
415--- ubuntuone/storageprotocol/errors.py 2012-12-03 19:45:43 +0000
416+++ ubuntuone/storageprotocol/errors.py 2018-04-08 19:37:28 +0000
417@@ -1,8 +1,7 @@
418 # -*- coding: utf-8 -*-
419 #
420-# Author: Natalia B. Bidart <natalia.bidart@canonical.com>
421-#
422 # Copyright 2010-2012 Canonical Ltd.
423+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
424 #
425 # This program is free software: you can redistribute it and/or modify it
426 # under the terms of the GNU Affero General Public License version 3,
427@@ -28,6 +27,7 @@
428 # do not wish to do so, delete this exception statement from your
429 # version. If you delete this exception statement from all source
430 # files in the program, then also delete it here.
431+
432 """The errors abstraction."""
433
434 import uuid
435@@ -56,9 +56,8 @@
436 @param request: the request that generated this error.
437 @param message: the message received that generated the error.
438 """
439- error_name = protocol_pb2.Error.DESCRIPTOR \
440- .enum_types_by_name['ErrorType'] \
441- .values_by_number[message.error.type].name
442+ error_name = protocol_pb2.Error.DESCRIPTOR.enum_types_by_name[
443+ 'ErrorType'].values_by_number[message.error.type].name
444 super(StorageRequestError, self).__init__(error_name)
445 #: the request that generated the error
446 self.request = request
447
448=== modified file 'ubuntuone/storageprotocol/protocol.proto'
449--- ubuntuone/storageprotocol/protocol.proto 2016-11-07 01:11:29 +0000
450+++ ubuntuone/storageprotocol/protocol.proto 2018-04-08 19:37:28 +0000
451@@ -1,6 +1,6 @@
452 /*
453 Copyright 2009-2012 Canonical Ltd.
454- Copyright 2016 Chicharreros (https://launchpad.net/~chicharreros)
455+ Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
456
457 This program is free software: you can redistribute it and/or modify it
458 under the terms of the GNU Affero General Public License version 3,
459
460=== modified file 'ubuntuone/storageprotocol/proxy_tunnel.py'
461--- ubuntuone/storageprotocol/proxy_tunnel.py 2012-03-29 20:28:09 +0000
462+++ ubuntuone/storageprotocol/proxy_tunnel.py 2018-04-08 19:37:28 +0000
463@@ -1,8 +1,7 @@
464-# ubuntuone.storageprotocol.proxy_tunnel - tunnel through proxies
465-#
466-# Author: Lucio Torre <lucio.torre@canonical.com>
467+# -*- coding: utf-8 -*-
468 #
469 # Copyright 2009-2012 Canonical Ltd.
470+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
471 #
472 # This program is free software: you can redistribute it and/or modify it
473 # under the terms of the GNU Affero General Public License version 3,
474@@ -28,7 +27,9 @@
475 # do not wish to do so, delete this exception statement from your
476 # version. If you delete this exception statement from all source
477 # files in the program, then also delete it here.
478-"""Proxy tunelling"""
479+
480+"""Proxy tunelling."""
481+
482 import base64
483
484 from twisted.internet.protocol import Protocol, ClientFactory, connectionDone
485@@ -70,9 +71,8 @@
486 self.client_protocol = None
487 self.__buffer = ""
488 # send request
489- line = "CONNECT %s:%s HTTP/1.0\r\n" % \
490- (self.factory.host, self.factory.port)
491- self.transport.write(line)
492+ line = "CONNECT %s:%s HTTP/1.0\r\n"
493+ self.transport.write(line % (self.factory.host, self.factory.port))
494 # send headers
495 self.sendHeader("Host", self.factory.host)
496 # do auth
497@@ -112,7 +112,6 @@
498 """Received a line."""
499 if line:
500 parts = line.split(" ", 2)
501- # pylint: disable=W0612
502 version, status = parts[:2]
503 if len(parts) == 3:
504 message = parts[2]
505@@ -150,8 +149,8 @@
506
507 def clientConnectionFailed(self, connector, reason):
508 """Proxy client connection failed."""
509- self.factory.clientConnectionFailed(connector,
510- "Proxy connection error: %s" % (str(reason)))
511+ self.factory.clientConnectionFailed(
512+ connector, "Proxy connection error: %s" % (str(reason)))
513
514
515 def connectHTTPS(proxy_host, proxy_port, host, port, factory,
516
517=== modified file 'ubuntuone/storageprotocol/public_file_info.py'
518--- ubuntuone/storageprotocol/public_file_info.py 2016-11-07 01:11:29 +0000
519+++ ubuntuone/storageprotocol/public_file_info.py 2018-04-08 19:37:28 +0000
520@@ -1,4 +1,6 @@
521-# Copyright 2016 Chicharreros (https://launchpad.net/~chicharreros)
522+# -*- coding: utf-8 -*-
523+#
524+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
525 #
526 # This program is free software: you can redistribute it and/or modify it
527 # under the terms of the GNU Affero General Public License version 3,
528
529=== modified file 'ubuntuone/storageprotocol/request.py'
530--- ubuntuone/storageprotocol/request.py 2016-09-19 02:00:32 +0000
531+++ ubuntuone/storageprotocol/request.py 2018-04-08 19:37:28 +0000
532@@ -1,9 +1,7 @@
533-# ubuntuone.storageprotocol.request - base classes for
534-# network client and server
535-#
536-# Author: Lucio Torre <lucio.torre@canonical.com>
537+# -*- coding: utf-8 -*-
538 #
539 # Copyright 2009-2012 Canonical Ltd.
540+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
541 #
542 # This program is free software: you can redistribute it and/or modify it
543 # under the terms of the GNU Affero General Public License version 3,
544@@ -29,22 +27,20 @@
545 # do not wish to do so, delete this exception statement from your
546 # version. If you delete this exception statement from all source
547 # files in the program, then also delete it here.
548-"""
549-The base classes for the network client and server.
550+
551+"""The base classes for the network client and server.
552
553 This classes provide the message serialization, delivery, request
554 tracking and message handling.
555+
556 """
557
558-
559 import struct
560 import time
561
562 from twisted.internet.protocol import Protocol, connectionDone
563 from twisted.internet.interfaces import IPushProducer
564 from twisted.internet import defer
565-# pylint and zope dont work
566-# pylint: disable=E0611,F0401
567 from zope.interface import implements
568
569 from ubuntuone.storageprotocol import protocol_pb2, validators
570@@ -228,7 +224,7 @@
571 target = self.requests[message.id].processMessage
572 try:
573 result = target(message)
574- except Exception, e: # pylint: disable=W0703
575+ except Exception as e:
576 self.requests[message.id].error(e)
577 else:
578 name = protocol_pb2.Message.DESCRIPTOR \
579@@ -450,11 +446,10 @@
580 'error_errback' func.
581 """
582 def _f(*args, **kwargs):
583- '''Function to be called from twisted when its time arrives.'''
584+ """Function to be called from twisted when its time arrives."""
585 if self.cancelled:
586- raise RequestCancelledError("The request id=%d is cancelled! "
587- "(before calling %r)" %
588- (self.id, function))
589+ msg = "The request id=%d is cancelled! (before calling %r)"
590+ raise RequestCancelledError(msg % (self.id, function))
591 return function(*args, **kwargs)
592 return _f
593
594@@ -467,7 +462,6 @@
595
596 __slots__ = ('source_message',)
597
598- # pylint: disable=W0223
599 def __init__(self, protocol, message):
600 """Create a request response.
601
602@@ -493,7 +487,6 @@
603
604 def _start(self):
605 """start the request sending a ping message."""
606- # pylint: disable=W0201
607 self.rtt = 0
608 self._start_time = time.time()
609 message = protocol_pb2.Message()
610@@ -504,8 +497,6 @@
611 def processMessage(self, message):
612 """calculate rtt if message is pong, error otherwise"""
613 if message.type == protocol_pb2.Message.PONG:
614- # pylint: disable=W0201
615- # attributes are created in completion
616 self.rtt = time.time() - self._start_time
617 self.done()
618 else:
619
620=== modified file 'ubuntuone/storageprotocol/sharersp.py'
621--- ubuntuone/storageprotocol/sharersp.py 2012-03-29 20:28:09 +0000
622+++ ubuntuone/storageprotocol/sharersp.py 2018-04-08 19:37:28 +0000
623@@ -1,10 +1,7 @@
624-# ubuntuone.storageprotocol.sharersp.py -
625-# provides a handy class to use Shares
626-#
627-# Author: Facundo Batista <facundo@canonical.com>
628-# Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
629+# -*- coding: utf-8 -*-
630 #
631 # Copyright 2009-2012 Canonical Ltd.
632+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
633 #
634 # This program is free software: you can redistribute it and/or modify it
635 # under the terms of the GNU Affero General Public License version 3,
636@@ -30,13 +27,12 @@
637 # version. If you delete this exception statement from all source
638 # files in the program, then also delete it here.
639 # along with this program. If not, see <http://www.gnu.org/licenses/>.
640+
641 """A handy class to use Shares."""
642
643 import uuid
644
645 from ubuntuone.storageprotocol import volumes
646-# Disable this warning, as we define several things outside __init__ here
647-# pylint: disable=W0201
648
649
650 class ShareResponse(object):
651
652=== renamed directory 'tests' => 'ubuntuone/storageprotocol/tests'
653=== modified file 'ubuntuone/storageprotocol/tests/__init__.py'
654--- tests/__init__.py 2012-03-29 20:28:09 +0000
655+++ ubuntuone/storageprotocol/tests/__init__.py 2018-04-08 19:37:28 +0000
656@@ -1,6 +1,5 @@
657-# __init__.py
658-#
659 # Copyright 2009-2012 Canonical Ltd.
660+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
661 #
662 # This program is free software: you can redistribute it and/or modify it
663 # under the terms of the GNU Affero General Public License version 3,
664@@ -26,4 +25,5 @@
665 # do not wish to do so, delete this exception statement from your
666 # version. If you delete this exception statement from all source
667 # files in the program, then also delete it here.
668-"""Tests for ubuntuone.storageprotocol"""
669+
670+"""Tests for ubuntuone.storageprotocol."""
671
672=== modified file 'ubuntuone/storageprotocol/tests/test_bytesproducer.py'
673--- tests/test_bytesproducer.py 2012-03-29 20:28:09 +0000
674+++ ubuntuone/storageprotocol/tests/test_bytesproducer.py 2018-04-08 19:37:28 +0000
675@@ -1,9 +1,7 @@
676-# ubuntuone.storageprotocol.tests.test_bytesproducer -
677-# BytesMessageProducer tests
678-#
679-# Author: Facundo Batista <facundo@canonical.com>
680+# -*- coding: utf-8 -*-
681 #
682 # Copyright (C) 2009-2012 Canonical Ltd.
683+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
684 #
685 # This program is free software: you can redistribute it and/or modify it
686 # under the terms of the GNU Affero General Public License version 3,
687@@ -29,6 +27,7 @@
688 # do not wish to do so, delete this exception statement from your
689 # version. If you delete this exception statement from all source
690 # files in the program, then also delete it here.
691+
692 """Tests for directory content serialization/unserialization."""
693
694 from __future__ import with_statement
695@@ -52,9 +51,8 @@
696
697 def sendMessage(self, message):
698 """Store the message in own list."""
699- name = protocol_pb2.Message.DESCRIPTOR \
700- .enum_types_by_name['MessageType'] \
701- .values_by_number[message.type].name
702+ name = protocol_pb2.Message.DESCRIPTOR.enum_types_by_name[
703+ 'MessageType'].values_by_number[message.type].name
704 self.messages.append(name)
705
706
707
708=== modified file 'ubuntuone/storageprotocol/tests/test_client.py'
709--- tests/test_client.py 2016-11-07 01:11:29 +0000
710+++ ubuntuone/storageprotocol/tests/test_client.py 2018-04-08 19:37:28 +0000
711@@ -1,5 +1,5 @@
712 # -*- coding: utf-8 -*-
713-
714+#
715 # Copyright 2009-2015 Canonical Ltd.
716 # Copyright 2016 Chicharreros (https://launchpad.net/~chicharreros)
717 #
718@@ -61,12 +61,8 @@
719 )
720
721 from ubuntuone.storageprotocol import volumes
722-from tests import test_delta_info
723+from ubuntuone.storageprotocol.tests import test_delta_info
724
725-# let's not get picky about aatributes outside __init__ in tests
726-# pylint: disable=W0201
727-# it's ok to access internals in the test suite
728-# pylint: disable=W0212
729
730 PATH = u'~/Documents/pdfs/moño/'
731 NAME = u'UDF-me'
732@@ -217,7 +213,7 @@
733 try:
734 result = self.client.get_delta(share_id=SHARE, from_generation=0)
735 self.assertTrue(self.called, 'GetDelta.start() was called')
736- self.assertTrue(isinstance(result, Deferred))
737+ self.assertIsInstance(result, Deferred)
738 finally:
739 GetDelta.start = original
740
741@@ -229,7 +225,7 @@
742 try:
743 result = self.client.get_delta(share_id=SHARE, from_scratch=True)
744 self.assertTrue(self.called, 'GetDelta.start() was called')
745- self.assertTrue(isinstance(result, Deferred))
746+ self.assertIsInstance(result, Deferred)
747 finally:
748 GetDelta.start = original
749
750@@ -247,7 +243,7 @@
751 try:
752 result = self.client.create_udf(path=PATH, name=NAME)
753 self.assertTrue(self.called, 'CreateUDF.start() was called')
754- self.assertTrue(isinstance(result, Deferred))
755+ self.assertIsInstance(result, Deferred)
756 finally:
757 CreateUDF.start = original
758
759@@ -259,7 +255,7 @@
760 try:
761 result = self.client.list_volumes()
762 self.assertTrue(self.called, 'ListVolumes.start() was called')
763- self.assertTrue(isinstance(result, Deferred))
764+ self.assertIsInstance(result, Deferred)
765 finally:
766 ListVolumes.start = original
767
768@@ -271,7 +267,7 @@
769 try:
770 result = self.client.delete_volume(volume_id=VOLUME)
771 self.assertTrue(self.called, 'DeleteVolume.start() was called')
772- self.assertTrue(isinstance(result, Deferred))
773+ self.assertIsInstance(result, Deferred)
774 finally:
775 DeleteVolume.start = original
776
777
778=== modified file 'ubuntuone/storageprotocol/tests/test_context.py'
779--- tests/test_context.py 2016-09-19 02:00:32 +0000
780+++ ubuntuone/storageprotocol/tests/test_context.py 2018-04-08 19:37:28 +0000
781@@ -1,6 +1,7 @@
782-# tests.test_context - test ssl context creation
783+# -*- coding: utf-8 -*-
784 #
785 # Copyright 2012-2015 Canonical Ltd.
786+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
787 #
788 # This program is free software: you can redistribute it and/or modify it
789 # under the terms of the GNU Affero General Public License version 3,
790@@ -87,7 +88,7 @@
791 request = crypto.X509Req()
792 request.get_subject().CN = common_name
793 request.set_pubkey(key)
794- request.sign(key, "md5")
795+ request.sign(key, "sha256")
796 return request
797
798 def _build_cert(self, request, ca_cert, ca_key):
799@@ -99,7 +100,7 @@
800 certificate.set_pubkey(request.get_pubkey())
801 certificate.gmtime_adj_notBefore(0)
802 certificate.gmtime_adj_notAfter(3600) # valid for one hour
803- certificate.sign(ca_key, "md5")
804+ certificate.sign(ca_key, "sha256")
805 return certificate
806
807
808@@ -127,6 +128,15 @@
809 self.assertEqual(result, "ok")
810
811 @defer.inlineCallbacks
812+ def assert_cert_failed_verify(self, server_context, client_context):
813+ d = self.verify_context(server_context, client_context)
814+ e = yield self.assertFailure(d, SSL.Error)
815+ self.assertEqual(len(e.message), 1)
816+ expected = ('SSL routines', 'ssl3_get_server_certificate',
817+ 'certificate verify failed')
818+ self.assertEqual(e.message[0], expected)
819+
820+ @defer.inlineCallbacks
821 def test_no_verify(self):
822 """Test the no_verify option."""
823 certs = FakeCerts(self, "localhost")
824@@ -151,9 +161,7 @@
825 client_context = context.get_ssl_context(no_verify=False,
826 hostname="localhost")
827
828- d = self.verify_context(server_context, client_context)
829- e = yield self.assertFailure(d, SSL.Error)
830- self.assertEqual(e[0][0][1], "ssl3_get_server_certificate")
831+ yield self.assert_cert_failed_verify(server_context, client_context)
832
833 @defer.inlineCallbacks
834 def test_fails_hostname(self):
835@@ -164,10 +172,7 @@
836 self.patch(context, "get_certificates", lambda: [certs.ca_cert])
837 client_context = context.get_ssl_context(no_verify=False,
838 hostname="localhost")
839-
840- d = self.verify_context(server_context, client_context)
841- e = yield self.assertFailure(d, SSL.Error)
842- self.assertEqual(e[0][0][1], "ssl3_get_server_certificate")
843+ yield self.assert_cert_failed_verify(server_context, client_context)
844
845 @defer.inlineCallbacks
846 def test_matches_all(self):
847
848=== modified file 'ubuntuone/storageprotocol/tests/test_delta_info.py'
849--- tests/test_delta_info.py 2012-03-29 20:28:09 +0000
850+++ ubuntuone/storageprotocol/tests/test_delta_info.py 2018-04-08 19:37:28 +0000
851@@ -1,8 +1,7 @@
852 # -*- coding: utf-8 -*-
853 #
854-# Author: Lucio Torre <lucio.torre@canonical.com>
855-#
856 # Copyright (C) 2009-2012 Canonical Ltd.
857+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
858 #
859 # This program is free software: you can redistribute it and/or modify it
860 # under the terms of the GNU Affero General Public License version 3,
861@@ -28,6 +27,7 @@
862 # do not wish to do so, delete this exception statement from your
863 # version. If you delete this exception statement from all source
864 # files in the program, then also delete it here.
865+
866 """Tests for generation node data type."""
867
868 import unittest
869
870=== modified file 'ubuntuone/storageprotocol/tests/test_dircontent.py'
871--- tests/test_dircontent.py 2012-06-26 01:50:53 +0000
872+++ ubuntuone/storageprotocol/tests/test_dircontent.py 2018-04-08 19:37:28 +0000
873@@ -1,9 +1,7 @@
874-# ubuntuone.storageprotocol.tests.test_dircontent -
875-# directory content tests
876-#
877-# Author: Tim Cole <tim.cole@canonical.com>
878+# -*- coding: utf-8 -*-
879 #
880 # Copyright (C) 2009-2012 Canonical Ltd.
881+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
882 #
883 # This program is free software: you can redistribute it and/or modify it
884 # under the terms of the GNU Affero General Public License version 3,
885@@ -29,6 +27,7 @@
886 # do not wish to do so, delete this exception statement from your
887 # version. If you delete this exception statement from all source
888 # files in the program, then also delete it here.
889+
890 """Tests for directory content serialization/unserialization."""
891
892 from __future__ import with_statement
893
894=== modified file 'ubuntuone/storageprotocol/tests/test_errors.py'
895--- tests/test_errors.py 2012-03-29 20:28:09 +0000
896+++ ubuntuone/storageprotocol/tests/test_errors.py 2018-04-08 19:37:28 +0000
897@@ -1,8 +1,7 @@
898 # -*- coding: utf-8 -*-
899 #
900-# Author: Natalia B. Bidart <natalia.bidart@canonical.com>
901-#
902 # Copyright (C) 2010-2012 Canonical Ltd.
903+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
904 #
905 # This program is free software: you can redistribute it and/or modify it
906 # under the terms of the GNU Affero General Public License version 3,
907@@ -28,6 +27,7 @@
908 # do not wish to do so, delete this exception statement from your
909 # version. If you delete this exception statement from all source
910 # files in the program, then also delete it here.
911+
912 """Tests for errors module."""
913
914 import unittest
915@@ -46,24 +46,18 @@
916 class ErrorsTestCase(unittest.TestCase):
917 """Basic testing of errors mapping."""
918
919- def setUp(self):
920- """Init."""
921-
922 def test_exceptions_are_storage_protocol_error(self):
923 """High level exceptions inherit from StorageProtocolError."""
924 for e, args in HIGH_LEVEL_ERRORS.iteritems():
925- self.assertTrue(isinstance(e(**args), errors.StorageProtocolError),
926- "%r must inherit from StorageProtocolError" % e)
927+ self.assertIsInstance(e(**args), errors.StorageProtocolError)
928
929 def test_mapping(self):
930 """Protocol's specific exceptions are correct."""
931 for code_error, proto_error in errors._error_mapping.iteritems():
932- self.assertTrue(isinstance(proto_error(**REQ_ARGS),
933- errors.StorageRequestError),
934- "%r must inherit from StorageRequestError" %
935- proto_error)
936- self.assertEqual(proto_error,
937- errors.error_to_exception(code_error))
938+ self.assertIsInstance(
939+ proto_error(**REQ_ARGS), errors.StorageRequestError)
940+ self.assertEqual(
941+ proto_error, errors.error_to_exception(code_error))
942
943 def test_quota_exceed_error(self):
944 """QuotaExceeded error must have quota info."""
945
946=== modified file 'ubuntuone/storageprotocol/tests/test_hashes.py'
947--- tests/test_hashes.py 2012-03-29 20:28:09 +0000
948+++ ubuntuone/storageprotocol/tests/test_hashes.py 2018-04-08 19:37:28 +0000
949@@ -1,8 +1,7 @@
950 # -*- coding: utf-8 -*-
951 #
952-# Author: Facundo Batista <facundo@canonical.com>
953-#
954 # Copyright (C) 2011-2012 Canonical Ltd.
955+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
956 #
957 # This program is free software: you can redistribute it and/or modify it
958 # under the terms of the GNU Affero General Public License version 3,
959@@ -28,6 +27,7 @@
960 # do not wish to do so, delete this exception statement from your
961 # version. If you delete this exception statement from all source
962 # files in the program, then also delete it here.
963+
964 """Tests for the protocol hashing methods."""
965
966 import hashlib
967@@ -42,11 +42,6 @@
968 magic_hash_factory,
969 )
970
971-# let's not get picky about aatributes outside __init__ in tests
972-# pylint: disable=W0201
973-# it's ok to access internals in the test suite
974-# pylint: disable=W0212
975-
976
977 class FactoriesTest(unittest.TestCase):
978 """Test the hasher factories."""
979@@ -54,7 +49,7 @@
980 def test_content_hash_factory(self):
981 """Check the factory for the normal content hash."""
982 o = content_hash_factory()
983- self.assertTrue(isinstance(o, SHA1ContentHash))
984+ self.assertIsInstance(o, SHA1ContentHash)
985
986 def test_content_hash_method(self):
987 """Test the method that the normal content hash uses."""
988@@ -67,7 +62,7 @@
989 def test_magic_hash_factory(self):
990 """Check the factory for the magic content hash."""
991 o = magic_hash_factory()
992- self.assertTrue(isinstance(o, MagicContentHash))
993+ self.assertIsInstance(o, MagicContentHash)
994
995 def test_magic_hash_method(self):
996 """Test the method that the magic content hash uses."""
997@@ -176,7 +171,3 @@
998 # the value
999 ch = self.hasher.content_hash()
1000 self.assertRaises(NotImplementedError, pickle.dumps, ch)
1001-
1002-
1003-if __name__ == '__main__':
1004- unittest.main()
1005
1006=== modified file 'ubuntuone/storageprotocol/tests/test_proxy_tunnel.py'
1007--- tests/test_proxy_tunnel.py 2016-09-19 02:00:32 +0000
1008+++ ubuntuone/storageprotocol/tests/test_proxy_tunnel.py 2018-04-08 19:37:28 +0000
1009@@ -1,6 +1,7 @@
1010-# Test for proxy tunnel
1011+# -*- coding: utf-8 -*-
1012 #
1013 # Copyright 2009-2012 Canonical Ltd.
1014+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1015 #
1016 # This program is free software: you can redistribute it and/or modify it
1017 # under the terms of the GNU Affero General Public License version 3,
1018@@ -26,9 +27,9 @@
1019 # do not wish to do so, delete this exception statement from your
1020 # version. If you delete this exception statement from all source
1021 # files in the program, then also delete it here.
1022-"""Test for proxy tunnel"""
1023-
1024-import unittest
1025+
1026+"""Test for proxy tunnel."""
1027+
1028 import base64
1029
1030 from twisted.internet.protocol import Protocol, ClientFactory, connectionDone
1031@@ -171,8 +172,8 @@
1032
1033 def test_connect_auth(self):
1034 """Test connecting with auth"""
1035- return test_response("HTTP/1.0 200 Connection Made\r\n\r\n",
1036- auth="test:test")
1037+ return test_response(
1038+ "HTTP/1.0 200 Connection Made\r\n\r\n", auth="test:test")
1039
1040 def test_auth_error(self):
1041 """Test auth failure"""
1042@@ -272,12 +273,3 @@
1043 FakeConnectHTTPS("test", 1, TestClientFactory(),
1044 response, peer_callback=peer_callback)
1045 return d
1046-
1047-
1048-def test_suite():
1049- """Test suite"""
1050- return unittest.TestLoader().loadTestsFromName(__name__)
1051-
1052-
1053-if __name__ == "__main__":
1054- unittest.main()
1055
1056=== modified file 'ubuntuone/storageprotocol/tests/test_public_file_info.py'
1057--- tests/test_public_file_info.py 2016-11-07 01:11:29 +0000
1058+++ ubuntuone/storageprotocol/tests/test_public_file_info.py 2018-04-08 19:37:28 +0000
1059@@ -1,6 +1,6 @@
1060 # -*- coding: utf-8 -*-
1061-
1062-# Copyright 2016 Chicharreros (https://launchpad.net/~chicharreros)
1063+#
1064+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1065 #
1066 # This program is free software: you can redistribute it and/or modify it
1067 # under the terms of the GNU Affero General Public License version 3,
1068
1069=== modified file 'ubuntuone/storageprotocol/tests/test_putcontent.py'
1070--- tests/test_putcontent.py 2016-10-11 19:01:04 +0000
1071+++ ubuntuone/storageprotocol/tests/test_putcontent.py 2018-04-08 19:37:28 +0000
1072@@ -1,10 +1,7 @@
1073-# ubuntuone.storageprotocol.tests.test_upload_offset -
1074-# tests for the PutContent request
1075-#
1076-# Author: John R. Lenton <john.lenton@canonical.com>
1077-# Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
1078+# -*- coding: utf-8 -*-
1079 #
1080 # Copyright (C) 2009-2012 Canonical Ltd.
1081+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1082 #
1083 # This program is free software: you can redistribute it and/or modify it
1084 # under the terms of the GNU Affero General Public License version 3,
1085@@ -30,7 +27,8 @@
1086 # do not wish to do so, delete this exception statement from your
1087 # version. If you delete this exception statement from all source
1088 # files in the program, then also delete it here.
1089-"""Tests for PutContent request"""
1090+
1091+"""Tests for PutContent request."""
1092
1093 import unittest
1094
1095
1096=== modified file 'ubuntuone/storageprotocol/tests/test_query.py'
1097--- tests/test_query.py 2012-03-29 20:28:09 +0000
1098+++ ubuntuone/storageprotocol/tests/test_query.py 2018-04-08 19:37:28 +0000
1099@@ -1,9 +1,7 @@
1100-# ubuntuone.storageprotocol.tests.test_query -
1101-# query tests
1102-#
1103-# Author: John R. Lenton <john.lenton@canonical.com>
1104+# -*- coding: utf-8 -*-
1105 #
1106 # Copyright (C) 2009-2012 Canonical Ltd.
1107+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1108 #
1109 # This program is free software: you can redistribute it and/or modify it
1110 # under the terms of the GNU Affero General Public License version 3,
1111@@ -29,11 +27,13 @@
1112 # do not wish to do so, delete this exception statement from your
1113 # version. If you delete this exception statement from all source
1114 # files in the program, then also delete it here.
1115-"""Tests for querying lots of items"""
1116-
1117+
1118+"""Tests for querying lots of items."""
1119+
1120+import os
1121 import unittest
1122+
1123 from ubuntuone.storageprotocol.client import MultiQuery
1124-import os
1125
1126
1127 class TestQuery10(unittest.TestCase):
1128@@ -63,6 +63,3 @@
1129 Check with even more queries
1130 """
1131 N = 1000
1132-
1133-if __name__ == '__main__':
1134- unittest.main()
1135
1136=== modified file 'ubuntuone/storageprotocol/tests/test_request.py'
1137--- tests/test_request.py 2012-03-29 20:28:09 +0000
1138+++ ubuntuone/storageprotocol/tests/test_request.py 2018-04-08 19:37:28 +0000
1139@@ -1,10 +1,7 @@
1140-# ubuntuone.storageprotocol.tests.test_request -
1141-# request class tests
1142-#
1143-# Author: Tim Cole <tim.cole@canonical.com>
1144-# Author: Natalia Bidart <natalia.bidart@canonical.com>
1145+# -*- coding: utf-8 -*-
1146 #
1147 # Copyright (C) 2009-2012 Canonical Ltd.
1148+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1149 #
1150 # This program is free software: you can redistribute it and/or modify it
1151 # under the terms of the GNU Affero General Public License version 3,
1152@@ -30,6 +27,7 @@
1153 # do not wish to do so, delete this exception statement from your
1154 # version. If you delete this exception statement from all source
1155 # files in the program, then also delete it here.
1156+
1157 """Tests for directory content serialization/unserialization."""
1158
1159 from __future__ import with_statement
1160@@ -44,9 +42,6 @@
1161 from ubuntuone.storageprotocol.request import (
1162 RequestHandler, Request, RequestResponse)
1163
1164-# let's not get picky about attributes outside __init__ in tests
1165-# pylint: disable=W0201
1166-
1167
1168 class MindlessRequest(Request):
1169 """A mindless Request which never actually does anything."""
1170@@ -118,7 +113,7 @@
1171 message = protocol_pb2.Message()
1172 self.request._default_process_message(message)
1173
1174- self.assertTrue(isinstance(self.error, errors.StorageRequestError))
1175+ self.assertIsInstance(self.error, errors.StorageRequestError)
1176 self.assertEqual(self.request, self.error.request)
1177 self.assertEqual(message, self.error.error_message)
1178
1179@@ -145,8 +140,7 @@
1180 message.error.type = code_error
1181 self.request._default_process_message(message)
1182
1183- self.assertTrue(isinstance(self.error, proto_error),
1184- "must be an instance of %r" % proto_error)
1185+ self.assertIsInstance(self.error, proto_error)
1186 self.assertEqual(self.request, self.error.request)
1187 self.assertEqual(message, self.error.error_message)
1188
1189
1190=== modified file 'ubuntuone/storageprotocol/tests/test_sharersp.py'
1191--- tests/test_sharersp.py 2012-12-03 19:45:43 +0000
1192+++ ubuntuone/storageprotocol/tests/test_sharersp.py 2018-04-08 19:37:28 +0000
1193@@ -1,8 +1,7 @@
1194-# ubuntuone.storageprotocol.tests.test_sharersp
1195-#
1196-# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
1197+# -*- coding: utf-8 -*-
1198 #
1199 # Copyright (C) 2010-2012 Canonical Ltd.
1200+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1201 #
1202 # This program is free software: you can redistribute it and/or modify it
1203 # under the terms of the GNU Affero General Public License version 3,
1204@@ -28,6 +27,7 @@
1205 # do not wish to do so, delete this exception statement from your
1206 # version. If you delete this exception statement from all source
1207 # files in the program, then also delete it here.
1208+
1209 """Tests for shares response."""
1210
1211 import uuid
1212@@ -66,7 +66,7 @@
1213 def test_to_me(self):
1214 """Test ShareResponse.from_params with a 'to_me' share."""
1215 args = (uuid.uuid4(), "to_me", uuid.uuid4(), "share_name", u"username",
1216- u"visible_name", True, self.access_level)
1217+ u"visible_name", True, self.access_level)
1218 share = ShareResponse.from_params(*args)
1219 self.assertShareResponse(share, args)
1220
1221@@ -116,7 +116,7 @@
1222 def test_to_me(self):
1223 """Test ShareResponse.from_params with a 'to_me' share."""
1224 args = (uuid.uuid4(), "to_me", uuid.uuid4(), "share_name", u"username",
1225- u"visible_name", True, self.access_level)
1226+ u"visible_name", True, self.access_level)
1227 share = ShareResponse.from_params(*args)
1228 share.dump_to_msg(self.msg.shares)
1229 self.assertEqualShare(share,
1230
1231=== modified file 'ubuntuone/storageprotocol/tests/test_throttling.py'
1232--- tests/test_throttling.py 2012-03-29 20:28:09 +0000
1233+++ ubuntuone/storageprotocol/tests/test_throttling.py 2018-04-08 19:37:28 +0000
1234@@ -1,9 +1,7 @@
1235-# ubuntuone.storageprotocol.tests.test_throttling -
1236-# Throttling tests
1237-#
1238-# Author: Facundo Batista <facundo@canonical.com>
1239+# -*- coding: utf-8 -*-
1240 #
1241 # Copyright (C) 2009-2012 Canonical
1242+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1243 #
1244 # This program is free software: you can redistribute it and/or modify it
1245 # under the terms of the GNU Affero General Public License version 3,
1246@@ -29,6 +27,7 @@
1247 # do not wish to do so, delete this exception statement from your
1248 # version. If you delete this exception statement from all source
1249 # files in the program, then also delete it here.
1250+
1251 """Tests for directory content serialization/unserialization."""
1252
1253 from __future__ import with_statement
1254@@ -232,8 +231,6 @@
1255
1256 def test_change_to_inavlid(self):
1257 """Test setting invalid limit values after initialization."""
1258- # yes, this is a unittest, I need to access protected members
1259- # pylint: disable=W0212
1260 tscf = self.create_factory(True, 2, 2)
1261 self.assertRaises(ValueError, tscf._set_read_limit, -1)
1262 self.assertRaises(ValueError, tscf._set_write_limit, -1)
1263@@ -458,8 +455,8 @@
1264 self.assertEquals(None, tscf.resetReadThisSecondID)
1265 self.assertEquals(None, tscf.resetWriteThisSecondID)
1266 tscf.enable_throttling()
1267- self.assertTrue(tscf.throttling_enabled,
1268- "Throttling should be enabled.")
1269+ self.assertTrue(
1270+ tscf.throttling_enabled, "Throttling should be enabled.")
1271 self.assertNotEquals(None, tscf.resetReadThisSecondID)
1272 self.assertNotEquals(None, tscf.resetWriteThisSecondID)
1273 tscf.registerRead(3)
1274
1275=== modified file 'ubuntuone/storageprotocol/tests/test_volumes.py'
1276--- tests/test_volumes.py 2012-03-29 20:28:09 +0000
1277+++ ubuntuone/storageprotocol/tests/test_volumes.py 2018-04-08 19:37:28 +0000
1278@@ -1,8 +1,7 @@
1279 # -*- coding: utf-8 -*-
1280 #
1281-# Author: Natalia B. Bidart <natalia.bidart@canonical.com>
1282-#
1283 # Copyright (C) 2009-2012 Canonical Ltd.
1284+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1285 #
1286 # This program is free software: you can redistribute it and/or modify it
1287 # under the terms of the GNU Affero General Public License version 3,
1288@@ -28,6 +27,7 @@
1289 # do not wish to do so, delete this exception statement from your
1290 # version. If you delete this exception statement from all source
1291 # files in the program, then also delete it here.
1292+
1293 """Tests for volume data type."""
1294
1295 import unittest
1296@@ -37,9 +37,6 @@
1297
1298 from ubuntuone.storageprotocol import protocol_pb2, volumes
1299
1300-# let's not get picky about aatributes outside __init__ in tests
1301-# pylint: disable=W0201
1302-
1303 PATH = u'~/Documents/pdfs/moño/'
1304 NAME = u'What a beatiful volume'
1305 VOLUME = uuid.UUID('12345678-1234-1234-1234-123456789abc')
1306@@ -79,7 +76,7 @@
1307
1308 def test_is_a_volume(self):
1309 """Test class inheritance."""
1310- self.assertTrue(isinstance(self.volume, volumes.Volume))
1311+ self.assertIsInstance(self.volume, volumes.Volume)
1312
1313 def test_from_params(self):
1314 """Test creation using from_params."""
1315@@ -108,7 +105,6 @@
1316 class ShareTestCase(VolumeTestCase):
1317 """Check Share data type."""
1318
1319- # pylint: disable=W0212
1320 to_me = volumes._direction_prot2nice[protocol_pb2.Shares.TO_ME]
1321 only_view = volumes._access_prot2nice[protocol_pb2.Shares.VIEW]
1322
1323@@ -133,7 +129,6 @@
1324 def test_from_msg(self):
1325 """Test creation using from_msg."""
1326 message = protocol_pb2.Shares()
1327- # pylint: disable=W0201
1328 message.share_id = str(VOLUME)
1329 message.subtree = str(NODE)
1330 message.generation = GENERATION
1331@@ -161,7 +156,6 @@
1332 def test_from_msg(self):
1333 """Test creation using from_msg."""
1334 message = protocol_pb2.UDFs()
1335- # pylint: disable=W0201
1336 message.volume = str(VOLUME)
1337 message.node = str(NODE)
1338 message.suggested_path = PATH
1339@@ -181,13 +175,8 @@
1340 def test_from_msg(self):
1341 """Test creation using from_msg."""
1342 message = protocol_pb2.Root()
1343- # pylint: disable=W0201
1344 message.node = str(NODE)
1345 message.generation = GENERATION
1346 message.free_bytes = FREE_BYTES
1347 self.volume = self.volume_class.from_msg(message)
1348 self.assert_correct_attributes()
1349-
1350-
1351-if __name__ == '__main__':
1352- unittest.main()
1353
1354=== modified file 'ubuntuone/storageprotocol/utils.py'
1355--- ubuntuone/storageprotocol/utils.py 2012-03-29 20:28:09 +0000
1356+++ ubuntuone/storageprotocol/utils.py 2018-04-08 19:37:28 +0000
1357@@ -1,8 +1,7 @@
1358-# ubuntuone.storageprotocol.utils - some storage protocol utils
1359-#
1360-# Author: Alejandro J. Cura <alecu@canonical.com>
1361+# -*- coding: utf-8 -*-
1362 #
1363 # Copyright 2011-2012 Canonical Ltd.
1364+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1365 #
1366 # This program is free software: you can redistribute it and/or modify it
1367 # under the terms of the GNU Affero General Public License version 3,
1368@@ -28,6 +27,7 @@
1369 # do not wish to do so, delete this exception statement from your
1370 # version. If you delete this exception statement from all source
1371 # files in the program, then also delete it here.
1372+
1373 """Some storage protocol utils."""
1374
1375 import logging
1376
1377=== modified file 'ubuntuone/storageprotocol/validators.py'
1378--- ubuntuone/storageprotocol/validators.py 2012-04-20 22:11:06 +0000
1379+++ ubuntuone/storageprotocol/validators.py 2018-04-08 19:37:28 +0000
1380@@ -1,5 +1,7 @@
1381+# -*- coding: utf-8 -*-
1382 #
1383 # Copyright (C) 2009-2012 Canonical Ltd.
1384+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1385 #
1386 # This program is free software: you can redistribute it and/or modify it
1387 # under the terms of the GNU Affero General Public License version 3,
1388@@ -25,10 +27,12 @@
1389 # do not wish to do so, delete this exception statement from your
1390 # version. If you delete this exception statement from all source
1391 # files in the program, then also delete it here.
1392+
1393 """Message validation."""
1394
1395 import re
1396 from uuid import UUID
1397+
1398 from google.protobuf.message import Message as _PBMessage
1399 from google.protobuf.internal.containers import BaseContainer as _PBContainer
1400 try:
1401@@ -81,8 +85,8 @@
1402 """
1403 # circular import
1404 from ubuntuone.storageprotocol import request
1405- is_valid = a_hash == '' or a_hash == request.UNKNOWN_HASH or \
1406- is_valid_sha1(a_hash)
1407+ is_valid = (a_hash == '' or a_hash == request.UNKNOWN_HASH or
1408+ is_valid_sha1(a_hash))
1409 return is_valid
1410
1411
1412@@ -90,9 +94,6 @@
1413 """
1414 Recursively validate a message's fields
1415 """
1416- # we will import ourselves
1417- # pylint: disable=W0406
1418-
1419 is_invalid = []
1420 from ubuntuone.storageprotocol import validators # this is us!
1421 for descriptor, submsg in message.ListFields():
1422@@ -114,9 +115,7 @@
1423 return is_invalid
1424
1425
1426-# these are valid, pylint: disable=C0103
1427 is_valid_parent_node = is_valid_node
1428 is_valid_new_parent_node = is_valid_node
1429 is_valid_subtree = is_valid_node
1430 is_valid_share_id = is_valid_share
1431-# pylint: enable=C0103
1432
1433=== modified file 'ubuntuone/storageprotocol/volumes.py'
1434--- ubuntuone/storageprotocol/volumes.py 2012-12-03 19:45:43 +0000
1435+++ ubuntuone/storageprotocol/volumes.py 2018-04-08 19:37:28 +0000
1436@@ -1,8 +1,7 @@
1437 # -*- coding: utf-8 -*-
1438 #
1439-# Author: Natalia B. Bidart <natalia.bidart@canonical.com>
1440-#
1441 # Copyright 2009-2012 Canonical Ltd.
1442+# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
1443 #
1444 # This program is free software: you can redistribute it and/or modify it
1445 # under the terms of the GNU Affero General Public License version 3,
1446@@ -28,13 +27,13 @@
1447 # do not wish to do so, delete this exception statement from your
1448 # version. If you delete this exception statement from all source
1449 # files in the program, then also delete it here.
1450+
1451 """The volumes abstraction."""
1452
1453 import uuid
1454
1455 from ubuntuone.storageprotocol import protocol_pb2
1456
1457-# these are valid, pylint: disable=C0103
1458 _direction_prot2nice = {
1459 protocol_pb2.Shares.FROM_ME: "from_me",
1460 protocol_pb2.Shares.TO_ME: "to_me",
1461@@ -46,7 +45,6 @@
1462 protocol_pb2.Shares.MODIFY: "Modify",
1463 }
1464 _access_nice2prot = dict((y, x) for x, y in _access_prot2nice.items())
1465-# pylint: enable=C0103
1466
1467
1468 class Volume(object):

Subscribers

People subscribed via source and target branches

to all changes: