MCPcopy Index your code
hub / github.com/python/cpython / is_resource

Method is_resource

Lib/importlib/resources/readers.py:52–58  ·  view source on GitHub ↗

Workaround for `zipfile.Path.is_file` returning true for non-existent paths.

(self, path)

Source from the content-addressed store, hash-verified

50 raise FileNotFoundError(exc.args[0])
51
52 def is_resource(self, path):
53 """
54 Workaround for `zipfile.Path.is_file` returning true
55 for non-existent paths.
56 """
57 target = self.files().joinpath(path)
58 return target.is_file() and target.exists()
59
60 def files(self):
61 return zipfile.Path(self.archive, self.prefix)

Callers 1

is_fileMethod · 0.45

Calls 4

filesMethod · 0.95
joinpathMethod · 0.45
is_fileMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected