MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / safe

Function safe

tools/Polygraphy/polygraphy/tools/script.py:48–63  ·  view source on GitHub ↗

Indicates a string is safe to use and will not compromise security. NOTE: The caller is reponsible for checking that the string is actually safe. This function serves only to mark the string as such. Can work with format strings as well. For example: :: >>> safe("{} i

(base_str, *args, **kwargs)

Source from the content-addressed store, hash-verified

46
47@mod.export()
48def safe(base_str, *args, **kwargs):
49 """
50 Indicates a string is safe to use and will not compromise security.
51
52 NOTE: The caller is reponsible for checking that the string is actually safe.
53 This function serves only to mark the string as such.
54
55 Can work with format strings as well. For example:
56 ::
57
58 >>> safe("{} is my name", "polygraphy")
59 "'polygraphy' is my name"
60 """
61 args = [repr(arg) for arg in args]
62 kwargs = {key: repr(val) for key, val in kwargs.items()}
63 return Script.String(base_str.format(*args, **kwargs), safe=True)
64
65
66def ensure_safe(inp):

Callers 15

run_implMethod · 0.90
run_implMethod · 0.90
run_implMethod · 0.90
run_implMethod · 0.90
parse_implMethod · 0.90
add_to_script_implMethod · 0.90
parse_implMethod · 0.90
add_to_script_implMethod · 0.90
parse_implMethod · 0.90
add_to_script_implMethod · 0.90
parse_implMethod · 0.90
make_trt_enum_valFunction · 0.90

Calls 1

itemsMethod · 0.45

Tested by 1

script_addMethod · 0.72