[tor-commits] [nyx/master] Less confusing location ternary

atagar at torproject.org atagar at torproject.org
Sun Nov 18 19:09:31 UTC 2018


commit 2e0547224c9e44ba4717673293bf439478ca8fc2
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Nov 9 11:38:55 2018 -0800

    Less confusing location ternary
    
    It's weird that this did two nested ternaries. They can be combined.
---
 nyx/panel/connection.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index ac4a234..b3e9304 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -657,7 +657,7 @@ def _draw_details(subwindow, selected):
   else:
     address = '<scrubbed>' if selected.entry.is_private() else selected.connection.remote_address
     subwindow.addstr(2, 1, 'address: %s:%s' % (address, selected.connection.remote_port), *attr)
-    subwindow.addstr(2, 2, 'locale: %s' % ('??' if selected.entry.is_private() else (selected.locale if selected.locale else '??')), *attr)
+    subwindow.addstr(2, 2, 'locale: %s' % (selected.locale if selected.locale and not selected.entry.is_private() else '??'), *attr)
 
     matches = nyx.tracker.get_consensus_tracker().get_relay_fingerprints(selected.connection.remote_address)
 





More information about the tor-commits mailing list