commit 78aaf07a8a16eb78f2131a4f136a570549864919 Author: Daniel Martí mvdan@mvdan.cc Date: Thu Aug 21 18:51:53 2014 +0200
Simplify some bits of logic --- lib/chutney/TorNet.py | 10 ++-------- lib/chutney/Traffic.py | 8 ++------ 2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py index 37872ed..9e07c02 100644 --- a/lib/chutney/TorNet.py +++ b/lib/chutney/TorNet.py @@ -715,10 +715,7 @@ class TorEnviron(chutney.Templating.Environ): return "test%03d%s" % (my['nodenum'], my['tag'])
def _get_tor_gencert(self, my): - if my['tor-gencert']: - return my['tor-gencert'] - else: - return '{0}-gencert'.format(my['tor']) + return my['tor-gencert'] or '{0}-gencert'.format(my['tor'])
def _get_auth_passphrase(self, my): return self['nick'] # OMG TEH SECURE! @@ -832,10 +829,7 @@ class Network(object): sys.stdout.write("Verifying data transmission: ") sys.stdout.flush() status = self._verify_traffic() - if status: - print("Success") - else: - print("Failure") + print "Success" if status else "Failure" return status
def _verify_traffic(self): diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index dbd1f07..67aff74 100644 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -152,8 +152,7 @@ class Sink(Peer): if len(self.inbuf) == len(data): if self.inbuf != data: return -1 # Failed verification. - else: - debug("successful verification") + debug("successful verification") return len(data) - len(self.inbuf)
@@ -178,10 +177,7 @@ class Source(Peer): def connect(self, endpoint): self.dest = endpoint self.state = self.CONNECTING - if self.proxy is None: - dest = self.dest - else: - dest = self.proxy + dest = self.proxy or self.dest try: self.s.connect(dest) except socket.error, e:
tor-commits@lists.torproject.org