[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Fix is_available() ternary
commit 2fef5f6b70b987a839e4a907e9858c37a56f5100
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon Nov 18 16:30:50 2019 -0800
Fix is_available() ternary
This was simply returning the result of shutil. The proper ternary is...
return True if shutil.which(command) else False
That said, this really doesn't matter. Usage within conditionals implicitly
converts this to a boolean anyway.
---
nyx/__init__.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/nyx/__init__.py b/nyx/__init__.py
index 0418567..0efdbed 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -51,8 +51,10 @@ import threading
import time
import shutil
+
def is_available(command):
- return shutil.which(command) if True else False
+ return bool(shutil.which(command))
+
class PkgManagers:
ARCHLINUX = 'pacman'
@@ -93,7 +95,7 @@ except ImportError as exc:
else:
pkg_manager_not_found = True
pkg_install_procedure = ', you can find it at https://stem.torproject.org/download.html'
-
+
require_message = 'nyx requires python-stem'
if pkg_manager_not_found:
final_message = require_message + pkg_install_procedure
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits