Merge lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes into lp:~duplicity-team/duplicity/0.7-series

Proposed by Aaron Whitehouse
Status: Merged
Merged at revision: 1226
Proposed branch: lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 225 lines (+43/-50)
5 files modified
bin/duplicity (+23/-27)
duplicity/collections.py (+16/-18)
duplicity/globmatch.py (+2/-2)
duplicity/robust.py (+2/-2)
testing/test_code.py (+0/-1)
To merge this branch: bzr merge lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+298468@code.launchpad.net

Description of the change

Fix PEP8 W503 errors (line break before binary operator) and enable the PEP8 test for this in test_code.CodeTest.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity'
2--- bin/duplicity 2016-06-12 13:13:57 +0000
3+++ bin/duplicity 2016-06-27 21:41:38 +0000
4@@ -128,17 +128,17 @@
5
6 # check if we can reuse an already set (signing_)passphrase
7 # if signing key is also an encryption key assume that the passphrase is identical
8- if (for_signing
9- and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients
10- or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients)
11- and 'PASSPHRASE' in os.environ): # noqa
12+ if (for_signing and
13+ (globals.gpg_profile.sign_key in globals.gpg_profile.recipients or
14+ globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) and
15+ 'PASSPHRASE' in os.environ): # noqa
16 log.Notice(_("Reuse configured PASSPHRASE as SIGN_PASSPHRASE"))
17 return os.environ['PASSPHRASE']
18 # if one encryption key is also the signing key assume that the passphrase is identical
19- if (not for_signing
20- and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients
21- or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients)
22- and 'SIGN_PASSPHRASE' in os.environ): # noqa
23+ if (not for_signing and
24+ (globals.gpg_profile.sign_key in globals.gpg_profile.recipients or
25+ globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) and
26+ 'SIGN_PASSPHRASE' in os.environ): # noqa
27 log.Notice(_("Reuse configured SIGN_PASSPHRASE as PASSPHRASE"))
28 return os.environ['SIGN_PASSPHRASE']
29
30@@ -164,18 +164,16 @@
31
32 # for a full backup, we don't need a password if
33 # there is no sign_key and there are recipients
34- elif (action == "full"
35- and (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients)
36- and not globals.gpg_profile.sign_key
37- and not globals.restart):
38+ elif (action == "full" and
39+ (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients) and not
40+ globals.gpg_profile.sign_key and not globals.restart):
41 return ""
42
43 # for an inc backup, we don't need a password if
44 # there is no sign_key and there are recipients
45- elif (action == "inc"
46- and (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients)
47- and not globals.gpg_profile.sign_key
48- and not globals.restart):
49+ elif (action == "inc" and
50+ (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients) and not
51+ globals.gpg_profile.sign_key and not globals.restart):
52 return ""
53
54 # Finally, ask the user for the passphrase
55@@ -900,8 +898,7 @@
56 if globals.force:
57 log.Notice(ngettext("Deleting this file from backend:",
58 "Deleting these files from backend:",
59- len(extraneous))
60- + u"\n" + filestr)
61+ len(extraneous)) + u"\n" + filestr)
62 if not globals.dry_run:
63 col_stats.backend.delete(ext_remote)
64 for fn in ext_local:
65@@ -912,9 +909,8 @@
66 else:
67 log.Notice(ngettext("Found the following file to delete:",
68 "Found the following files to delete:",
69- len(extraneous))
70- + u"\n" + filestr + u"\n"
71- + _("Run duplicity again with the --force option to actually delete."))
72+ len(extraneous)) + u"\n" + filestr + u"\n" +
73+ _("Run duplicity again with the --force option to actually delete."))
74
75
76 def remove_all_but_n_full(col_stats):
77@@ -1193,11 +1189,11 @@
78 copy_to_local(fn)
79 else:
80 if local_missing:
81- log.Notice(_("Sync would copy the following from remote to local:")
82- + u"\n" + u"\n".join(map(util.ufn, local_missing)))
83+ log.Notice(_("Sync would copy the following from remote to local:") +
84+ u"\n" + u"\n".join(map(util.ufn, local_missing)))
85 if local_spurious:
86- log.Notice(_("Sync would remove the following spurious local files:")
87- + u"\n" + u"\n".join(map(util.ufn, local_spurious)))
88+ log.Notice(_("Sync would remove the following spurious local files:") +
89+ u"\n" + u"\n".join(map(util.ufn, local_spurious)))
90
91
92 def check_last_manifest(col_stats):
93@@ -1244,8 +1240,8 @@
94 # Calculate space we need for at least 2 volumes of full or inc
95 # plus about 30% of one volume for the signature files.
96 freespace = stats[statvfs.F_FRSIZE] * stats[statvfs.F_BAVAIL]
97- needspace = (((globals.async_concurrency + 1) * globals.volsize)
98- + int(0.30 * globals.volsize))
99+ needspace = (((globals.async_concurrency + 1) * globals.volsize) +
100+ int(0.30 * globals.volsize))
101 if freespace < needspace:
102 log.FatalError(_("Temp space has %d available, backup needs approx %d.") %
103 (freespace, needspace), log.ErrorCode.not_enough_freespace)
104
105=== modified file 'duplicity/collections.py'
106--- duplicity/collections.py 2016-06-24 15:57:28 +0000
107+++ duplicity/collections.py 2016-06-27 21:41:38 +0000
108@@ -138,11 +138,10 @@
109
110 for local_filename in globals.archive_dir.listdir():
111 pr = file_naming.parse(local_filename)
112- if (pr and pr.manifest
113- and pr.type == self.type
114- and pr.time == self.time
115- and pr.start_time == self.start_time
116- and pr.end_time == self.end_time):
117+ if (pr and pr.manifest and pr.type == self.type and
118+ pr.time == self.time and
119+ pr.start_time == self.start_time and
120+ pr.end_time == self.end_time):
121 self.local_manifest_path = \
122 globals.archive_dir.append(local_filename)
123
124@@ -162,10 +161,9 @@
125 pass
126 for lfn in globals.archive_dir.listdir():
127 pr = file_naming.parse(lfn)
128- if (pr
129- and pr.time == self.time
130- and pr.start_time == self.start_time
131- and pr.end_time == self.end_time):
132+ if (pr and pr.time == self.time and
133+ pr.start_time == self.start_time and
134+ pr.end_time == self.end_time):
135 try:
136 globals.archive_dir.append(lfn).delete()
137 except Exception:
138@@ -323,9 +321,9 @@
139 if self.end_time == incset.start_time:
140 self.incset_list.append(incset)
141 else:
142- if (self.incset_list
143- and incset.start_time == self.incset_list[-1].start_time
144- and incset.end_time > self.incset_list[-1]):
145+ if (self.incset_list and
146+ incset.start_time == self.incset_list[-1].start_time and
147+ incset.end_time > self.incset_list[-1]):
148 log.Info(_("Preferring Backupset over previous one!"))
149 self.incset_list[-1] = incset
150 else:
151@@ -773,8 +771,8 @@
152 "signature file:",
153 "Warning, found the following local orphaned "
154 "signature files:",
155- len(self.local_orphaned_sig_names))
156- + u"\n" + u"\n".join(map(util.ufn, self.local_orphaned_sig_names)),
157+ len(self.local_orphaned_sig_names)) + u"\n" +
158+ u"\n".join(map(util.ufn, self.local_orphaned_sig_names)),
159 log.WarningCode.orphaned_sig)
160
161 if self.remote_orphaned_sig_names:
162@@ -782,8 +780,8 @@
163 "signature file:",
164 "Warning, found the following remote orphaned "
165 "signature files:",
166- len(self.remote_orphaned_sig_names))
167- + u"\n" + u"\n".join(map(util.ufn, self.remote_orphaned_sig_names)),
168+ len(self.remote_orphaned_sig_names)) + u"\n" +
169+ u"\n".join(map(util.ufn, self.remote_orphaned_sig_names)),
170 log.WarningCode.orphaned_sig)
171
172 if self.all_sig_chains and sig_chain_warning and not self.matched_chain_pair:
173@@ -799,8 +797,8 @@
174 "backup file:",
175 "Warning, found the following orphaned "
176 "backup files:",
177- len(self.orphaned_backup_sets))
178- + u"\n" + u"\n".join(map(unicode, self.orphaned_backup_sets)),
179+ len(self.orphaned_backup_sets)) + u"\n" +
180+ u"\n".join(map(unicode, self.orphaned_backup_sets)),
181 log.WarningCode.orphaned_backup)
182
183 def get_backup_chains(self, filename_list):
184
185=== modified file 'duplicity/globmatch.py'
186--- duplicity/globmatch.py 2016-06-06 13:43:04 +0000
187+++ duplicity/globmatch.py 2016-06-27 21:41:38 +0000
188@@ -39,8 +39,8 @@
189 glob_parts = glob_str.split("/")
190 if "" in glob_parts[1:-1]:
191 # "" OK if comes first or last, as in /foo/
192- raise GlobbingError("Consecutive '/'s found in globbing string "
193- + glob_str)
194+ raise GlobbingError("Consecutive '/'s found in globbing string " +
195+ glob_str)
196
197 prefixes = ["/".join(glob_parts[:i + 1]) for i in range(len(glob_parts))]
198 # we must make exception for root "/", only dir to end in slash
199
200=== modified file 'duplicity/robust.py'
201--- duplicity/robust.py 2015-01-31 23:30:49 +0000
202+++ duplicity/robust.py 2016-06-27 21:41:38 +0000
203@@ -42,8 +42,8 @@
204 # TracebackArchive.add()
205 except (IOError, EnvironmentError, librsync.librsyncError, path.PathException) as exc:
206 if (not isinstance(exc, EnvironmentError) or
207- ((exc[0] in errno.errorcode)
208- and errno.errorcode[exc[0]] in
209+ ((exc[0] in errno.errorcode) and
210+ errno.errorcode[exc[0]] in
211 ['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
212 'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
213 'EIO', 'ETXTBSY', 'ESRCH', 'EINVAL'])):
214
215=== modified file 'testing/test_code.py'
216--- testing/test_code.py 2015-12-23 15:37:06 +0000
217+++ testing/test_code.py 2016-06-27 21:41:38 +0000
218@@ -92,7 +92,6 @@
219 "E402", # module level import not at top of file
220 "E501", # line too long
221 "E731", # do not assign a lambda expression, use a def
222- "W503", # line break before binary operator
223 ]
224 self.run_checker(["pep8",
225 "--ignore=" + ','.join(ignores),

Subscribers

People subscribed via source and target branches