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

Function inline_identifier

tools/Polygraphy/polygraphy/tools/script.py:27–44  ·  view source on GitHub ↗

Returns an inline safe string if the provided string is an identifier and raises an exception otherwise. Args: ident (str): The string supposed to contain an identifier. Returns: Script.String: An inline safe string Raises: PolygraphyException: if the inpu

(ident)

Source from the content-addressed store, hash-verified

25
26
27def inline_identifier(ident):
28 """
29 Returns an inline safe string if the provided string is an identifier and raises an exception otherwise.
30
31 Args:
32 ident (str): The string supposed to contain an identifier.
33
34 Returns:
35 Script.String: An inline safe string
36
37 Raises:
38 PolygraphyException: if the input string is not an identifier.
39 """
40 if not ident.isidentifier():
41 G_LOGGER.critical(
42 f"This argument must be a valid identifier. Provided argument cannot be a Python identifier: {ident}"
43 )
44 return inline(safe(ident))
45
46
47@mod.export()

Callers 5

parse_implMethod · 0.90
parse_implMethod · 0.90
parse_implMethod · 0.90
parse_implMethod · 0.90
make_trt_enum_valFunction · 0.90

Calls 3

inlineFunction · 0.85
safeFunction · 0.85
criticalMethod · 0.45

Tested by

no test coverage detected