MCPcopy Create free account
hub / github.com/alibaba/graph-learn / UpdateIncludeState

Function UpdateIncludeState

dynamic_graph_service/ci/cpplint.py:5734–5758  ·  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

5732
5733
5734def UpdateIncludeState(filename, include_dict, io=codecs):
5735 """Fill up the include_dict with new includes found from the file.
5736
5737 Args:
5738 filename: the name of the header to read.
5739 include_dict: a dictionary in which the headers are inserted.
5740 io: The io factory to use to read the file. Provided for testability.
5741
5742 Returns:
5743 True if a header was successfully added. False otherwise.
5744 """
5745 headerfile = None
5746 try:
5747 headerfile = io.open(filename, 'r', 'utf8', 'replace')
5748 except IOError:
5749 return False
5750 linenum = 0
5751 for line in headerfile:
5752 linenum += 1
5753 clean_line = CleanseComments(line)
5754 match = _RE_PATTERN_INCLUDE.search(clean_line)
5755 if match:
5756 include = match.group(2)
5757 include_dict.setdefault(include, linenum)
5758 return True
5759
5760
5761def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,

Callers 1

Calls 2

CleanseCommentsFunction · 0.85
searchMethod · 0.45

Tested by

no test coverage detected