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

Method serialize

src/commoncode/resource.py:1629–1642  ·  view source on GitHub ↗

Return a mapping of representing this Resource and its data in a form that is fully serializable (to JSON, YAML, pickle, etc.) and can be used to reconstruct a Resource.

(self)

Source from the content-addressed store, hash-verified

1627 return res
1628
1629 def serialize(self):
1630 """
1631 Return a mapping of representing this Resource and its data in a form
1632 that is fully serializable (to JSON, YAML, pickle, etc.) and can be used
1633 to reconstruct a Resource.
1634 """
1635 # we save all fields, not just the one in .to_dict()
1636 serializable = attr.asdict(self)
1637 serializable["name"] = self.name
1638 if self.location:
1639 serializable["location"] = self.location
1640 if self.cache_location:
1641 serializable["cache_location"] = self.cache_location
1642 return serializable
1643
1644
1645def clean_path(path):

Callers 2

_dump_resourceMethod · 0.80
sarissa.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected