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

isis at torproject.org isis at torproject.org
Sat Mar 21 02:03:03 UTC 2015


commit 7de653e942237f65743323e26bf018f4b696a591
Author: Isis Lovecruft <isis at torproject.org>
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
 





More information about the tor-commits mailing list