Merge lp:~mterry/duplicity/code-nits into lp:~duplicity-team/duplicity/0.7-series
- code-nits
- Merge into 0.7-series
Proposed by
Michael Terry
Status: | Merged |
---|---|
Merged at revision: | 1009 |
Proposed branch: | lp:~mterry/duplicity/code-nits |
Merge into: | lp:~duplicity-team/duplicity/0.7-series |
Diff against target: |
636 lines (+71/-71) 29 files modified
bin/duplicity (+5/-5) duplicity/backend.py (+1/-1) duplicity/backends/_boto_multi.py (+1/-1) duplicity/backends/_boto_single.py (+1/-1) duplicity/backends/_ssh_paramiko.py (+9/-9) duplicity/backends/cfbackend.py (+1/-1) duplicity/backends/copycombackend.py (+1/-1) duplicity/backends/dpbxbackend.py (+1/-1) duplicity/backends/imapbackend.py (+1/-1) duplicity/backends/par2backend.py (+1/-1) duplicity/backends/sshbackend.py (+1/-1) duplicity/backends/swiftbackend.py (+2/-2) duplicity/backends/webdavbackend.py (+4/-4) duplicity/collections.py (+13/-13) duplicity/commandline.py (+1/-1) duplicity/dup_time.py (+1/-1) duplicity/file_naming.py (+2/-2) duplicity/gpg.py (+1/-1) duplicity/lazy.py (+1/-1) duplicity/log.py (+3/-3) duplicity/manifest.py (+1/-1) duplicity/patchdir.py (+1/-1) duplicity/path.py (+1/-1) duplicity/progress.py (+5/-5) duplicity/robust.py (+6/-6) duplicity/selection.py (+3/-3) duplicity/statistics.py (+1/-1) duplicity/tempdir.py (+1/-1) setup.py (+1/-1) |
To merge this branch: | bzr merge lp:~mterry/duplicity/code-nits |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
duplicity-team | Pending | ||
Review via email: mp+239680@code.launchpad.net |
Commit message
Description of the change
Fix some pylint/pep8 nits that prevented the test_code.py test from passing. (At least with my version of those programs.)
Nothing major, just some style choices with 'X is not Y' vs 'not X is Y' and making sure that continued 'if' lines do not have the same indentation as the block after them. Stuff like that.
To post a comment you must log in.
lp:~mterry/duplicity/code-nits
updated
- 1010. By Michael Terry
-
Avoid super() on old-style class
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/duplicity' |
2 | --- bin/duplicity 2014-05-11 11:50:12 +0000 |
3 | +++ bin/duplicity 2014-10-27 03:02:31 +0000 |
4 | @@ -94,14 +94,14 @@ |
5 | pass |
6 | |
7 | # check if we can reuse an already set (signing_)passphrase |
8 | - ## if signing key is also an encryption key assume that the passphrase is identical |
9 | + # if signing key is also an encryption key assume that the passphrase is identical |
10 | if ( for_signing |
11 | and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients |
12 | or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) |
13 | and 'PASSPHRASE' in os.environ ): |
14 | log.Notice(_("Reuse configured PASSPHRASE as SIGN_PASSPHRASE")) |
15 | return os.environ['PASSPHRASE'] |
16 | - ## if one encryption key is also the signing key assume that the passphrase is identical |
17 | + # if one encryption key is also the signing key assume that the passphrase is identical |
18 | if ( not for_signing |
19 | and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients |
20 | or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) |
21 | @@ -433,7 +433,7 @@ |
22 | bytes_written += waiter() |
23 | |
24 | # Upload the collection summary. |
25 | - #bytes_written += write_manifest(mf, backup_type, backend) |
26 | + # bytes_written += write_manifest(mf, backup_type, backend) |
27 | |
28 | return bytes_written |
29 | |
30 | @@ -923,7 +923,7 @@ |
31 | _("Which can't be deleted because newer sets depend on them."))) |
32 | |
33 | if (col_stats.matched_chain_pair and |
34 | - col_stats.matched_chain_pair[1].end_time < globals.remove_time): |
35 | + col_stats.matched_chain_pair[1].end_time < globals.remove_time): |
36 | log.Warn(_("Current active backup chain is older than specified time. " |
37 | "However, it will not be deleted. To remove all your backups, " |
38 | "manually purge the repository.")) |
39 | @@ -1457,7 +1457,7 @@ |
40 | # Allow an empty passphrase for the key though to allow a non-empty |
41 | # symmetric key |
42 | if (globals.gpg_profile.signing_passphrase and |
43 | - globals.gpg_profile.passphrase != globals.gpg_profile.signing_passphrase): |
44 | + globals.gpg_profile.passphrase != globals.gpg_profile.signing_passphrase): |
45 | log.FatalError(_("When using symmetric encryption, the signing passphrase must equal the encryption passphrase."), log.ErrorCode.user_error) |
46 | |
47 | if action == "full": |
48 | |
49 | === modified file 'duplicity/backend.py' |
50 | --- duplicity/backend.py 2014-06-28 14:43:36 +0000 |
51 | +++ duplicity/backend.py 2014-10-27 03:02:31 +0000 |
52 | @@ -202,7 +202,7 @@ |
53 | break |
54 | |
55 | if factory is None: |
56 | - if not pu.scheme in _backends: |
57 | + if pu.scheme not in _backends: |
58 | raise UnsupportedBackendScheme(url_string) |
59 | else: |
60 | factory = _backends[pu.scheme] |
61 | |
62 | === modified file 'duplicity/backends/_boto_multi.py' |
63 | --- duplicity/backends/_boto_multi.py 2014-04-28 02:49:39 +0000 |
64 | +++ duplicity/backends/_boto_multi.py 2014-10-27 03:02:31 +0000 |
65 | @@ -186,7 +186,7 @@ |
66 | def _upload_callback(uploaded, total): |
67 | worker_name = multiprocessing.current_process().name |
68 | log.Debug("%s: Uploaded %s/%s bytes" % (worker_name, uploaded, total)) |
69 | - if not queue is None: |
70 | + if queue is not None: |
71 | queue.put([uploaded, total]) # Push data to the consumer thread |
72 | |
73 | def _upload(num_retries): |
74 | |
75 | === modified file 'duplicity/backends/_boto_single.py' |
76 | --- duplicity/backends/_boto_single.py 2014-04-28 02:49:39 +0000 |
77 | +++ duplicity/backends/_boto_single.py 2014-10-27 03:02:31 +0000 |
78 | @@ -254,7 +254,7 @@ |
79 | # AssertionError: Got list: [] |
80 | # Wanted: ['testfile'] |
81 | # Because of the need for this optimization, it should be left as is. |
82 | - #for k in self.bucket.list(prefix = self.key_prefix + 'd', delimiter = '/'): |
83 | + # for k in self.bucket.list(prefix = self.key_prefix + 'd', delimiter = '/'): |
84 | filename_list = [] |
85 | for k in self.bucket.list(prefix=self.key_prefix, delimiter='/'): |
86 | try: |
87 | |
88 | === modified file 'duplicity/backends/_ssh_paramiko.py' |
89 | --- duplicity/backends/_ssh_paramiko.py 2014-04-28 02:49:39 +0000 |
90 | +++ duplicity/backends/_ssh_paramiko.py 2014-10-27 03:02:31 +0000 |
91 | @@ -91,7 +91,7 @@ |
92 | sys.stdout.write(question) |
93 | choice = raw_input().lower() |
94 | if choice in ['yes','y']: |
95 | - super(AgreedAddPolicy, self).missing_host_key(client, hostname, key) |
96 | + paramiko.AutoAddPolicy.missing_host_key(self, client, hostname, key) |
97 | return |
98 | elif choice in ['no','n']: |
99 | raise AuthenticityException( hostname ) |
100 | @@ -158,26 +158,26 @@ |
101 | # update with user's config file |
102 | self.config.update(self.gethostconfig('~/.ssh/config',parsed_url.hostname)) |
103 | # update with url values |
104 | - ## username from url |
105 | + # username from url |
106 | if parsed_url.username: |
107 | self.config.update({'user':parsed_url.username}) |
108 | - ## username from input |
109 | - if not 'user' in self.config: |
110 | + # username from input |
111 | + if 'user' not in self.config: |
112 | self.config.update({'user':getpass.getuser()}) |
113 | - ## port from url |
114 | + # port from url |
115 | if parsed_url.port: |
116 | self.config.update({'port':parsed_url.port}) |
117 | - ## ensure there is deafult 22 or an int value |
118 | + # ensure there is deafult 22 or an int value |
119 | if 'port' in self.config: |
120 | self.config.update({'port':int(self.config['port'])}) |
121 | else: |
122 | self.config.update({'port':22}) |
123 | - ## alternative ssh private key, identity file |
124 | + # alternative ssh private key, identity file |
125 | m=re.search("-oidentityfile=(\S+)",globals.ssh_options,re.I) |
126 | if (m!=None): |
127 | keyfilename=m.group(1) |
128 | self.config['identityfile'] = keyfilename |
129 | - ## ensure ~ is expanded and identity exists in dictionary |
130 | + # ensure ~ is expanded and identity exists in dictionary |
131 | if 'identityfile' in self.config: |
132 | if not isinstance(self.config['identityfile'], list): |
133 | # Paramiko 1.9.0 and earlier do not support multiple |
134 | @@ -197,7 +197,7 @@ |
135 | |
136 | # get password, enable prompt if askpass is set |
137 | self.use_getpass = globals.ssh_askpass |
138 | - ## set url values for beautiful login prompt |
139 | + # set url values for beautiful login prompt |
140 | parsed_url.username = self.config['user'] |
141 | parsed_url.hostname = self.config['hostname'] |
142 | password = self.get_password() |
143 | |
144 | === modified file 'duplicity/backends/cfbackend.py' |
145 | --- duplicity/backends/cfbackend.py 2014-04-28 02:49:39 +0000 |
146 | +++ duplicity/backends/cfbackend.py 2014-10-27 03:02:31 +0000 |
147 | @@ -22,7 +22,7 @@ |
148 | from duplicity import globals |
149 | |
150 | if (globals.cf_backend and |
151 | - globals.cf_backend.lower().strip() == 'pyrax'): |
152 | + globals.cf_backend.lower().strip() == 'pyrax'): |
153 | from ._cf_pyrax import PyraxBackend as CFBackend |
154 | else: |
155 | from ._cf_cloudfiles import CloudFilesBackend as CFBackend |
156 | |
157 | === modified file 'duplicity/backends/copycombackend.py' |
158 | --- duplicity/backends/copycombackend.py 2014-06-16 15:51:30 +0000 |
159 | +++ duplicity/backends/copycombackend.py 2014-10-27 03:02:31 +0000 |
160 | @@ -208,7 +208,7 @@ |
161 | return res['children'] |
162 | |
163 | def remove(self, paths): |
164 | - if isinstance(paths, basestring): |
165 | + if isinstance(paths, str): |
166 | if not len(paths): |
167 | raise CoPyCloud.Error("Impossible to remove a file with an empty path") |
168 | paths = [paths] |
169 | |
170 | === modified file 'duplicity/backends/dpbxbackend.py' |
171 | --- duplicity/backends/dpbxbackend.py 2014-10-17 13:24:53 +0000 |
172 | +++ duplicity/backends/dpbxbackend.py 2014-10-27 03:02:31 +0000 |
173 | @@ -143,7 +143,7 @@ |
174 | self.sess = StoredSession(etacsufbo(APP_KEY) |
175 | , etacsufbo(APP_SECRET) |
176 | , access_type=ACCESS_TYPE) |
177 | - # , locale='en') |
178 | + # , locale='en') |
179 | self.api_client = client.DropboxClient(self.sess) |
180 | self.sess.load_creds() |
181 | |
182 | |
183 | === modified file 'duplicity/backends/imapbackend.py' |
184 | --- duplicity/backends/imapbackend.py 2014-04-28 02:49:39 +0000 |
185 | +++ duplicity/backends/imapbackend.py 2014-10-27 03:02:31 +0000 |
186 | @@ -159,7 +159,7 @@ |
187 | if result != "OK": |
188 | raise Exception(list[0]) |
189 | |
190 | - #check if there is any result |
191 | + # check if there is any result |
192 | if list[0] == '': |
193 | raise Exception("no mail with subject %s") |
194 | |
195 | |
196 | === modified file 'duplicity/backends/par2backend.py' |
197 | --- duplicity/backends/par2backend.py 2014-05-12 07:09:00 +0000 |
198 | +++ duplicity/backends/par2backend.py 2014-10-27 03:02:31 +0000 |
199 | @@ -131,7 +131,7 @@ |
200 | else: |
201 | log.Warn("Repair successful %s" % remote_filename) |
202 | except BackendException: |
203 | - #par2 file not available |
204 | + # par2 file not available |
205 | pass |
206 | finally: |
207 | local_path_temp.rename(local_path) |
208 | |
209 | === modified file 'duplicity/backends/sshbackend.py' |
210 | --- duplicity/backends/sshbackend.py 2014-04-28 02:49:39 +0000 |
211 | +++ duplicity/backends/sshbackend.py 2014-10-27 03:02:31 +0000 |
212 | @@ -26,7 +26,7 @@ |
213 | log.Warn(_("Warning: Option %s is supported by ssh pexpect backend only and will be ignored.") % option) |
214 | |
215 | if (globals.ssh_backend and |
216 | - globals.ssh_backend.lower().strip() == 'pexpect'): |
217 | + globals.ssh_backend.lower().strip() == 'pexpect'): |
218 | from ._ssh_pexpect import SSHPExpectBackend as SSHBackend |
219 | else: |
220 | # take user by the hand to prevent typo driven bug reports |
221 | |
222 | === modified file 'duplicity/backends/swiftbackend.py' |
223 | --- duplicity/backends/swiftbackend.py 2014-10-18 12:09:51 +0000 |
224 | +++ duplicity/backends/swiftbackend.py 2014-10-27 03:02:31 +0000 |
225 | @@ -78,7 +78,7 @@ |
226 | container_metadata = self.conn.head_container(self.container) |
227 | except ClientException: |
228 | pass |
229 | - except Exception, e: |
230 | + except Exception as e: |
231 | log.FatalError("Connection failed: %s %s" |
232 | % (e.__class__.__name__, str(e)), |
233 | log.ErrorCode.connection_failed) |
234 | @@ -87,7 +87,7 @@ |
235 | log.Info("Creating container %s" % self.container) |
236 | try: |
237 | self.conn.put_container(self.container) |
238 | - except Exception, e: |
239 | + except Exception as e: |
240 | log.FatalError("Container creation failed: %s %s" |
241 | % (e.__class__.__name__, str(e)), |
242 | log.ErrorCode.connection_failed) |
243 | |
244 | === modified file 'duplicity/backends/webdavbackend.py' |
245 | --- duplicity/backends/webdavbackend.py 2014-06-28 14:43:36 +0000 |
246 | +++ duplicity/backends/webdavbackend.py 2014-10-27 03:02:31 +0000 |
247 | @@ -343,7 +343,7 @@ |
248 | # feel we want to bail out if the hostname |
249 | # does not match until someone has looked into |
250 | # what the WebDAV protocol mandages. |
251 | - if not parsed_url.hostname is None \ |
252 | + if parsed_url.hostname is not None \ |
253 | and not (parsed_url.hostname == self.parsed_url.hostname): |
254 | m = "Received filename was in the form of a "\ |
255 | "full url, but the hostname (%s) did "\ |
256 | @@ -368,10 +368,10 @@ |
257 | target_file = local_path.open("wb") |
258 | response = self.request("GET", url) |
259 | if response.status == 200: |
260 | - #data=response.read() |
261 | + # data=response.read() |
262 | target_file.write(response.read()) |
263 | - #import hashlib |
264 | - #log.Info("WebDAV GOT %s bytes with md5=%s" % (len(data),hashlib.md5(data).hexdigest()) ) |
265 | + # import hashlib |
266 | + # log.Info("WebDAV GOT %s bytes with md5=%s" % (len(data),hashlib.md5(data).hexdigest()) ) |
267 | assert not target_file.close() |
268 | response.close() |
269 | else: |
270 | |
271 | === modified file 'duplicity/collections.py' |
272 | --- duplicity/collections.py 2014-04-25 23:53:46 +0000 |
273 | +++ duplicity/collections.py 2014-10-27 03:02:31 +0000 |
274 | @@ -88,7 +88,7 @@ |
275 | if pr.time != self.time: |
276 | return False |
277 | if (pr.start_time != self.start_time or |
278 | - pr.end_time != self.end_time): |
279 | + pr.end_time != self.end_time): |
280 | return False |
281 | if bool(pr.encrypted) != bool(self.encrypted): |
282 | if self.partial and pr.encrypted: |
283 | @@ -132,10 +132,10 @@ |
284 | for local_filename in globals.archive_dir.listdir(): |
285 | pr = file_naming.parse(local_filename) |
286 | if (pr and pr.manifest |
287 | - and pr.type == self.type |
288 | - and pr.time == self.time |
289 | - and pr.start_time == self.start_time |
290 | - and pr.end_time == self.end_time): |
291 | + and pr.type == self.type |
292 | + and pr.time == self.time |
293 | + and pr.start_time == self.start_time |
294 | + and pr.end_time == self.end_time): |
295 | self.local_manifest_path = \ |
296 | globals.archive_dir.append(local_filename) |
297 | break |
298 | @@ -154,9 +154,9 @@ |
299 | for lfn in globals.archive_dir.listdir(): |
300 | pr = file_naming.parse(lfn) |
301 | if (pr |
302 | - and pr.time == self.time |
303 | - and pr.start_time == self.start_time |
304 | - and pr.end_time == self.end_time): |
305 | + and pr.time == self.time |
306 | + and pr.start_time == self.start_time |
307 | + and pr.end_time == self.end_time): |
308 | try: |
309 | globals.archive_dir.append(lfn).delete() |
310 | except Exception: |
311 | @@ -225,9 +225,9 @@ |
312 | try: |
313 | manifest_buffer = self.backend.get_data(self.remote_manifest_name) |
314 | except GPGError as message: |
315 | - #TODO: We check for gpg v1 and v2 messages, should be an error code. |
316 | + # TODO: We check for gpg v1 and v2 messages, should be an error code |
317 | if ("secret key not available" in message.args[0] or |
318 | - "No secret key" in message.args[0]): |
319 | + "No secret key" in message.args[0]): |
320 | return None |
321 | else: |
322 | raise |
323 | @@ -310,8 +310,8 @@ |
324 | self.incset_list.append(incset) |
325 | else: |
326 | if (self.incset_list |
327 | - and incset.start_time == self.incset_list[-1].start_time |
328 | - and incset.end_time > self.incset_list[-1]): |
329 | + and incset.start_time == self.incset_list[-1].start_time |
330 | + and incset.end_time > self.incset_list[-1]): |
331 | log.Info(_("Preferring Backupset over previous one!")) |
332 | self.incset_list[-1] = incset |
333 | else: |
334 | @@ -1011,7 +1011,7 @@ |
335 | matched_sig_chain = self.matched_chain_pair[0] |
336 | for sig_chain in self.all_sig_chains: |
337 | if (sig_chain.start_time == matched_sig_chain.start_time and |
338 | - sig_chain.end_time == matched_sig_chain.end_time): |
339 | + sig_chain.end_time == matched_sig_chain.end_time): |
340 | old_sig_chains.remove(sig_chain) |
341 | ext_containers += old_sig_chains |
342 | for set_or_chain in ext_containers: |
343 | |
344 | === modified file 'duplicity/commandline.py' |
345 | --- duplicity/commandline.py 2014-09-30 13:22:24 +0000 |
346 | +++ duplicity/commandline.py 2014-10-27 03:02:31 +0000 |
347 | @@ -659,7 +659,7 @@ |
348 | |
349 | # expand pathname args, but not URL |
350 | for loc in range(len(args)): |
351 | - if not '://' in args[loc]: |
352 | + if '://' not in args[loc]: |
353 | args[loc] = expand_fn(args[loc]) |
354 | |
355 | # Note that ProcessCommandLine depends on us verifying the arg |
356 | |
357 | === modified file 'duplicity/dup_time.py' |
358 | --- duplicity/dup_time.py 2014-04-25 23:53:46 +0000 |
359 | +++ duplicity/dup_time.py 2014-10-27 03:02:31 +0000 |
360 | @@ -191,7 +191,7 @@ |
361 | if not match: |
362 | error() |
363 | num, ext = int(match.group(1)), match.group(2) |
364 | - if not ext in _interval_conv_dict or num < 0: |
365 | + if ext not in _interval_conv_dict or num < 0: |
366 | error() |
367 | total += num*_interval_conv_dict[ext] |
368 | interval_string = interval_string[match.end(0):] |
369 | |
370 | === modified file 'duplicity/file_naming.py' |
371 | --- duplicity/file_naming.py 2014-04-17 21:49:37 +0000 |
372 | +++ duplicity/file_naming.py 2014-10-27 03:02:31 +0000 |
373 | @@ -382,13 +382,13 @@ |
374 | Set encryption and compression flags in ParseResults pr |
375 | """ |
376 | if (filename.endswith('.z') or |
377 | - not globals.short_filenames and filename.endswith('gz')): |
378 | + not globals.short_filenames and filename.endswith('gz')): |
379 | pr.compressed = 1 |
380 | else: |
381 | pr.compressed = None |
382 | |
383 | if (filename.endswith('.g') or |
384 | - not globals.short_filenames and filename.endswith('.gpg')): |
385 | + not globals.short_filenames and filename.endswith('.gpg')): |
386 | pr.encrypted = 1 |
387 | else: |
388 | pr.encrypted = None |
389 | |
390 | === modified file 'duplicity/gpg.py' |
391 | --- duplicity/gpg.py 2014-04-20 06:06:34 +0000 |
392 | +++ duplicity/gpg.py 2014-10-27 03:02:31 +0000 |
393 | @@ -397,7 +397,7 @@ |
394 | hash should be "MD5" or "SHA1". The output will be in hexadecimal |
395 | form if hex is true, and in text (base64) otherwise. |
396 | """ |
397 | - #assert path.isreg() |
398 | + # assert path.isreg() |
399 | fp = path.open("rb") |
400 | if hash == "SHA1": |
401 | hash_obj = sha1() |
402 | |
403 | === modified file 'duplicity/lazy.py' |
404 | --- duplicity/lazy.py 2014-04-18 14:32:30 +0000 |
405 | +++ duplicity/lazy.py 2014-10-27 03:02:31 +0000 |
406 | @@ -178,7 +178,7 @@ |
407 | except StopIteration: |
408 | # call closing_func if necessary |
409 | if (forkposition == starting_forkposition and |
410 | - not called_closing_func[0]): |
411 | + not called_closing_func[0]): |
412 | closing_func() |
413 | called_closing_func[0] = None |
414 | raise StopIteration |
415 | |
416 | === modified file 'duplicity/log.py' |
417 | --- duplicity/log.py 2014-04-16 20:45:09 +0000 |
418 | +++ duplicity/log.py 2014-10-27 03:02:31 +0000 |
419 | @@ -72,7 +72,7 @@ |
420 | # If all the backends kindly gave us unicode, we could enable this next |
421 | # assert line. As it is, we'll attempt to convert s to unicode if we |
422 | # are handed bytes. One day we should update the backends. |
423 | - #assert isinstance(s, unicode) |
424 | + # assert isinstance(s, unicode) |
425 | if not isinstance(s, unicode): |
426 | s = s.decode("utf8", "replace") |
427 | |
428 | @@ -99,7 +99,7 @@ |
429 | diff_file_deleted = 6 |
430 | patch_file_writing = 7 |
431 | patch_file_patching = 8 |
432 | - #file_list = 9 # 9 isn't used anymore. It corresponds to an older syntax for listing files |
433 | + # file_list = 9 # 9 isn't used anymore. It corresponds to an older syntax for listing files |
434 | file_list = 10 |
435 | synchronous_upload_begin = 11 |
436 | asynchronous_upload_begin = 12 |
437 | @@ -261,7 +261,7 @@ |
438 | boto_calling_format = 26 |
439 | ftp_ncftp_missing = 27 |
440 | ftp_ncftp_too_old = 28 |
441 | - #ftp_ncftp_v320 = 29 # moved to warning |
442 | + # ftp_ncftp_v320 = 29 # moved to warning |
443 | exception = 30 |
444 | gpg_failed = 31 |
445 | s3_bucket_not_style = 32 |
446 | |
447 | === modified file 'duplicity/manifest.py' |
448 | --- duplicity/manifest.py 2014-04-25 23:20:12 +0000 |
449 | +++ duplicity/manifest.py 2014-10-27 03:02:31 +0000 |
450 | @@ -217,7 +217,7 @@ |
451 | return False |
452 | |
453 | if (self.hostname != other.hostname or |
454 | - self.local_dirname != other.local_dirname): |
455 | + self.local_dirname != other.local_dirname): |
456 | log.Notice(_("Manifests not equal because hosts or directories differ")) |
457 | return False |
458 | |
459 | |
460 | === modified file 'duplicity/patchdir.py' |
461 | --- duplicity/patchdir.py 2014-04-29 23:49:01 +0000 |
462 | +++ duplicity/patchdir.py 2014-10-27 03:02:31 +0000 |
463 | @@ -379,7 +379,7 @@ |
464 | def yield_tuples( iter_num, overflow, elems ): |
465 | while 1: |
466 | setrorps( overflow, elems ) |
467 | - if not None in overflow: |
468 | + if None not in overflow: |
469 | break |
470 | |
471 | index = getleastindex( elems ) |
472 | |
473 | === modified file 'duplicity/path.py' |
474 | --- duplicity/path.py 2014-06-28 15:48:11 +0000 |
475 | +++ duplicity/path.py 2014-10-27 03:02:31 +0000 |
476 | @@ -372,7 +372,7 @@ |
477 | (other.getperms(), self.getperms())) |
478 | return 0 |
479 | if ((int(self.stat.st_mtime) != int(other.stat.st_mtime)) and |
480 | - (self.stat.st_mtime > 0 or other.stat.st_mtime > 0)): |
481 | + (self.stat.st_mtime > 0 or other.stat.st_mtime > 0)): |
482 | log_diff(_("File %%s has mtime %s, expected %s") % |
483 | (dup_time.timetopretty(int(other.stat.st_mtime)), |
484 | dup_time.timetopretty(int(self.stat.st_mtime)))) |
485 | |
486 | === modified file 'duplicity/progress.py' |
487 | --- duplicity/progress.py 2014-04-20 14:02:34 +0000 |
488 | +++ duplicity/progress.py 2014-10-27 03:02:31 +0000 |
489 | @@ -60,7 +60,7 @@ |
490 | """ |
491 | snapshot = Snapshot() |
492 | # If restarting Full, discard marshalled data and start over |
493 | - if not globals.restart is None and globals.restart.start_vol >= 1: |
494 | + if globals.restart is not None and globals.restart.start_vol >= 1: |
495 | try: |
496 | progressfd = open('%s/progress' % globals.archive_dir.name, 'r') |
497 | snapshot = pickle.load(progressfd) |
498 | @@ -132,7 +132,7 @@ |
499 | If backup is interrupted, next restart will deserialize the data and try start |
500 | progress from the snapshot |
501 | """ |
502 | - if not self.prev_data is None: |
503 | + if self.prev_data is not None: |
504 | self.prev_data.push_snapshot(volume, self.progress_estimation) |
505 | self.prev_data.marshall() |
506 | |
507 | @@ -141,7 +141,7 @@ |
508 | Returns true if the progress computation is on and duplicity has not |
509 | yet started the first dry-run pass to collect some information |
510 | """ |
511 | - return (not self.total_stats is None) |
512 | + return (self.total_stats is not None) |
513 | |
514 | def log_upload_progress(self): |
515 | """ |
516 | @@ -153,7 +153,7 @@ |
517 | current_time = datetime.now() |
518 | if self.start_time is None: |
519 | self.start_time = current_time |
520 | - if not self.last_time is None: |
521 | + if self.last_time is not None: |
522 | elapsed = (current_time - self.last_time) |
523 | else: |
524 | elapsed = timedelta() |
525 | @@ -310,7 +310,7 @@ |
526 | """ |
527 | global tracker |
528 | global progress_thread |
529 | - if not progress_thread is None and not tracker is None: |
530 | + if progress_thread is not None and tracker is not None: |
531 | tracker.annotate_written_bytes(bytecount) |
532 | |
533 | |
534 | |
535 | === modified file 'duplicity/robust.py' |
536 | --- duplicity/robust.py 2014-04-17 20:50:57 +0000 |
537 | +++ duplicity/robust.py 2014-10-27 03:02:31 +0000 |
538 | @@ -35,10 +35,10 @@ |
539 | |
540 | try: |
541 | return function(*args) |
542 | - #except (EnvironmentError, SkipFileException, DSRPPermError, |
543 | - # RPathException, Rdiff.RdiffException, |
544 | - # librsync.librsyncError, C.UnknownFileTypeError), exc: |
545 | - # TracebackArchive.add() |
546 | + # except (EnvironmentError, SkipFileException, DSRPPermError, |
547 | + # RPathException, Rdiff.RdiffException, |
548 | + # librsync.librsyncError, C.UnknownFileTypeError), exc: |
549 | + # TracebackArchive.add() |
550 | except (IOError, EnvironmentError, librsync.librsyncError, path.PathException) as exc: |
551 | if (not isinstance(exc, EnvironmentError) or |
552 | ((exc[0] in errno.errorcode) |
553 | @@ -46,11 +46,11 @@ |
554 | ['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST', |
555 | 'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY', |
556 | 'EIO', 'ETXTBSY', 'ESRCH', 'EINVAL'])): |
557 | - #Log.exception() |
558 | + # Log.exception() |
559 | if error_handler: |
560 | return error_handler(exc, *args) |
561 | else: |
562 | - #Log.exception(1, 2) |
563 | + # Log.exception(1, 2) |
564 | raise |
565 | |
566 | def listpath(path): |
567 | |
568 | === modified file 'duplicity/selection.py' |
569 | --- duplicity/selection.py 2014-04-25 23:53:46 +0000 |
570 | +++ duplicity/selection.py 2014-10-27 03:02:31 +0000 |
571 | @@ -146,7 +146,7 @@ |
572 | error_handler, Path.append, (path, filename)) |
573 | # make sure file is read accessible |
574 | if (new_path and new_path.type in ["reg", "dir"] |
575 | - and not os.access(new_path.name, os.R_OK)): |
576 | + and not os.access(new_path.name, os.R_OK)): |
577 | log.Warn(_("Error accessing possibly locked file %s") % util.ufn(new_path.name), |
578 | log.WarningCode.cannot_read, |
579 | util.escape(new_path.name)) |
580 | @@ -283,7 +283,7 @@ |
581 | def parse_last_excludes(self): |
582 | """Exit with error if last selection function isn't an exclude""" |
583 | if (self.selection_functions and |
584 | - not self.selection_functions[-1].exclude): |
585 | + not self.selection_functions[-1].exclude): |
586 | log.FatalError(_( |
587 | """Last selection expression: |
588 | %s |
589 | @@ -548,7 +548,7 @@ |
590 | """Return selection function based on tuple""" |
591 | def include_sel_func(path): |
592 | if (path.index == tuple[:len(path.index)] or |
593 | - path.index[:len(tuple)] == tuple): |
594 | + path.index[:len(tuple)] == tuple): |
595 | return 1 # /foo/bar implicitly matches /foo, vice-versa |
596 | else: |
597 | return None |
598 | |
599 | === modified file 'duplicity/statistics.py' |
600 | --- duplicity/statistics.py 2014-04-25 23:53:46 +0000 |
601 | +++ duplicity/statistics.py 2014-10-27 03:02:31 +0000 |
602 | @@ -227,7 +227,7 @@ |
603 | if len(line_parts) < 2: |
604 | error(line) |
605 | attr, value_string = line_parts[:2] |
606 | - if not attr in self.stat_attrs: |
607 | + if attr not in self.stat_attrs: |
608 | error(line) |
609 | try: |
610 | try: |
611 | |
612 | === modified file 'duplicity/tempdir.py' |
613 | --- duplicity/tempdir.py 2014-04-20 05:58:47 +0000 |
614 | +++ duplicity/tempdir.py 2014-10-27 03:02:31 +0000 |
615 | @@ -233,7 +233,7 @@ |
616 | """ |
617 | self.__lock.acquire() |
618 | try: |
619 | - if not self.__dir is None: |
620 | + if self.__dir is not None: |
621 | for file in self.__pending.keys(): |
622 | try: |
623 | log.Debug(_("Removing still remembered temporary file %s") % util.ufn(file)) |
624 | |
625 | === modified file 'setup.py' |
626 | --- setup.py 2014-05-11 11:50:12 +0000 |
627 | +++ setup.py 2014-10-27 03:02:31 +0000 |
628 | @@ -29,7 +29,7 @@ |
629 | version_string = "$version" |
630 | |
631 | if sys.version_info[:2] < (2, 6): |
632 | - print "Sorry, duplicity requires version 2.6 or later of python" |
633 | + print("Sorry, duplicity requires version 2.6 or later of python") |
634 | sys.exit(1) |
635 | |
636 | incdir_list = libdir_list = None |