MCPcopy Create free account
hub / github.com/tensorflow/tfjs / CleanseComments

Function CleanseComments

tfjs-backend-wasm/tools/cpplint.py:1408–1421  ·  view source on GitHub ↗

Removes //-comments and single-line C-style /* */ comments. Args: line: A line of C++ source. Returns: The line with single-line comments removed.

(line)

Source from the content-addressed store, hash-verified

1406
1407
1408def CleanseComments(line):
1409 """Removes //-comments and single-line C-style /* */ comments.
1410
1411 Args:
1412 line: A line of C++ source.
1413
1414 Returns:
1415 The line with single-line comments removed.
1416 """
1417 commentpos = line.find('//')
1418 if commentpos != -1 and not IsCppString(line[:commentpos]):
1419 line = line[:commentpos].rstrip()
1420 # get rid of /* ... */
1421 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1422
1423
1424class CleansedLines(object):

Callers 3

__init__Method · 0.85
CheckEmptyBlockBodyFunction · 0.85
UpdateIncludeStateFunction · 0.85

Calls 3

IsCppStringFunction · 0.85
findMethod · 0.80
subMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…