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

[tor-commits] [stem/master] Minor simplification for cache fetches



commit e134dc59de93de3aef2ae1ec6e9b7a2f194c8eff
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Oct 17 11:48:58 2017 -0700

    Minor simplification for cache fetches
    
    Good spot for map to simplify this a tad.
---
 stem/control.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index ac18c3bc..b6d49d22 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1147,8 +1147,7 @@ class Controller(BaseController):
 
     # check for cached results
 
-    from_cache = [param.lower() for param in params]
-    cached_results = self._get_cache_map(from_cache, 'getinfo')
+    cached_results = self._get_cache_map(map(str.lower, params), 'getinfo')
 
     for key in cached_results:
       user_expected_key = _case_insensitive_lookup(params, key)
@@ -2163,13 +2162,10 @@ class Controller(BaseController):
     if params == []:
       return {}
 
-    # translate context sensitive options
-    lookup_params = set([MAPPED_CONFIG_KEYS.get(entry, entry) for entry in params])
-
-    # check for cached results
+    # check for cached results, translating context sensitive options
 
-    from_cache = [param.lower() for param in lookup_params]
-    cached_results = self._get_cache_map(from_cache, 'getconf')
+    lookup_params = set([MAPPED_CONFIG_KEYS.get(entry, entry) for entry in params])
+    cached_results = self._get_cache_map(map(str.lower, lookup_params), 'getconf')
 
     for key in cached_results:
       user_expected_key = _case_insensitive_lookup(lookup_params, key)

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