MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / LegacyContentview

Class LegacyContentview

mitmproxy/contentviews/_compat.py:23–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class LegacyContentview(Contentview):
24 @property
25 def name(self) -> str:
26 return self.contentview.name
27
28 @property
29 def syntax_highlight(self) -> SyntaxHighlight:
30 return getattr(self.contentview, "syntax_highlight", "none")
31
32 def render_priority(
33 self,
34 data: bytes,
35 metadata: Metadata,
36 ) -> float:
37 return (
38 self.contentview.render_priority(
39 data=data,
40 content_type=metadata.content_type,
41 flow=metadata.flow,
42 http_message=metadata.http_message,
43 )
44 or 0.0
45 )
46
47 def prettify(self, data: bytes, metadata: Metadata) -> str:
48 lines: Iterator[TViewLine]
49 desc_, lines = self.contentview(
50 data,
51 content_type=metadata.content_type,
52 flow=metadata.flow,
53 http_message=metadata.http_message,
54 )
55 return "\n".join(
56 "".join(always_str(text, "utf8", "backslashescape") for tag, text in line)
57 for line in lines
58 )
59
60 def __init__(self, contentview: View):
61 self.contentview = contentview
62
63
64@deprecated("Use `mitmproxy.contentviews.registry` instead.")

Callers 1

addFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…