MCPcopy Create free account
hub / github.com/modelscope/modelscope / write

Method write

modelscope/fileio/file.py:292–304  ·  view source on GitHub ↗

Write data to a given ``filepath`` with 'wb' mode. Note: ``write`` will create a directory if the directory of ``filepath`` does not exist. Args: obj (bytes): Data to be written. filepath (str or Path): Path to write data.

(obj: bytes, uri: Union[str, Path])

Source from the content-addressed store, hash-verified

290
291 @staticmethod
292 def write(obj: bytes, uri: Union[str, Path]) -> None:
293 """Write data to a given ``filepath`` with 'wb' mode.
294
295 Note:
296 ``write`` will create a directory if the directory of ``filepath``
297 does not exist.
298
299 Args:
300 obj (bytes): Data to be written.
301 filepath (str or Path): Path to write data.
302 """
303 storage = File._get_storage(uri)
304 return storage.write(obj, uri)
305
306 @staticmethod
307 def write_text(obj: str, uri: str, encoding: str = 'utf-8') -> None:

Callers 15

from_stringMethod · 0.45
dumpMethod · 0.45
save_checkpointFunction · 0.45
save_configurationFunction · 0.45
ensure_writeFunction · 0.45
download_and_untarFunction · 0.45
_startMethod · 0.45
input_output.pyFile · 0.45
urlretrieveFunction · 0.45
update_plugins_fileMethod · 0.45

Calls 1

_get_storageMethod · 0.80

Tested by 15

download_and_untarFunction · 0.36
_startMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
gen_mock_dataMethod · 0.36
_construct_fileMethod · 0.36
setUpMethod · 0.36