[Pkg-privacy-commits] [mat] 05/68: Minor refactorisation of `get_datafile_path()`

Sascha Steinbiss sascha at steinbiss.name
Sun Jan 3 12:32:37 UTC 2016


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

sascha-guest pushed a commit to branch master
in repository mat.

commit bbdaaeaba42a4cf6ed61fed424e253aeb9b29a6a
Author: jvoisin <julien.voisin at dustri.org>
Date:   Tue Nov 3 14:35:46 2015 +0100

    Minor refactorisation of `get_datafile_path()`
---
 libmat/mat.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libmat/mat.py b/libmat/mat.py
index 3947606..decbbed 100644
--- a/libmat/mat.py
+++ b/libmat/mat.py
@@ -48,12 +48,11 @@ def get_datafile_path(filename):
     """ Return the path to $filename
     :param string filename:
     """
-    if os.path.isfile(os.path.join(os.path.curdir, 'data', filename)):
-        return os.path.join(os.path.curdir, 'data', filename)
-    elif os.path.isfile(os.path.join('/usr/local/share/mat/', filename)):
-        return os.path.join('/usr/local/share/mat/', filename)
-    elif os.path.isfile(os.path.join('/usr/share/mat/', filename)):
-        return os.path.join('/usr/share/mat/', filename)
+    paths = ['data', '/usr/local/share/mat/', '/usr/share/mat/']
+    for path in paths:
+        filepath = os.path.join(os.path.curdir, path, filename)
+        if os.path.isfile(filepath):
+            return filepath
 
 
 def list_supported_formats():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/mat.git



More information about the Pkg-privacy-commits mailing list