MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / UpdateIncludeState

Function UpdateIncludeState

src/tests/coding/cpplint.py:6025–6049  ·  view source on GitHub ↗

Fill up the include_dict with new includes found from the file. Args: filename: the name of the header to read. include_dict: a dictionary in which the headers are inserted. io: The io factory to use to read the file. Provided for testability. Returns: True if a header was succ

(filename, include_dict, io=codecs)

Source from the content-addressed store, hash-verified

6023
6024
6025def UpdateIncludeState(filename, include_dict, io=codecs):
6026 """Fill up the include_dict with new includes found from the file.
6027
6028 Args:
6029 filename: the name of the header to read.
6030 include_dict: a dictionary in which the headers are inserted.
6031 io: The io factory to use to read the file. Provided for testability.
6032
6033 Returns:
6034 True if a header was successfully added. False otherwise.
6035 """
6036 headerfile = None
6037 try:
6038 with io.open(filename, 'r', 'utf8', 'replace') as headerfile:
6039 linenum = 0
6040 for line in headerfile:
6041 linenum += 1
6042 clean_line = CleanseComments(line)
6043 match = _RE_PATTERN_INCLUDE.search(clean_line)
6044 if match:
6045 include = match.group(2)
6046 include_dict.setdefault(include, linenum)
6047 return True
6048 except IOError:
6049 return False
6050
6051
6052

Callers 1

Calls 4

CleanseCommentsFunction · 0.85
searchMethod · 0.80
openMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected