[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Condense code for getting statefile absolute path in b.persistent.State.



commit 7de653e942237f65743323e26bf018f4b696a591
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Feb 24 22:58:33 2015 +0000

    Condense code for getting statefile absolute path in b.persistent.State.
    
    These checks were unnecessary overhead, since the path expansion functions
    won't do anything if there's nothing to be done.
---
 lib/bridgedb/persistent.py |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/bridgedb/persistent.py b/lib/bridgedb/persistent.py
index ad4398d..1b2507c 100644
--- a/lib/bridgedb/persistent.py
+++ b/lib/bridgedb/persistent.py
@@ -124,11 +124,7 @@ class State(jelly.Jellyable):
 
         :param string statefile: The filename of the statefile.
         """
-        if filename.startswith('~'):
-            filename = os.path.expanduser(filename)
-        if not os.path.isabs(filename):
-            filename = os.path.abspath(filename)
-
+        filename = os.path.abspath(os.path.expanduser(filename))
         logging.debug("Setting statefile to '%s'" % filename)
         self._statefile = filename
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits