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

Function ensure_safe

tools/Polygraphy/polygraphy/tools/script.py:66–74  ·  view source on GitHub ↗

Ensures that the input is marked as a safe string (i.e. Script.String(safe=True)).

(inp)

Source from the content-addressed store, hash-verified

64
65
66def ensure_safe(inp):
67 """
68 Ensures that the input is marked as a safe string (i.e. Script.String(safe=True)).
69 """
70 if not isinstance(inp, Script.String):
71 G_LOGGER.internal_error(f"Input to ensure_safe must be of type Script.String, but was: {inp}")
72 elif not inp.safe:
73 G_LOGGER.internal_error(f"Input string: {inp} was not checked for safety. This is a potential security risk!")
74 return inp
75
76
77@mod.export()

Callers 7

run_scriptFunction · 0.90
inlineFunction · 0.85
set_data_loaderMethod · 0.85
add_loaderMethod · 0.85
add_runnerMethod · 0.85
append_preimportMethod · 0.85
append_suffixMethod · 0.85

Calls 1

internal_errorMethod · 0.80

Tested by

no test coverage detected