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

Method save_resource

src/commoncode/resource.py:897–918  ·  view source on GitHub ↗

Save the `resource` Resource to cache (in memory or disk).

(self, resource)

Source from the content-addressed store, hash-verified

895 return res
896
897 def save_resource(self, resource):
898 """
899 Save the `resource` Resource to cache (in memory or disk).
900 """
901 if not resource:
902 return
903
904 path = clean_path(resource.path)
905
906 if TRACE:
907 logger_debug(" Codebase.save_resource:", resource)
908
909 if resource.is_root:
910 self.root = resource
911 self.resources_by_path[path] = resource
912
913 elif resource.cache_location:
914 self._dump_resource(resource)
915 self.resources_by_path[path] = Codebase.CACHED_RESOURCE
916
917 else:
918 self.resources_by_path[path] = resource
919
920 def _dump_resource(self, resource):
921 """

Calls 3

_dump_resourceMethod · 0.95
clean_pathFunction · 0.85
logger_debugFunction · 0.70