← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/code-nits into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/code-nits into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/code-nits/+merge/239680

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.
-- 
https://code.launchpad.net/~mterry/duplicity/code-nits/+merge/239680
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/code-nits into lp:duplicity.
=== modified file 'bin/duplicity'
--- bin/duplicity	2014-05-11 11:50:12 +0000
+++ bin/duplicity	2014-10-27 02:30:32 +0000
@@ -94,14 +94,14 @@
         pass
 
     # 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 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 ):
         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 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)
@@ -433,7 +433,7 @@
         bytes_written += waiter()
 
     # Upload the collection summary.
-    #bytes_written += write_manifest(mf, backup_type, backend)
+    # bytes_written += write_manifest(mf, backup_type, backend)
 
     return bytes_written
 
@@ -923,7 +923,7 @@
                   _("Which can't be deleted because newer sets depend on them.")))
 
     if (col_stats.matched_chain_pair and
-        col_stats.matched_chain_pair[1].end_time < globals.remove_time):
+            col_stats.matched_chain_pair[1].end_time < globals.remove_time):
         log.Warn(_("Current active backup chain is older than specified time.  "
                    "However, it will not be deleted.  To remove all your backups, "
                    "manually purge the repository."))
@@ -1457,7 +1457,7 @@
             # Allow an empty passphrase for the key though to allow a non-empty
             # symmetric key
             if (globals.gpg_profile.signing_passphrase and
-                globals.gpg_profile.passphrase != globals.gpg_profile.signing_passphrase):
+                    globals.gpg_profile.passphrase != globals.gpg_profile.signing_passphrase):
                 log.FatalError(_("When using symmetric encryption, the signing passphrase must equal the encryption passphrase."), log.ErrorCode.user_error)
 
         if action == "full":

=== modified file 'duplicity/backend.py'
--- duplicity/backend.py	2014-06-28 14:43:36 +0000
+++ duplicity/backend.py	2014-10-27 02:30:32 +0000
@@ -202,7 +202,7 @@
             break
 
     if factory is None:
-        if not pu.scheme in _backends:
+        if pu.scheme not in _backends:
             raise UnsupportedBackendScheme(url_string)
         else:
             factory = _backends[pu.scheme]

=== modified file 'duplicity/backends/_boto_multi.py'
--- duplicity/backends/_boto_multi.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/_boto_multi.py	2014-10-27 02:30:32 +0000
@@ -186,7 +186,7 @@
     def _upload_callback(uploaded, total):
         worker_name = multiprocessing.current_process().name
         log.Debug("%s: Uploaded %s/%s bytes" % (worker_name, uploaded, total))
-        if not queue is None:
+        if queue is not None:
             queue.put([uploaded, total])  # Push data to the consumer thread
 
     def _upload(num_retries):

=== modified file 'duplicity/backends/_boto_single.py'
--- duplicity/backends/_boto_single.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/_boto_single.py	2014-10-27 02:30:32 +0000
@@ -254,7 +254,7 @@
         #   AssertionError: Got list: []
         #   Wanted: ['testfile']
         # Because of the need for this optimization, it should be left as is.
-        #for k in self.bucket.list(prefix = self.key_prefix + 'd', delimiter = '/'):
+        # for k in self.bucket.list(prefix = self.key_prefix + 'd', delimiter = '/'):
         filename_list = []
         for k in self.bucket.list(prefix=self.key_prefix, delimiter='/'):
             try:

=== modified file 'duplicity/backends/_ssh_paramiko.py'
--- duplicity/backends/_ssh_paramiko.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/_ssh_paramiko.py	2014-10-27 02:30:32 +0000
@@ -158,26 +158,26 @@
         # update with user's config file
         self.config.update(self.gethostconfig('~/.ssh/config',parsed_url.hostname))
         # update with url values
-        ## username from url
+        # username from url
         if parsed_url.username:
             self.config.update({'user':parsed_url.username})
-        ## username from input
-        if not 'user' in self.config:
+        # username from input
+        if 'user' not in self.config:
             self.config.update({'user':getpass.getuser()})
-        ## port from url
+        # port from url
         if parsed_url.port:
             self.config.update({'port':parsed_url.port})
-        ## ensure there is deafult 22 or an int value
+        # ensure there is deafult 22 or an int value
         if 'port' in self.config:
             self.config.update({'port':int(self.config['port'])})
         else:
             self.config.update({'port':22})
-        ## alternative ssh private key, identity file
+        # alternative ssh private key, identity file
         m=re.search("-oidentityfile=(\S+)",globals.ssh_options,re.I)
         if (m!=None):
             keyfilename=m.group(1)
             self.config['identityfile'] = keyfilename
-        ## ensure ~ is expanded and identity exists in dictionary
+        # ensure ~ is expanded and identity exists in dictionary
         if 'identityfile' in self.config:
             if not isinstance(self.config['identityfile'], list):
                 # Paramiko 1.9.0 and earlier do not support multiple
@@ -197,7 +197,7 @@
 
         # get password, enable prompt if askpass is set
         self.use_getpass = globals.ssh_askpass
-        ## set url values for beautiful login prompt
+        # set url values for beautiful login prompt
         parsed_url.username = self.config['user']
         parsed_url.hostname = self.config['hostname']
         password = self.get_password()

=== modified file 'duplicity/backends/cfbackend.py'
--- duplicity/backends/cfbackend.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/cfbackend.py	2014-10-27 02:30:32 +0000
@@ -22,7 +22,7 @@
 from duplicity import globals
 
 if (globals.cf_backend and
-    globals.cf_backend.lower().strip() == 'pyrax'):
+        globals.cf_backend.lower().strip() == 'pyrax'):
     from ._cf_pyrax import PyraxBackend as CFBackend
 else:
     from ._cf_cloudfiles import CloudFilesBackend as CFBackend

=== modified file 'duplicity/backends/copycombackend.py'
--- duplicity/backends/copycombackend.py	2014-06-16 15:51:30 +0000
+++ duplicity/backends/copycombackend.py	2014-10-27 02:30:32 +0000
@@ -208,7 +208,7 @@
         return res['children']
 
     def remove(self, paths):
-        if isinstance(paths, basestring):
+        if isinstance(paths, str):
             if not len(paths):
                 raise CoPyCloud.Error("Impossible to remove a file with an empty path")
             paths = [paths]

=== modified file 'duplicity/backends/dpbxbackend.py'
--- duplicity/backends/dpbxbackend.py	2014-10-17 13:24:53 +0000
+++ duplicity/backends/dpbxbackend.py	2014-10-27 02:30:32 +0000
@@ -143,7 +143,7 @@
         self.sess = StoredSession(etacsufbo(APP_KEY)
                     , etacsufbo(APP_SECRET)
                     , access_type=ACCESS_TYPE)
-                    # , locale='en')
+        #            , locale='en')
         self.api_client = client.DropboxClient(self.sess)
         self.sess.load_creds()
 

=== modified file 'duplicity/backends/imapbackend.py'
--- duplicity/backends/imapbackend.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/imapbackend.py	2014-10-27 02:30:32 +0000
@@ -159,7 +159,7 @@
                 if result != "OK":
                     raise Exception(list[0])
 
-                #check if there is any result
+                # check if there is any result
                 if list[0] == '':
                     raise Exception("no mail with subject %s")
 

=== modified file 'duplicity/backends/par2backend.py'
--- duplicity/backends/par2backend.py	2014-05-12 07:09:00 +0000
+++ duplicity/backends/par2backend.py	2014-10-27 02:30:32 +0000
@@ -131,7 +131,7 @@
                 else:
                     log.Warn("Repair successful %s" % remote_filename)
         except BackendException:
-            #par2 file not available
+            # par2 file not available
             pass
         finally:
             local_path_temp.rename(local_path)

=== modified file 'duplicity/backends/sshbackend.py'
--- duplicity/backends/sshbackend.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/sshbackend.py	2014-10-27 02:30:32 +0000
@@ -26,7 +26,7 @@
         log.Warn(_("Warning: Option %s is supported by ssh pexpect backend only and will be ignored.") % option)
 
 if (globals.ssh_backend and
-    globals.ssh_backend.lower().strip() == 'pexpect'):
+        globals.ssh_backend.lower().strip() == 'pexpect'):
     from ._ssh_pexpect import SSHPExpectBackend as SSHBackend
 else:
     # take user by the hand to prevent typo driven bug reports

=== modified file 'duplicity/backends/swiftbackend.py'
--- duplicity/backends/swiftbackend.py	2014-10-18 12:09:51 +0000
+++ duplicity/backends/swiftbackend.py	2014-10-27 02:30:32 +0000
@@ -78,7 +78,7 @@
             container_metadata = self.conn.head_container(self.container)
         except ClientException:
             pass
-        except Exception, e:
+        except Exception as e:
             log.FatalError("Connection failed: %s %s"
                            % (e.__class__.__name__, str(e)),
                            log.ErrorCode.connection_failed)
@@ -87,7 +87,7 @@
             log.Info("Creating container %s" % self.container)
             try:
                 self.conn.put_container(self.container)
-            except Exception, e:
+            except Exception as e:
                 log.FatalError("Container creation failed: %s %s"
                                % (e.__class__.__name__, str(e)),
                                log.ErrorCode.connection_failed)

=== modified file 'duplicity/backends/webdavbackend.py'
--- duplicity/backends/webdavbackend.py	2014-06-28 14:43:36 +0000
+++ duplicity/backends/webdavbackend.py	2014-10-27 02:30:32 +0000
@@ -343,7 +343,7 @@
         # feel we want to bail out if the hostname
         # does not match until someone has looked into
         # what the WebDAV protocol mandages.
-        if not parsed_url.hostname is None \
+        if parsed_url.hostname is not None \
            and not (parsed_url.hostname == self.parsed_url.hostname):
             m = "Received filename was in the form of a "\
                 "full url, but the hostname (%s) did "\
@@ -368,10 +368,10 @@
             target_file = local_path.open("wb")
             response = self.request("GET", url)
             if response.status == 200:
-                #data=response.read()
+                # data=response.read()
                 target_file.write(response.read())
-                #import hashlib
-                #log.Info("WebDAV GOT %s bytes with md5=%s" % (len(data),hashlib.md5(data).hexdigest()) )
+                # import hashlib
+                # log.Info("WebDAV GOT %s bytes with md5=%s" % (len(data),hashlib.md5(data).hexdigest()) )
                 assert not target_file.close()
                 response.close()
             else:

=== modified file 'duplicity/collections.py'
--- duplicity/collections.py	2014-04-25 23:53:46 +0000
+++ duplicity/collections.py	2014-10-27 02:30:32 +0000
@@ -88,7 +88,7 @@
             if pr.time != self.time:
                 return False
             if (pr.start_time != self.start_time or
-                pr.end_time != self.end_time):
+                    pr.end_time != self.end_time):
                 return False
             if bool(pr.encrypted) != bool(self.encrypted):
                 if self.partial and pr.encrypted:
@@ -132,10 +132,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):
+                    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)
                 break
@@ -154,9 +154,9 @@
         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):
+                    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:
@@ -225,9 +225,9 @@
         try:
             manifest_buffer = self.backend.get_data(self.remote_manifest_name)
         except GPGError as message:
-            #TODO: We check for gpg v1 and v2 messages, should be an error code.
+            # TODO: We check for gpg v1 and v2 messages, should be an error code
             if ("secret key not available" in message.args[0] or
-                "No secret key" in message.args[0]):
+                    "No secret key" in message.args[0]):
                 return None
             else:
                 raise
@@ -310,8 +310,8 @@
             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]):
+                    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:
@@ -1011,7 +1011,7 @@
                 matched_sig_chain = self.matched_chain_pair[0]
                 for sig_chain in self.all_sig_chains:
                     if (sig_chain.start_time == matched_sig_chain.start_time and
-                        sig_chain.end_time == matched_sig_chain.end_time):
+                            sig_chain.end_time == matched_sig_chain.end_time):
                         old_sig_chains.remove(sig_chain)
             ext_containers += old_sig_chains
         for set_or_chain in ext_containers:

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2014-09-30 13:22:24 +0000
+++ duplicity/commandline.py	2014-10-27 02:30:32 +0000
@@ -659,7 +659,7 @@
 
     # expand pathname args, but not URL
     for loc in range(len(args)):
-        if not '://' in args[loc]:
+        if '://' not in args[loc]:
             args[loc] = expand_fn(args[loc])
 
     # Note that ProcessCommandLine depends on us verifying the arg

=== modified file 'duplicity/dup_time.py'
--- duplicity/dup_time.py	2014-04-25 23:53:46 +0000
+++ duplicity/dup_time.py	2014-10-27 02:30:32 +0000
@@ -191,7 +191,7 @@
         if not match:
             error()
         num, ext = int(match.group(1)), match.group(2)
-        if not ext in _interval_conv_dict or num < 0:
+        if ext not in _interval_conv_dict or num < 0:
             error()
         total += num*_interval_conv_dict[ext]
         interval_string = interval_string[match.end(0):]

=== modified file 'duplicity/file_naming.py'
--- duplicity/file_naming.py	2014-04-17 21:49:37 +0000
+++ duplicity/file_naming.py	2014-10-27 02:30:32 +0000
@@ -382,13 +382,13 @@
         Set encryption and compression flags in ParseResults pr
         """
         if (filename.endswith('.z') or
-            not globals.short_filenames and filename.endswith('gz')):
+                not globals.short_filenames and filename.endswith('gz')):
             pr.compressed = 1
         else:
             pr.compressed = None
 
         if (filename.endswith('.g') or
-            not globals.short_filenames and filename.endswith('.gpg')):
+                not globals.short_filenames and filename.endswith('.gpg')):
             pr.encrypted = 1
         else:
             pr.encrypted = None

=== modified file 'duplicity/gpg.py'
--- duplicity/gpg.py	2014-04-20 06:06:34 +0000
+++ duplicity/gpg.py	2014-10-27 02:30:32 +0000
@@ -397,7 +397,7 @@
     hash should be "MD5" or "SHA1".  The output will be in hexadecimal
     form if hex is true, and in text (base64) otherwise.
     """
-    #assert path.isreg()
+    # assert path.isreg()
     fp = path.open("rb")
     if hash == "SHA1":
         hash_obj = sha1()

=== modified file 'duplicity/lazy.py'
--- duplicity/lazy.py	2014-04-18 14:32:30 +0000
+++ duplicity/lazy.py	2014-10-27 02:30:32 +0000
@@ -178,7 +178,7 @@
                 except StopIteration:
                     # call closing_func if necessary
                     if (forkposition == starting_forkposition and
-                        not called_closing_func[0]):
+                            not called_closing_func[0]):
                         closing_func()
                         called_closing_func[0] = None
                     raise StopIteration

=== modified file 'duplicity/log.py'
--- duplicity/log.py	2014-04-16 20:45:09 +0000
+++ duplicity/log.py	2014-10-27 02:30:32 +0000
@@ -72,7 +72,7 @@
     # If all the backends kindly gave us unicode, we could enable this next
     # assert line.  As it is, we'll attempt to convert s to unicode if we
     # are handed bytes.  One day we should update the backends.
-    #assert isinstance(s, unicode)
+    # assert isinstance(s, unicode)
     if not isinstance(s, unicode):
         s = s.decode("utf8", "replace")
 
@@ -99,7 +99,7 @@
     diff_file_deleted = 6
     patch_file_writing = 7
     patch_file_patching = 8
-    #file_list = 9 # 9 isn't used anymore.  It corresponds to an older syntax for listing files
+    # file_list = 9 # 9 isn't used anymore.  It corresponds to an older syntax for listing files
     file_list = 10
     synchronous_upload_begin = 11
     asynchronous_upload_begin = 12
@@ -261,7 +261,7 @@
     boto_calling_format = 26
     ftp_ncftp_missing = 27
     ftp_ncftp_too_old = 28
-    #ftp_ncftp_v320 = 29 # moved to warning
+    # ftp_ncftp_v320 = 29 # moved to warning
     exception = 30
     gpg_failed = 31
     s3_bucket_not_style = 32

=== modified file 'duplicity/manifest.py'
--- duplicity/manifest.py	2014-04-25 23:20:12 +0000
+++ duplicity/manifest.py	2014-10-27 02:30:32 +0000
@@ -217,7 +217,7 @@
                 return False
 
         if (self.hostname != other.hostname or
-            self.local_dirname != other.local_dirname):
+                self.local_dirname != other.local_dirname):
             log.Notice(_("Manifests not equal because hosts or directories differ"))
             return False
 

=== modified file 'duplicity/patchdir.py'
--- duplicity/patchdir.py	2014-04-29 23:49:01 +0000
+++ duplicity/patchdir.py	2014-10-27 02:30:32 +0000
@@ -379,7 +379,7 @@
     def yield_tuples( iter_num, overflow, elems ):
         while 1:
             setrorps( overflow, elems )
-            if not None in overflow:
+            if None not in overflow:
                 break
 
             index = getleastindex( elems )

=== modified file 'duplicity/path.py'
--- duplicity/path.py	2014-06-28 15:48:11 +0000
+++ duplicity/path.py	2014-10-27 02:30:32 +0000
@@ -372,7 +372,7 @@
                          (other.getperms(), self.getperms()))
                 return 0
             if ((int(self.stat.st_mtime) != int(other.stat.st_mtime)) and
-                (self.stat.st_mtime > 0 or other.stat.st_mtime > 0)):
+                    (self.stat.st_mtime > 0 or other.stat.st_mtime > 0)):
                 log_diff(_("File %%s has mtime %s, expected %s") %
                          (dup_time.timetopretty(int(other.stat.st_mtime)),
                           dup_time.timetopretty(int(self.stat.st_mtime))))

=== modified file 'duplicity/progress.py'
--- duplicity/progress.py	2014-04-20 14:02:34 +0000
+++ duplicity/progress.py	2014-10-27 02:30:32 +0000
@@ -60,7 +60,7 @@
         """
         snapshot = Snapshot()
         # If restarting Full, discard marshalled data and start over
-        if not globals.restart is None and globals.restart.start_vol >= 1:
+        if globals.restart is not None and globals.restart.start_vol >= 1:
             try:
                 progressfd = open('%s/progress' % globals.archive_dir.name, 'r')
                 snapshot = pickle.load(progressfd)
@@ -132,7 +132,7 @@
         If backup is interrupted, next restart will deserialize the data and try start
         progress from the snapshot
         """
-        if not self.prev_data is None:
+        if self.prev_data is not None:
             self.prev_data.push_snapshot(volume, self.progress_estimation)
             self.prev_data.marshall() 
 
@@ -141,7 +141,7 @@
         Returns true if the progress computation is on and duplicity has not
         yet started the first dry-run pass to collect some information
         """
-        return (not self.total_stats is None)
+        return (self.total_stats is not None)
     
     def log_upload_progress(self):
         """
@@ -153,7 +153,7 @@
         current_time = datetime.now()
         if self.start_time is None:
             self.start_time = current_time
-        if not self.last_time is None:
+        if self.last_time is not None:
             elapsed = (current_time - self.last_time)
         else:
             elapsed = timedelta()
@@ -310,7 +310,7 @@
     """
     global tracker
     global progress_thread
-    if not progress_thread is None and not tracker is None:
+    if progress_thread is not None and tracker is not None:
         tracker.annotate_written_bytes(bytecount)
 
 

=== modified file 'duplicity/robust.py'
--- duplicity/robust.py	2014-04-17 20:50:57 +0000
+++ duplicity/robust.py	2014-10-27 02:30:32 +0000
@@ -35,10 +35,10 @@
 
     try:
         return function(*args)
-    #except (EnvironmentError, SkipFileException, DSRPPermError,
-    #       RPathException, Rdiff.RdiffException,
-    #       librsync.librsyncError, C.UnknownFileTypeError), exc:
-    #   TracebackArchive.add()
+    # except (EnvironmentError, SkipFileException, DSRPPermError,
+    #        RPathException, Rdiff.RdiffException,
+    #        librsync.librsyncError, C.UnknownFileTypeError), exc:
+    #    TracebackArchive.add()
     except (IOError, EnvironmentError, librsync.librsyncError, path.PathException) as exc:
         if (not isinstance(exc, EnvironmentError) or
             ((exc[0] in errno.errorcode)
@@ -46,11 +46,11 @@
              ['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
               'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
               'EIO', 'ETXTBSY', 'ESRCH', 'EINVAL'])):
-            #Log.exception()
+            # Log.exception()
             if error_handler:
                 return error_handler(exc, *args)
         else:
-            #Log.exception(1, 2)
+            # Log.exception(1, 2)
             raise
 
 def listpath(path):

=== modified file 'duplicity/selection.py'
--- duplicity/selection.py	2014-04-25 23:53:46 +0000
+++ duplicity/selection.py	2014-10-27 02:30:32 +0000
@@ -146,7 +146,7 @@
                     error_handler, Path.append, (path, filename))
                 # make sure file is read accessible
                 if (new_path and new_path.type in ["reg", "dir"]
-                    and not os.access(new_path.name, os.R_OK)):
+                        and not os.access(new_path.name, os.R_OK)):
                     log.Warn(_("Error accessing possibly locked file %s") % util.ufn(new_path.name),
                              log.WarningCode.cannot_read,
                              util.escape(new_path.name))
@@ -283,7 +283,7 @@
     def parse_last_excludes(self):
         """Exit with error if last selection function isn't an exclude"""
         if (self.selection_functions and
-            not self.selection_functions[-1].exclude):
+                not self.selection_functions[-1].exclude):
             log.FatalError(_(
 """Last selection expression:
     %s
@@ -548,7 +548,7 @@
         """Return selection function based on tuple"""
         def include_sel_func(path):
             if (path.index == tuple[:len(path.index)] or
-                path.index[:len(tuple)] == tuple):
+                    path.index[:len(tuple)] == tuple):
                 return 1 # /foo/bar implicitly matches /foo, vice-versa
             else:
                 return None

=== modified file 'duplicity/statistics.py'
--- duplicity/statistics.py	2014-04-25 23:53:46 +0000
+++ duplicity/statistics.py	2014-10-27 02:30:32 +0000
@@ -227,7 +227,7 @@
             if len(line_parts) < 2:
                 error(line)
             attr, value_string = line_parts[:2]
-            if not attr in self.stat_attrs:
+            if attr not in self.stat_attrs:
                 error(line)
             try:
                 try:

=== modified file 'duplicity/tempdir.py'
--- duplicity/tempdir.py	2014-04-20 05:58:47 +0000
+++ duplicity/tempdir.py	2014-10-27 02:30:32 +0000
@@ -233,7 +233,7 @@
         """
         self.__lock.acquire()
         try:
-            if not self.__dir is None:
+            if self.__dir is not None:
                 for file in self.__pending.keys():
                     try:
                         log.Debug(_("Removing still remembered temporary file %s") % util.ufn(file))

=== modified file 'setup.py'
--- setup.py	2014-05-11 11:50:12 +0000
+++ setup.py	2014-10-27 02:30:32 +0000
@@ -29,7 +29,7 @@
 version_string = "$version"
 
 if sys.version_info[:2] < (2, 6):
-    print "Sorry, duplicity requires version 2.6 or later of python"
+    print("Sorry, duplicity requires version 2.6 or later of python")
     sys.exit(1)
 
 incdir_list = libdir_list = None


Follow ups