Merge lp:~nataliabidart/magicicada-client/fix-lint-issues into lp:magicicada-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1437
Merged at revision: 1437
Proposed branch: lp:~nataliabidart/magicicada-client/fix-lint-issues
Merge into: lp:magicicada-client
Diff against target: 379 lines (+56/-46)
16 files modified
ubuntuone/networkstate/networkstates.py (+1/-0)
ubuntuone/platform/filesystem_notifications/pyinotify_agnostic.py (+1/-0)
ubuntuone/platform/os_helper/windows.py (+4/-1)
ubuntuone/platform/sync_menu/linux.py (+1/-1)
ubuntuone/platform/tests/ipc/test_perspective_broker.py (+1/-0)
ubuntuone/platform/tests/os_helper/test_os_helper.py (+3/-3)
ubuntuone/platform/tools/__init__.py (+1/-1)
ubuntuone/syncdaemon/filesystem_notifications.py (+1/-1)
ubuntuone/syncdaemon/fsm/fsm.py (+4/-3)
ubuntuone/syncdaemon/local_rescan.py (+1/-0)
ubuntuone/syncdaemon/logger.py (+1/-0)
ubuntuone/syncdaemon/tests/fsm/test_fsm_run.py (+1/-1)
ubuntuone/syncdaemon/tests/test_action_queue.py (+5/-5)
ubuntuone/syncdaemon/tests/test_eventqueue.py (+6/-6)
ubuntuone/syncdaemon/tests/test_localrescan.py (+24/-24)
ubuntuone/utils/tests/test_tcpactivation.py (+1/-0)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-client/fix-lint-issues
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+341177@code.launchpad.net

Commit message

- Fixed lint issues after pep8 version bump.

To post a comment you must log in.
1437. By Natalia Bidart

Merged trunk into fix-lint-issues.

