MCPcopy Create free account
hub / github.com/tensorflow/tfjs / UpdateIncludeState

Function UpdateIncludeState

tfjs-backend-wasm/tools/cpplint.py:5471–5495  ·  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

5469
5470
5471def UpdateIncludeState(filename, include_dict, io=codecs):
5472 """Fill up the include_dict with new includes found from the file.
5473
5474 Args:
5475 filename: the name of the header to read.
5476 include_dict: a dictionary in which the headers are inserted.
5477 io: The io factory to use to read the file. Provided for testability.
5478
5479 Returns:
5480 True if a header was successfully added. False otherwise.
5481 """
5482 headerfile = None
5483 try:
5484 headerfile = io.open(filename, 'r', 'utf8', 'replace')
5485 except IOError:
5486 return False
5487 linenum = 0
5488 for line in headerfile:
5489 linenum += 1
5490 clean_line = CleanseComments(line)
5491 match = _RE_PATTERN_INCLUDE.search(clean_line)
5492 if match:
5493 include = match.group(2)
5494 include_dict.setdefault(include, linenum)
5495 return True
5496
5497
5498def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,

Callers 1

Calls 2

CleanseCommentsFunction · 0.85
openMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…