MCPcopy Index your code
hub / github.com/python/cpython / parse_entries

Function parse_entries

Tools/c-analyzer/c_common/strutil.py:11–34  ·  view source on GitHub ↗
(entries, *, ignoresep=None)

Source from the content-addressed store, hash-verified

9
10
11def parse_entries(entries, *, ignoresep=None):
12 for entry in entries:
13 if ignoresep and ignoresep in entry:
14 subentries = [entry]
15 else:
16 subentries = entry.strip().replace(',', ' ').split()
17 for item in subentries:
18 if item.startswith('+'):
19 filename = item[1:]
20 try:
21 infile = open(filename)
22 except FileNotFoundError:
23 logger.debug(f'ignored in parse_entries(): +{filename}')
24 return
25 with infile:
26 # We read the entire file here to ensure the file
27 # gets closed sooner rather than later. Note that
28 # the file would stay open if this iterator is never
29 # exhausted.
30 lines = infile.read().splitlines()
31 for line in _iter_significant_lines(lines):
32 yield line, filename
33 else:
34 yield item, None
35
36
37def _iter_significant_lines(lines):

Callers

nothing calls this directly

Calls 9

_iter_significant_linesFunction · 0.85
openFunction · 0.50
splitMethod · 0.45
replaceMethod · 0.45
stripMethod · 0.45
startswithMethod · 0.45
debugMethod · 0.45
splitlinesMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…