MCPcopy Index your code
hub / github.com/python/mypy / format_lists

Function format_lists

misc/gen_blog_post_html.py:22–37  ·  view source on GitHub ↗
(h: str)

Source from the content-addressed store, hash-verified

20
21
22def format_lists(h: str) -> str:
23 a = h.splitlines()
24 r = []
25 i = 0
26 bullets = ("- ", "* ", " * ")
27 while i < len(a):
28 if a[i].startswith(bullets):
29 r.append("<p><ul>")
30 while i < len(a) and a[i].startswith(bullets):
31 r.append("<li>%s" % a[i][2:].lstrip())
32 i += 1
33 r.append("</ul>")
34 else:
35 r.append(a[i])
36 i += 1
37 return "\n".join(r)
38
39
40def format_code(h: str) -> str:

Callers 1

convertFunction · 0.85

Calls 6

lenFunction · 0.85
splitlinesMethod · 0.80
appendMethod · 0.80
lstripMethod · 0.80
startswithMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…