MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / CleanseComments

Function CleanseComments

rtpose_wrapper/scripts/cpp_lint.py:1167–1180  ·  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

1165
1166
1167def CleanseComments(line):
1168 """Removes //-comments and single-line C-style /* */ comments.
1169
1170 Args:
1171 line: A line of C++ source.
1172
1173 Returns:
1174 The line with single-line comments removed.
1175 """
1176 commentpos = line.find('//')
1177 if commentpos != -1 and not IsCppString(line[:commentpos]):
1178 line = line[:commentpos].rstrip()
1179 # get rid of /* ... */
1180 return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
1181
1182
1183class CleansedLines(object):

Callers 2

__init__Method · 0.85
UpdateIncludeStateFunction · 0.85

Calls 1

IsCppStringFunction · 0.85

Tested by

no test coverage detected