Revision history for this message
Facundo Batista (facundo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/networkstate/networkstates.py'
2--- ubuntuone/networkstate/networkstates.py 2016-05-28 23:52:12 +0000
3+++ ubuntuone/networkstate/networkstates.py 2018-03-08 19:49:59 +0000
4@@ -27,6 +27,7 @@
5 def __repr__(self):
6 return "Network state (%s)" % self.label
7
8+
9 # Values returned by the callback
10 (ONLINE, OFFLINE, UNKNOWN) = (NetworkState("online"),
11 NetworkState("offline"),
12
13=== modified file 'ubuntuone/platform/filesystem_notifications/pyinotify_agnostic.py'
14--- ubuntuone/platform/filesystem_notifications/pyinotify_agnostic.py 2015-09-19 23:15:50 +0000
15+++ ubuntuone/platform/filesystem_notifications/pyinotify_agnostic.py 2018-03-08 19:49:59 +0000
16@@ -65,6 +65,7 @@
17 """Class name color."""
18 return self.format.get('red', '') + self.simple(s, 'bold')
19
20+
21 output_format = RawOutputFormat()
22
23
24
25=== modified file 'ubuntuone/platform/os_helper/windows.py'
26--- ubuntuone/platform/os_helper/windows.py 2015-09-19 23:15:50 +0000
27+++ ubuntuone/platform/os_helper/windows.py 2018-03-08 19:49:59 +0000
28@@ -248,6 +248,7 @@
29 assert_windows_path(result)
30 return result
31
32+
33 get_os_valid_path = get_windows_valid_path
34
35
36@@ -327,6 +328,7 @@
37 """
38 return _is_valid_path(assert_windows_path, path_indexes)
39
40+
41 is_valid_os_path = is_valid_windows_path
42
43
44@@ -413,6 +415,7 @@
45 """
46 return _transform_path(get_windows_valid_path, path_indexes)
47
48+
49 os_path = windowspath
50
51
52@@ -671,7 +674,7 @@
53 shortcut.SetWorkingDirectory(target)
54 pf = shortcut.QueryInterface(IPersistFile)
55 pf.Save(destination, True)
56- except:
57+ except Exception:
58 logger.exception('make_link could not be completed for target %r, '
59 'destination %r:', target, destination)
60 raise
61
62=== modified file 'ubuntuone/platform/sync_menu/linux.py'
63--- ubuntuone/platform/sync_menu/linux.py 2016-09-17 01:06:23 +0000
64+++ ubuntuone/platform/sync_menu/linux.py 2018-03-08 19:49:59 +0000
65@@ -43,7 +43,7 @@
66 SyncMenu,
67 )
68 use_syncmenu = True
69-except:
70+except ImportError:
71 use_syncmenu = False
72
73 from ubuntuone.clientdefs import GETTEXT_PACKAGE, NAME
74
75=== modified file 'ubuntuone/platform/tests/ipc/test_perspective_broker.py'
76--- ubuntuone/platform/tests/ipc/test_perspective_broker.py 2016-06-03 19:52:03 +0000
77+++ ubuntuone/platform/tests/ipc/test_perspective_broker.py 2018-03-08 19:49:59 +0000
78@@ -85,6 +85,7 @@
79 class NoTestCase(object):
80 """Dummy class to be used when txsocketserver is not available."""
81
82+
83 try:
84 from ubuntuone.devtools.testcases.txsocketserver import (
85 TidyUnixServer,
86
87=== modified file 'ubuntuone/platform/tests/os_helper/test_os_helper.py'
88--- ubuntuone/platform/tests/os_helper/test_os_helper.py 2016-06-01 18:28:19 +0000
89+++ ubuntuone/platform/tests/os_helper/test_os_helper.py 2018-03-08 19:49:59 +0000
90@@ -276,9 +276,9 @@
91 open_file(os.path.join(self.basedir, extra), 'w').close()
92 expected_result.append(extra)
93
94- l = listdir(self.basedir)
95- self.assertEqual(sorted(l), sorted(expected_result))
96- for path in l:
97+ dirs = listdir(self.basedir)
98+ self.assertEqual(sorted(dirs), sorted(expected_result))
99+ for path in dirs:
100 self.assertIsInstance(path, type(self.basedir))
101
102 def test_access_rw(self):
103
104=== modified file 'ubuntuone/platform/tools/__init__.py'
105--- ubuntuone/platform/tools/__init__.py 2016-09-17 01:06:23 +0000
106+++ ubuntuone/platform/tools/__init__.py 2018-03-08 19:49:59 +0000
107@@ -688,7 +688,7 @@
108 """Format an error when things go wrong"""
109 try:
110 raise error.value
111- except:
112+ except Exception:
113 signal, (args, retval) = error.value.args
114 msg_template = u"%s: %s (%s)\n"
115 fmtd_args = u", ".join("%s=%s" % (k, v) for k, v in args.items())
116
117=== modified file 'ubuntuone/syncdaemon/filesystem_notifications.py'
118--- ubuntuone/syncdaemon/filesystem_notifications.py 2015-09-19 23:15:50 +0000
119+++ ubuntuone/syncdaemon/filesystem_notifications.py 2018-03-08 19:49:59 +0000
120@@ -151,7 +151,7 @@
121 # change the pattern IN_CREATE to FS_FILE_CREATE or FS_DIR_CREATE
122 try:
123 evt_name = self.name_translations[event.mask]
124- except:
125+ except Exception:
126 self.log.error("Unhandled Event in INotify: %s", event)
127 raise KeyError("Unhandled Event in INotify: %s" % event)
128 # check if the path is not frozen
129
130=== modified file 'ubuntuone/syncdaemon/fsm/fsm.py'
131--- ubuntuone/syncdaemon/fsm/fsm.py 2016-07-30 21:58:48 +0000
132+++ ubuntuone/syncdaemon/fsm/fsm.py 2018-03-08 19:49:59 +0000
133@@ -86,9 +86,9 @@
134 if str(myvalues[name]) == "*":
135 myvalues[name] = varlist[name]
136 elif str(myvalues[name])[0] == "!":
137- l = varlist[name].copy()
138- l.remove(myvalues[name][1:])
139- myvalues[name] = l
140+ var_list = varlist[name].copy()
141+ var_list.remove(myvalues[name][1:])
142+ myvalues[name] = var_list
143 else:
144 myvalues[name] = [myvalues[name]]
145 return build_combinations_from_varlist(myvalues)
146@@ -510,6 +510,7 @@
147 """Get the transition for this events with these parameters."""
148 return self.transitions[event, hash_dict(parameters)]
149
150+
151 if __name__ == "__main__":
152 import sys
153 s = StateMachine(sys.argv[1], sys.argv[2:])
154
155=== modified file 'ubuntuone/syncdaemon/local_rescan.py'
156--- ubuntuone/syncdaemon/local_rescan.py 2015-09-19 23:15:50 +0000
157+++ ubuntuone/syncdaemon/local_rescan.py 2018-03-08 19:49:59 +0000
158@@ -62,6 +62,7 @@
159 class ScanNoDirectory(Exception):
160 """The whole directory went away."""
161
162+
163 # local rescan logger
164 lr_logger = logging.getLogger('ubuntuone.SyncDaemon.local_rescan')
165 log_info = functools.partial(lr_logger.log, logging.INFO)
166
167=== modified file 'ubuntuone/syncdaemon/logger.py'
168--- ubuntuone/syncdaemon/logger.py 2016-05-28 23:32:02 +0000
169+++ ubuntuone/syncdaemon/logger.py 2018-03-08 19:49:59 +0000
170@@ -136,6 +136,7 @@
171 return failure
172 return callback, errback
173
174+
175 LOGFILENAME = os.path.join(ubuntuone_log_dir, 'syncdaemon.log')
176 EXLOGFILENAME = os.path.join(ubuntuone_log_dir, 'syncdaemon-exceptions.log')
177 INVALIDLOGFILENAME = os.path.join(
178
179=== modified file 'ubuntuone/syncdaemon/tests/fsm/test_fsm_run.py'
180--- ubuntuone/syncdaemon/tests/fsm/test_fsm_run.py 2016-06-03 19:52:03 +0000
181+++ ubuntuone/syncdaemon/tests/fsm/test_fsm_run.py 2018-03-08 19:49:59 +0000
182@@ -69,7 +69,7 @@
183 H = make("h", "EEE")
184 E = make("e", "LLL")
185 L = make("l", "LOD")
186- O = make("o", "WRR")
187+ O = make("o", "WRR") # noqa
188 W = make("w", "OOO")
189 R = make("r", "LLL")
190 D = make("d", ["NL"]*3)
191
192=== modified file 'ubuntuone/syncdaemon/tests/test_action_queue.py'
193--- ubuntuone/syncdaemon/tests/test_action_queue.py 2017-02-10 01:15:07 +0000
194+++ ubuntuone/syncdaemon/tests/test_action_queue.py 2018-03-08 19:49:59 +0000
195@@ -4960,15 +4960,15 @@
196
197 def test_is_list(self):
198 """A DeltaList is a list."""
199- l = [1, 2, 3]
200- a = DeltaList(l)
201+ data = [1, 2, 3]
202+ a = DeltaList(data)
203 self.assertTrue(isinstance(a, list))
204
205 def test_is_equal_list(self):
206 """A DeltaList is equal to the list it represents."""
207- l = [1, 2, 3]
208- a = DeltaList(l)
209- self.assertEqual(a, l)
210+ data = [1, 2, 3]
211+ a = DeltaList(data)
212+ self.assertEqual(a, data)
213
214 def test_repr(self):
215 """A DeltaList has a short representation."""
216
217=== modified file 'ubuntuone/syncdaemon/tests/test_eventqueue.py'
218--- ubuntuone/syncdaemon/tests/test_eventqueue.py 2016-06-04 21:14:35 +0000
219+++ ubuntuone/syncdaemon/tests/test_eventqueue.py 2018-03-08 19:49:59 +0000
220@@ -356,12 +356,12 @@
221 def handle_default(self, event, **kwargs):
222 d.callback((event, kwargs))
223
224- l = Listener()
225- self.eq.subscribe(l)
226+ listener = Listener()
227+ self.eq.subscribe(listener)
228
229 def cleanup():
230 """Unsubscribe the listeners."""
231- self.eq.unsubscribe(l)
232+ self.eq.unsubscribe(listener)
233 self.addCleanup(cleanup)
234
235 # push some event and expect it'll be handled by handle_default
236@@ -401,9 +401,9 @@
237 # create 10 listeners in order to create an event madness
238 listeners = []
239 for i in xrange(0, 10):
240- l = Listener(self.eq)
241- listeners.append(l)
242- self.eq.subscribe(l)
243+ listener = Listener(self.eq)
244+ listeners.append(listener)
245+ self.eq.subscribe(listener)
246
247 # push some events to unleash the event madness
248 self.eq.push("FS_FILE_CREATE", path=1)
249
250=== modified file 'ubuntuone/syncdaemon/tests/test_localrescan.py'
251--- ubuntuone/syncdaemon/tests/test_localrescan.py 2016-07-30 22:03:39 +0000
252+++ ubuntuone/syncdaemon/tests/test_localrescan.py 2018-03-08 19:49:59 +0000
253@@ -1262,23 +1262,23 @@
254 @defer.inlineCallbacks
255 def test_one_dir_create(self):
256 """Check that an example dir create is really pushed."""
257- l = Listener()
258- self.eq.subscribe(l)
259- self.addCleanup(self.eq.unsubscribe, l)
260+ listener = Listener()
261+ self.eq.subscribe(listener)
262+ self.addCleanup(self.eq.unsubscribe, listener)
263
264 # push some event
265 filepath = os.path.join(self.share.path, "a")
266 make_dir(filepath)
267
268 yield self.lr.start()
269- self.assertItemsEqual(l.events, [('FS_DIR_CREATE', filepath)])
270+ self.assertItemsEqual(listener.events, [('FS_DIR_CREATE', filepath)])
271
272 @defer.inlineCallbacks
273 def test_one_file_create(self):
274 """Check that an example file create is really pushed."""
275- l = Listener()
276- self.eq.subscribe(l)
277- self.addCleanup(self.eq.unsubscribe, l)
278+ listener = Listener()
279+ self.eq.subscribe(listener)
280+ self.addCleanup(self.eq.unsubscribe, listener)
281
282 # push some event
283 filepath = os.path.join(self.share.path, "a")
284@@ -1289,14 +1289,14 @@
285 ('FS_FILE_CREATE', filepath),
286 ('FS_FILE_CLOSE_WRITE', filepath),
287 ]
288- self.assertItemsEqual(l.events, expected)
289+ self.assertItemsEqual(listener.events, expected)
290
291 @defer.inlineCallbacks
292 def test_one_dir_delete(self):
293 """Check that an example dir delete is really pushed."""
294- l = Listener()
295- self.eq.subscribe(l)
296- self.addCleanup(self.eq.unsubscribe, l)
297+ listener = Listener()
298+ self.eq.subscribe(listener)
299+ self.addCleanup(self.eq.unsubscribe, listener)
300
301 # push some event
302 filepath = os.path.join(self.share.path, "a")
303@@ -1304,14 +1304,14 @@
304 self.fsm.set_node_id(filepath, "uuid1")
305
306 yield self.lr.start()
307- self.assertItemsEqual(l.events, [('FS_DIR_DELETE', filepath)])
308+ self.assertItemsEqual(listener.events, [('FS_DIR_DELETE', filepath)])
309
310 @defer.inlineCallbacks
311 def test_one_file_delete(self):
312 """Check that an example file delete is really pushed."""
313- l = Listener()
314- self.eq.subscribe(l)
315- self.addCleanup(self.eq.unsubscribe, l)
316+ listener = Listener()
317+ self.eq.subscribe(listener)
318+ self.addCleanup(self.eq.unsubscribe, listener)
319
320 # push some event
321 filepath = os.path.join(self.share.path, "a")
322@@ -1320,14 +1320,14 @@
323 self.fsm.set_by_path(filepath, local_hash="hash", server_hash="hash")
324
325 yield self.lr.start()
326- self.assertItemsEqual(l.events, [('FS_FILE_DELETE', filepath)])
327+ self.assertItemsEqual(listener.events, [('FS_FILE_DELETE', filepath)])
328
329 @defer.inlineCallbacks
330 def test_file_changed(self):
331 """Check that an example close write is pushed."""
332- l = Listener()
333- self.eq.subscribe(l)
334- self.addCleanup(self.eq.unsubscribe, l)
335+ listener = Listener()
336+ self.eq.subscribe(listener)
337+ self.addCleanup(self.eq.unsubscribe, listener)
338
339 # push some event
340 filepath = os.path.join(self.share.path, "a")
341@@ -1341,14 +1341,14 @@
342 ('FS_FILE_CREATE', filepath),
343 ('FS_FILE_CLOSE_WRITE', filepath),
344 ]
345- self.assertItemsEqual(l.events, expected)
346+ self.assertItemsEqual(listener.events, expected)
347
348 @defer.inlineCallbacks
349 def test_file_changed_in_nestedstruct(self):
350 """Check that an example close write is pushed."""
351- l = Listener()
352- self.eq.subscribe(l)
353- self.addCleanup(self.eq.unsubscribe, l)
354+ listener = Listener()
355+ self.eq.subscribe(listener)
356+ self.addCleanup(self.eq.unsubscribe, listener)
357
358 # create nested struct
359 path = os.path.join(self.share.path, "a")
360@@ -1373,7 +1373,7 @@
361 ('FS_FILE_CREATE', path),
362 ('FS_FILE_CLOSE_WRITE', path),
363 ]
364- self.assertItemsEqual(l.events, expected)
365+ self.assertItemsEqual(listener.events, expected)
366
367 @defer.inlineCallbacks
368 def test_conflict_file(self):
369
370=== modified file 'ubuntuone/utils/tests/test_tcpactivation.py'
371--- ubuntuone/utils/tests/test_tcpactivation.py 2016-06-04 21:14:35 +0000
372+++ ubuntuone/utils/tests/test_tcpactivation.py 2018-03-08 19:49:59 +0000
373@@ -472,5 +472,6 @@
374 else:
375 client_test(config)
376
377+
378 if __name__ == "__main__":
379 irl_test()

Subscribers

People subscribed via source and target branches

to all changes: