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

Method get_data

Lib/zipimport.py:135–154  ·  view source on GitHub ↗

get_data(pathname) -> string with file data. Return the data associated with 'pathname'. Raise OSError if the file wasn't found.

(self, pathname)

Source from the content-addressed store, hash-verified

133
134
135 def get_data(self, pathname):
136 """get_data(pathname) -> string with file data.
137
138 Return the data associated with 'pathname'. Raise OSError if
139 the file wasn't found.
140 """
141 if alt_path_sep:
142 pathname = pathname.replace(alt_path_sep, path_sep)
143
144 key = pathname
145 if pathname.startswith(self.archive + path_sep):
146 key = pathname[len(self.archive + path_sep):]
147
148 try:
149 toc_entry = self._get_files()[key]
150 except KeyError:
151 raise OSError(0, '', key)
152 if toc_entry is None:
153 return b''
154 return _get_data(self.archive, toc_entry)
155
156
157 # Return a string matching __file__ for the named module

Callers

nothing calls this directly

Calls 4

_get_filesMethod · 0.95
_get_dataFunction · 0.85
replaceMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected