MCPcopy
hub / github.com/fluentpython/example-code-2e / htmlize

Function htmlize

09-closure-deco/htmlizer.py:42–44  ·  view source on GitHub ↗
(obj: object)

Source from the content-addressed store, hash-verified

40
41@singledispatch # <1>
42def htmlize(obj: object) -> str:
43 content = html.escape(repr(obj))
44 return f'<pre>{content}</pre>'
45
46@htmlize.register # <2>
47def _(text: str) -> str: # <3>

Callers 1

_Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected