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

Method format

src/licensedcode/frontmatter.py:56–71  ·  view source on GitHub ↗

Return string with `content` and `metadata` as YAML frontmatter, used in ``frontmatter.dumps``.

(self, content, metadata, template=DEFAULT_POST_TEMPLATE, **kwargs)

Source from the content-addressed store, hash-verified

54 return fm, content
55
56 def format(self, content, metadata, template=DEFAULT_POST_TEMPLATE, **kwargs):
57 """
58 Return string with `content` and `metadata` as YAML frontmatter,
59 used in ``frontmatter.dumps``.
60 """
61 start_delimiter = kwargs.pop("start_delimiter", self.START_DELIMITER)
62 end_delimiter = kwargs.pop("end_delimiter", self.END_DELIMITER)
63
64 metadata = self.export(metadata, **kwargs)
65
66 return template.format(
67 metadata=metadata,
68 content=content,
69 start_delimiter=start_delimiter,
70 end_delimiter=end_delimiter,
71 ).strip()
72
73 def load(self, fm, **kwargs):
74 """

Callers 15

scancode_urlMethod · 0.45
licensedb_urlMethod · 0.45
spdx_urlMethod · 0.45
rule_urlMethod · 0.45
loadMethod · 0.45
find_rule_base_locationFunction · 0.45
get_highlighted_linesFunction · 0.45
get_locationFunction · 0.45
dumps_frontmatterFunction · 0.45
matched_rule_tokens_strFunction · 0.45

Calls 2

exportMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected