[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [oonib/master] Fixes highlighted by the review of @bassosimone
commit bc2f24ffd1e22c9af92345602a3994c40f22d5fb
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date: Thu Mar 10 18:51:58 2016 +0100
Fixes highlighted by the review of @bassosimone
* Remove duplicated code
* Be smarter and not use else when unneeded
* Remove dead code
---
oonib/report/handlers.py | 6 +-----
oonib/testhelpers/http_helpers.py | 12 ------------
2 files changed, 1 insertion(+), 17 deletions(-)
diff --git a/oonib/report/handlers.py b/oonib/report/handlers.py
index 3e308e5..55a9221 100644
--- a/oonib/report/handlers.py
+++ b/oonib/report/handlers.py
@@ -152,9 +152,6 @@ def validateHeader(header):
if not header.get('start_time'):
header['start_time'] = time.time()
- if not header.get('start_time'):
- header['start_time'] = time.time()
-
if not header.get('data_format_version'):
header['data_format_version'] = '0.1.0'
@@ -167,8 +164,7 @@ def validateHeader(header):
log.debug("Matching %s with %s | %s" % (regexp, value_to_check, k))
if re.match(regexp, str(value_to_check)):
continue
- else:
- raise e.InvalidRequestField(k)
+ raise e.InvalidRequestField(k)
try:
requested_test_helper = header['test_helper']
diff --git a/oonib/testhelpers/http_helpers.py b/oonib/testhelpers/http_helpers.py
index 603bdc5..a28cbad 100644
--- a/oonib/testhelpers/http_helpers.py
+++ b/oonib/testhelpers/http_helpers.py
@@ -2,10 +2,6 @@ import json
import random
import string
-from twisted.internet.protocol import Factory, Protocol
-
-from twisted.internet.endpoints import TCP4ClientEndpoint
-
from twisted.internet import protocol, defer
from cyclone.web import RequestHandler, Application
@@ -172,14 +168,6 @@ class HTTPRandomPage(HTTPTrapAll):
length = 100000
self.write(self.genRandomPage(length, keyword))
-class TCPConnectProtocol(Protocol):
- def connectionMade(self):
- self.transport.loseConnection()
-
-class TCPConnectFactory(Factory):
- def buildProtocol(self, addr):
- return TCPConnectProtocol()
-
HTTPRandomPageHelper = Application([
# XXX add regexps here
(r"/(.*)/(.*)", HTTPRandomPage)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits