mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-29 12:45:00 +08:00
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.
This commit is contained in:
@@ -5,7 +5,16 @@ import os.path
|
||||
import re
|
||||
|
||||
from netlib import tcp, human
|
||||
from . import pathod, version, utils
|
||||
from . import pathod, version
|
||||
|
||||
|
||||
def parse_anchor_spec(s):
|
||||
"""
|
||||
Return a tuple, or None on error.
|
||||
"""
|
||||
if "=" not in s:
|
||||
return None
|
||||
return tuple(s.split("=", 1))
|
||||
|
||||
|
||||
def args_pathod(argv, stdout_=sys.stdout, stderr_=sys.stderr):
|
||||
@@ -188,7 +197,7 @@ def args_pathod(argv, stdout_=sys.stdout, stderr_=sys.stderr):
|
||||
|
||||
alst = []
|
||||
for i in args.anchors:
|
||||
parts = utils.parse_anchor_spec(i)
|
||||
parts = parse_anchor_spec(i)
|
||||
if not parts:
|
||||
return parser.error("Invalid anchor specification: %s" % i)
|
||||
alst.append(parts)
|
||||
|
||||
Reference in New Issue
Block a user