MCPcopy Create free account
hub / github.com/datapane/datapane / load_file

Method load_file

python-client/src/datapane/processors/file_store.py:189–197  ·  view source on GitHub ↗

load a file into the store (makes a copy)

(self, path: Path)

Source from the content-addressed store, hash-verified

187 self.files.append(fw)
188
189 def load_file(self, path: Path) -> FileEntry:
190 """load a file into the store (makes a copy)"""
191 # TODO - ideally lazily-link a path to the store (rather than copy it in)
192 ext = "".join(path.suffixes)
193 dest_obj = self.fw_klass(ext=ext, dir_path=self.dir_path)
194 with path.open("rb") as src_obj:
195 copyfileobj(src_obj, dest_obj.file)
196 self.add_file(dest_obj)
197 return dest_obj
198
199 def as_dict(self) -> dict:
200 """Build a json structure suitable for embedding in a html file, json-rpc response, etc."""

Callers

nothing calls this directly

Calls 2

add_fileMethod · 0.95
openMethod · 0.80

Tested by

no test coverage detected