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

Method _remove_resource

src/commoncode/resource.py:970–981  ·  view source on GitHub ↗

Remove the ``resource`` Resource object from this codebase. Does not remove children.

(self, resource)

Source from the content-addressed store, hash-verified

968 raise Exception(msg) from e
969
970 def _remove_resource(self, resource):
971 """
972 Remove the ``resource`` Resource object from this codebase.
973 Does not remove children.
974 """
975 if resource.is_root:
976 raise TypeError(f"Cannot remove the root resource from codebase: {resource!r}")
977
978 # remove from in-memory cache. The disk cache is cleared on exit.
979 self.resources_by_path.pop(resource.path, None)
980 if TRACE:
981 logger_debug("Codebase._remove_resource:", resource)
982
983 def remove_resource(self, resource):
984 """

Callers 1

remove_resourceMethod · 0.95

Calls 2

logger_debugFunction · 0.70
popMethod · 0.45

Tested by

no test coverage detected