From 1ffc273c9433fc8840b71c79879ae427c93313bd Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 7 Jun 2016 17:12:52 +1200 Subject: Utils cleanups - Move more stuff that belongs in netlib.human - Move some stuff to near the only use - Zap mitmproxy.utils.timestamp(). I see the rationale, but we used it interchangeably with time.time() throughout the project. Since time.time() dominates in the codebase and timestamp() is such low utility, away it goes. --- netlib/utils.py | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'netlib/utils.py') diff --git a/netlib/utils.py b/netlib/utils.py index b4b99679..79340cbd 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -4,8 +4,6 @@ import re import importlib import inspect -import six - def setbit(byte, offset, value): """ @@ -94,16 +92,3 @@ def is_valid_host(host): def is_valid_port(port): return 0 <= port <= 65535 - - -def hostport(scheme, host, port): - """ - Returns the host component, with a port specifcation if needed. - """ - if (port, scheme) in [(80, "http"), (443, "https"), (80, b"http"), (443, b"https")]: - return host - else: - if isinstance(host, six.binary_type): - return b"%s:%d" % (host, port) - else: - return "%s:%d" % (host, port) -- cgit v1.2.3