[diffoscope] 04/05: rdata: Invert logic to remove indentation level

Chris Lamb chris at chris-lamb.co.uk
Fri Apr 21 14:28:57 CEST 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch experimental
in repository diffoscope.

commit e9d849605d7c7d4a13f20902813c2a531c75efdf
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Apr 21 13:25:20 2017 +0100

    rdata: Invert logic to remove indentation level
    
    Gbp-Dch: ignore
---
 diffoscope/comparators/rdata.py | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/diffoscope/comparators/rdata.py b/diffoscope/comparators/rdata.py
index bbb826f..bed6dc1 100644
--- a/diffoscope/comparators/rdata.py
+++ b/diffoscope/comparators/rdata.py
@@ -40,22 +40,22 @@ def check_rds_extension(f):
     return f.name.endswith(".rds") or f.name.endswith(".rdx")
 
 def ensure_archive_rdx(f):
-    if f.container and not f.path.endswith(".rdb"):
-        # if we're in an archive, copy the .rdx file over so R can read it
-        bname = os.path.basename(f.name)
-        assert bname.endswith(".rdb")
-        rdx_name = f.name[:-4] + ".rdx"
-        try:
-            rdx_path = f.container.get_member(rdx_name).path
-        except KeyError:
-            return f.path
-            # R will fail, diffoscope will report the error and continue
-        shutil.copy(f.path, f.path + ".rdb")
-        shutil.copy(rdx_path, f.path + ".rdx")
-        return f.path + ".rdb"
-    else:
+    if not f.container or f.path.endswith(".rdb"):
         return f.path
 
+    # if we're in an archive, copy the .rdx file over so R can read it
+    bname = os.path.basename(f.name)
+    assert bname.endswith(".rdb")
+    rdx_name = f.name[:-4] + ".rdx"
+    try:
+        rdx_path = f.container.get_member(rdx_name).path
+    except KeyError:
+        return f.path
+        # R will fail, diffoscope will report the error and continue
+    shutil.copy(f.path, f.path + ".rdb")
+    shutil.copy(rdx_path, f.path + ".rdx")
+    return f.path + ".rdb"
+
 class RdsReader(Command):
     @tool_required('Rscript')
     def cmdline(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list