MCPcopy Create free account
hub / github.com/BVLC/caffe / CleanseComments

Function CleanseComments

scripts/cpp_lint.py:1171–1184  ·  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

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

Callers 2

__init__Method · 0.85
UpdateIncludeStateFunction · 0.85

Calls 1

IsCppStringFunction · 0.85

Tested by

no test coverage detected