MCPcopy Index your code
hub / github.com/NVIDIA/TensorRT-LLM / normalize_whitespace

Function normalize_whitespace

scripts/format_test_list.py:8–22  ·  view source on GitHub ↗

Remove leading whitespace, replace tabs and multiple spaces with single spaces.

(content: str)

Source from the content-addressed store, hash-verified

6
7
8def normalize_whitespace(content: str) -> str:
9 """Remove leading whitespace, replace tabs and multiple spaces with single spaces."""
10 lines = content.splitlines(keepends=True)
11 normalized_lines = []
12
13 for line in lines:
14 # Remove leading whitespace and tabs
15 line = line.lstrip(' \t')
16 # Replace tabs with single space
17 line = line.replace('\t', ' ')
18 # Replace multiple spaces with single space
19 line = re.sub(r' +', ' ', line)
20 normalized_lines.append(line)
21
22 return ''.join(normalized_lines)
23
24
25def main():

Callers 1

mainFunction · 0.85

Calls 2

replaceMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected