MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / UpdateIncludeState

Function UpdateIncludeState

steps/cpplint.py:6038–6062  ·  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

6036
6037
6038def UpdateIncludeState(filename, include_dict, io=codecs):
6039 """Fill up the include_dict with new includes found from the file.
6040
6041 Args:
6042 filename: the name of the header to read.
6043 include_dict: a dictionary in which the headers are inserted.
6044 io: The io factory to use to read the file. Provided for testability.
6045
6046 Returns:
6047 True if a header was successfully added. False otherwise.
6048 """
6049 headerfile = None
6050 try:
6051 with io.open(filename, 'r', 'utf8', 'replace') as headerfile:
6052 linenum = 0
6053 for line in headerfile:
6054 linenum += 1
6055 clean_line = CleanseComments(line)
6056 match = _RE_PATTERN_INCLUDE.search(clean_line)
6057 if match:
6058 include = match.group(2)
6059 include_dict.setdefault(include, linenum)
6060 return True
6061 except IOError:
6062 return False
6063
6064
6065

Callers 1

Calls 1

CleanseCommentsFunction · 0.85

Tested by

no test coverage detected