mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-30 05:05:02 +08:00
Consolidate some functions to strutils.bytes_to_escaped_str
This commit is contained in:
@@ -2,8 +2,6 @@ import os
|
||||
import sys
|
||||
import netlib.utils
|
||||
|
||||
from netlib import strutils
|
||||
|
||||
|
||||
class MemBool(object):
|
||||
|
||||
@@ -28,18 +26,6 @@ def parse_anchor_spec(s):
|
||||
return tuple(s.split("=", 1))
|
||||
|
||||
|
||||
def escape_unprintables(s):
|
||||
"""
|
||||
Like inner_repr, but preserves line breaks.
|
||||
"""
|
||||
s = s.replace(b"\r\n", b"PATHOD_MARKER_RN")
|
||||
s = s.replace(b"\n", b"PATHOD_MARKER_N")
|
||||
s = strutils.bytes_to_escaped_str(s)
|
||||
s = s.replace("PATHOD_MARKER_RN", "\n")
|
||||
s = s.replace("PATHOD_MARKER_N", "\n")
|
||||
return s
|
||||
|
||||
|
||||
data = netlib.utils.Data(__name__)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user