MCPcopy Index your code
hub / github.com/nodejs/node / parse

Function parse

tools/configure.d/nodedownload.py:97–128  ·  view source on GitHub ↗

This function parses the options to --download and returns a set such as { icu: true }, etc.

(opt)

Source from the content-addressed store, hash-verified

95 return dict((key, value) for (key) in keys)
96
97def parse(opt):
98 """This function parses the options to --download and returns a set such as { icu: true }, etc. """
99 if not opt:
100 opt = download_default
101
102 theOpts = set(opt.split(','))
103
104 if 'all' in theOpts:
105 # all on
106 return set2dict(download_types, True)
107 elif 'none' in theOpts:
108 # all off
109 return set2dict(download_types, False)
110
111 # OK. Now, process each of the opts.
112 theRet = set2dict(download_types, False)
113 for anOpt in opt.split(','):
114 if not anOpt or anOpt == "":
115 # ignore stray commas, etc.
116 continue
117 elif anOpt == 'all':
118 # all on
119 theRet = dict((key, True) for (key) in download_types)
120 else:
121 # turn this one on
122 if anOpt in download_types:
123 theRet[anOpt] = True
124 else:
125 # future proof: ignore unknown types
126 print('Warning: ignoring unknown --download= type "%s"' % anOpt)
127 # all done
128 return theRet
129
130def candownload(auto_downloads, package):
131 if not (package in auto_downloads.keys()):

Callers 1

parse_tupleMethod · 0.50

Calls 4

set2dictFunction · 0.85
setFunction · 0.50
printFunction · 0.50
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…