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

Method dump

src/licensedcode/models.py:490–503  ·  view source on GitHub ↗

Dump a representation of this license as a .LICENSE file with: - the license data as YAML frontmatter - the license text

(self, licenses_data_dir)

Source from the content-addressed store, hash-verified

488 return data
489
490 def dump(self, licenses_data_dir):
491 """
492 Dump a representation of this license as a .LICENSE file with:
493 - the license data as YAML frontmatter
494 - the license text
495 """
496 metadata = self.to_dict(include_builtin=False)
497 content = self.text
498 # We add a space to empty newlines to make this text YAML safe
499 content = get_yaml_safe_text(content)
500 output = dumps_frontmatter(content=content, metadata=metadata)
501 license_file = self.license_file(licenses_data_dir=licenses_data_dir)
502 with open(license_file, 'w') as of:
503 of.write(output)
504
505 def load(self, license_file, check_consistency=True):
506 """

Callers

nothing calls this directly

Calls 5

to_dictMethod · 0.95
license_fileMethod · 0.95
dumps_frontmatterFunction · 0.90
get_yaml_safe_textFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected