MCPcopy
hub / github.com/pandas-dev/pandas / _str_escape

Function _str_escape

pandas/io/formats/style_render.py:1937–1951  ·  view source on GitHub ↗

if escaping: only use on str, else return input

(x, escape)

Source from the content-addressed store, hash-verified

1935
1936
1937def _str_escape(x, escape):
1938 """if escaping: only use on str, else return input"""
1939 if isinstance(x, str):
1940 if escape == "html":
1941 return escape_html(x)
1942 elif escape == "latex":
1943 return _escape_latex(x)
1944 elif escape == "latex-math":
1945 return _escape_latex_math(x)
1946 else:
1947 raise ValueError(
1948 f"`escape` only permitted in {{'html', 'latex', 'latex-math'}}, \
1949got {escape}"
1950 )
1951 return x
1952
1953
1954def _render_href(x, format):

Callers 2

test_str_escape_errorFunction · 0.90
_maybe_wrap_formatterFunction · 0.85

Calls 2

_escape_latexFunction · 0.85
_escape_latex_mathFunction · 0.85

Tested by 1

test_str_escape_errorFunction · 0.72