MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / parse

Method parse

src/packagedcode/chef.py:209–224  ·  view source on GitHub ↗
(cls, location, package_only=False)

Source from the content-addressed store, hash-verified

207
208 @classmethod
209 def parse(cls, location, package_only=False):
210 with io.open(location, encoding='utf-8') as loc:
211 file_contents = loc.read()
212
213 # we use a Pygments formatter for parsing lexed Ruby code
214 formatted_file_contents = highlight(
215 file_contents,
216 RubyLexer(),
217 ChefMetadataFormatter()
218 )
219 package_data = json.loads(formatted_file_contents)
220 yield build_package(
221 package_data=package_data,
222 datasource_id=cls.datasource_id,
223 package_only=package_only,
224 )
225
226
227def build_package(package_data, datasource_id, package_only=False):

Callers

nothing calls this directly

Calls 5

loadsMethod · 0.80
build_packageFunction · 0.70
openMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected