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

Function cut_after_n_lines

mitmproxy/utils/strutils.py:281–289  ·  view source on GitHub ↗
(content: str, n: int)

Source from the content-addressed store, hash-verified

279
280
281def cut_after_n_lines(content: str, n: int) -> str:
282 assert n > 0
283 pos = content.find("\n")
284 while pos >= 0 and n > 1:
285 pos = content.find("\n", pos + 1)
286 n -= 1
287 if pos >= 0:
288 content = content[: pos + 1]
289 return content

Callers 1

message_to_jsonMethod · 0.90

Calls 1

findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…