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

[tor-commits] [stem/master] Make `Controller.is_set` asynchronous



commit bee112f44a4fc6a9f8f1f95b78aa621e1299038e
Author: Illia Volochii <illia.volochii@xxxxxxxxx>
Date:   Mon Apr 20 22:07:17 2020 +0300

    Make `Controller.is_set` asynchronous
---
 stem/control.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index fd38871a..708a413d 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -2308,7 +2308,7 @@ class Controller(BaseController):
     return return_dict
 
   @with_default()
-  def is_set(self, param: str, default: Any = UNDEFINED) -> bool:
+  async def is_set(self, param: str, default: Any = UNDEFINED) -> bool:
     """
     is_set(param, default = UNDEFINED)
 
@@ -2326,13 +2326,13 @@ class Controller(BaseController):
       provided a default response
     """
 
-    return param in self._get_custom_options()
+    return param in await self._get_custom_options()
 
-  def _get_custom_options(self) -> Dict[str, str]:
+  async def _get_custom_options(self) -> Dict[str, str]:
     result = self._get_cache('get_custom_options')
 
     if not result:
-      config_lines = self.get_info('config-text').splitlines()
+      config_lines = (await self.get_info('config-text')).splitlines()
 
       # Tor provides some config options even if they haven't been set...
       #
@@ -2342,7 +2342,7 @@ class Controller(BaseController):
       default_lines = (
         'Log notice stdout',
         'Log notice file /var/log/tor/log',
-        'DataDirectory /home/%s/.tor' % self.get_user('undefined'),
+        'DataDirectory /home/%s/.tor' % await self.get_user('undefined'),
         'HiddenServiceStatistics 0',
       )
 



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