duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #03606
[Merge] lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes into lp:duplicity
Aaron Whitehouse has proposed merging lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
For more details, see:
https://code.launchpad.net/~aaron-whitehouse/duplicity/PEP8_W503_fixes/+merge/298468
Fix PEP8 W503 errors (line break before binary operator) and enable the PEP8 test for this in test_code.CodeTest.
--
Your team duplicity-team is requested to review the proposed merge of lp:~aaron-whitehouse/duplicity/PEP8_W503_fixes into lp:duplicity.
=== modified file 'bin/duplicity'
--- bin/duplicity 2016-06-12 13:13:57 +0000
+++ bin/duplicity 2016-06-27 21:32:49 +0000
@@ -128,17 +128,17 @@
# check if we can reuse an already set (signing_)passphrase
# if signing key is also an encryption key assume that the passphrase is identical
- if (for_signing
- and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients
- or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients)
- and 'PASSPHRASE' in os.environ): # noqa
+ if (for_signing and
+ (globals.gpg_profile.sign_key in globals.gpg_profile.recipients or
+ globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) and
+ 'PASSPHRASE' in os.environ): # noqa
log.Notice(_("Reuse configured PASSPHRASE as SIGN_PASSPHRASE"))
return os.environ['PASSPHRASE']
# if one encryption key is also the signing key assume that the passphrase is identical
- if (not for_signing
- and (globals.gpg_profile.sign_key in globals.gpg_profile.recipients
- or globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients)
- and 'SIGN_PASSPHRASE' in os.environ): # noqa
+ if (not for_signing and
+ (globals.gpg_profile.sign_key in globals.gpg_profile.recipients or
+ globals.gpg_profile.sign_key in globals.gpg_profile.hidden_recipients) and
+ 'SIGN_PASSPHRASE' in os.environ): # noqa
log.Notice(_("Reuse configured SIGN_PASSPHRASE as PASSPHRASE"))
return os.environ['SIGN_PASSPHRASE']
@@ -164,18 +164,16 @@
# for a full backup, we don't need a password if
# there is no sign_key and there are recipients
- elif (action == "full"
- and (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients)
- and not globals.gpg_profile.sign_key
- and not globals.restart):
+ elif (action == "full" and
+ (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients) and not
+ globals.gpg_profile.sign_key and not globals.restart):
return ""
# for an inc backup, we don't need a password if
# there is no sign_key and there are recipients
- elif (action == "inc"
- and (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients)
- and not globals.gpg_profile.sign_key
- and not globals.restart):
+ elif (action == "inc" and
+ (globals.gpg_profile.recipients or globals.gpg_profile.hidden_recipients) and not
+ globals.gpg_profile.sign_key and not globals.restart):
return ""
# Finally, ask the user for the passphrase
@@ -900,8 +898,7 @@
if globals.force:
log.Notice(ngettext("Deleting this file from backend:",
"Deleting these files from backend:",
- len(extraneous))
- + u"\n" + filestr)
+ len(extraneous)) + u"\n" + filestr)
if not globals.dry_run:
col_stats.backend.delete(ext_remote)
for fn in ext_local:
@@ -912,9 +909,8 @@
else:
log.Notice(ngettext("Found the following file to delete:",
"Found the following files to delete:",
- len(extraneous))
- + u"\n" + filestr + u"\n"
- + _("Run duplicity again with the --force option to actually delete."))
+ len(extraneous)) + u"\n" + filestr + u"\n" +
+ _("Run duplicity again with the --force option to actually delete."))
def remove_all_but_n_full(col_stats):
@@ -1193,11 +1189,11 @@
copy_to_local(fn)
else:
if local_missing:
- log.Notice(_("Sync would copy the following from remote to local:")
- + u"\n" + u"\n".join(map(util.ufn, local_missing)))
+ log.Notice(_("Sync would copy the following from remote to local:") +
+ u"\n" + u"\n".join(map(util.ufn, local_missing)))
if local_spurious:
- log.Notice(_("Sync would remove the following spurious local files:")
- + u"\n" + u"\n".join(map(util.ufn, local_spurious)))
+ log.Notice(_("Sync would remove the following spurious local files:") +
+ u"\n" + u"\n".join(map(util.ufn, local_spurious)))
def check_last_manifest(col_stats):
@@ -1244,8 +1240,8 @@
# Calculate space we need for at least 2 volumes of full or inc
# plus about 30% of one volume for the signature files.
freespace = stats[statvfs.F_FRSIZE] * stats[statvfs.F_BAVAIL]
- needspace = (((globals.async_concurrency + 1) * globals.volsize)
- + int(0.30 * globals.volsize))
+ needspace = (((globals.async_concurrency + 1) * globals.volsize) +
+ int(0.30 * globals.volsize))
if freespace < needspace:
log.FatalError(_("Temp space has %d available, backup needs approx %d.") %
(freespace, needspace), log.ErrorCode.not_enough_freespace)
=== modified file 'duplicity/collections.py'
--- duplicity/collections.py 2016-06-24 15:57:28 +0000
+++ duplicity/collections.py 2016-06-27 21:32:49 +0000
@@ -138,11 +138,10 @@
for local_filename in globals.archive_dir.listdir():
pr = file_naming.parse(local_filename)
- if (pr and pr.manifest
- and pr.type == self.type
- and pr.time == self.time
- and pr.start_time == self.start_time
- and pr.end_time == self.end_time):
+ if (pr and pr.manifest and pr.type == self.type and
+ pr.time == self.time and
+ pr.start_time == self.start_time and
+ pr.end_time == self.end_time):
self.local_manifest_path = \
globals.archive_dir.append(local_filename)
@@ -162,10 +161,9 @@
pass
for lfn in globals.archive_dir.listdir():
pr = file_naming.parse(lfn)
- if (pr
- and pr.time == self.time
- and pr.start_time == self.start_time
- and pr.end_time == self.end_time):
+ if (pr and pr.time == self.time and
+ pr.start_time == self.start_time and
+ pr.end_time == self.end_time):
try:
globals.archive_dir.append(lfn).delete()
except Exception:
@@ -323,9 +321,9 @@
if self.end_time == incset.start_time:
self.incset_list.append(incset)
else:
- if (self.incset_list
- and incset.start_time == self.incset_list[-1].start_time
- and incset.end_time > self.incset_list[-1]):
+ if (self.incset_list and
+ incset.start_time == self.incset_list[-1].start_time and
+ incset.end_time > self.incset_list[-1]):
log.Info(_("Preferring Backupset over previous one!"))
self.incset_list[-1] = incset
else:
@@ -773,8 +771,8 @@
"signature file:",
"Warning, found the following local orphaned "
"signature files:",
- len(self.local_orphaned_sig_names))
- + u"\n" + u"\n".join(map(util.ufn, self.local_orphaned_sig_names)),
+ len(self.local_orphaned_sig_names)) + u"\n" +
+ u"\n".join(map(util.ufn, self.local_orphaned_sig_names)),
log.WarningCode.orphaned_sig)
if self.remote_orphaned_sig_names:
@@ -782,8 +780,8 @@
"signature file:",
"Warning, found the following remote orphaned "
"signature files:",
- len(self.remote_orphaned_sig_names))
- + u"\n" + u"\n".join(map(util.ufn, self.remote_orphaned_sig_names)),
+ len(self.remote_orphaned_sig_names)) + u"\n" +
+ u"\n".join(map(util.ufn, self.remote_orphaned_sig_names)),
log.WarningCode.orphaned_sig)
if self.all_sig_chains and sig_chain_warning and not self.matched_chain_pair:
@@ -799,8 +797,8 @@
"backup file:",
"Warning, found the following orphaned "
"backup files:",
- len(self.orphaned_backup_sets))
- + u"\n" + u"\n".join(map(unicode, self.orphaned_backup_sets)),
+ len(self.orphaned_backup_sets)) + u"\n" +
+ u"\n".join(map(unicode, self.orphaned_backup_sets)),
log.WarningCode.orphaned_backup)
def get_backup_chains(self, filename_list):
=== modified file 'duplicity/globmatch.py'
--- duplicity/globmatch.py 2016-06-06 13:43:04 +0000
+++ duplicity/globmatch.py 2016-06-27 21:32:49 +0000
@@ -39,8 +39,8 @@
glob_parts = glob_str.split("/")
if "" in glob_parts[1:-1]:
# "" OK if comes first or last, as in /foo/
- raise GlobbingError("Consecutive '/'s found in globbing string "
- + glob_str)
+ raise GlobbingError("Consecutive '/'s found in globbing string " +
+ glob_str)
prefixes = ["/".join(glob_parts[:i + 1]) for i in range(len(glob_parts))]
# we must make exception for root "/", only dir to end in slash
=== modified file 'duplicity/robust.py'
--- duplicity/robust.py 2015-01-31 23:30:49 +0000
+++ duplicity/robust.py 2016-06-27 21:32:49 +0000
@@ -42,8 +42,8 @@
# TracebackArchive.add()
except (IOError, EnvironmentError, librsync.librsyncError, path.PathException) as exc:
if (not isinstance(exc, EnvironmentError) or
- ((exc[0] in errno.errorcode)
- and errno.errorcode[exc[0]] in
+ ((exc[0] in errno.errorcode) and
+ errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
'EIO', 'ETXTBSY', 'ESRCH', 'EINVAL'])):
=== modified file 'testing/test_code.py'
--- testing/test_code.py 2015-12-23 15:37:06 +0000
+++ testing/test_code.py 2016-06-27 21:32:49 +0000
@@ -92,7 +92,6 @@
"E402", # module level import not at top of file
"E501", # line too long
"E731", # do not assign a lambda expression, use a def
- "W503", # line break before binary operator
]
self.run_checker(["pep8",
"--ignore=" + ','.join(ignores),
Follow ups