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

Method read_text

modelscope/fileio/file.py:277–289  ·  view source on GitHub ↗

Read data from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Default: 'utf-8'. Returns: str: Expected text reading from ``fi

(uri: Union[str, Path], encoding: str = 'utf-8')

Source from the content-addressed store, hash-verified

275
276 @staticmethod
277 def read_text(uri: Union[str, Path], encoding: str = 'utf-8') -> str:
278 """Read data from a given ``filepath`` with 'r' mode.
279
280 Args:
281 filepath (str or Path): Path to read data.
282 encoding (str): The encoding format used to open the ``filepath``.
283 Default: 'utf-8'.
284
285 Returns:
286 str: Expected text reading from ``filepath``.
287 """
288 storage = File._get_storage(uri)
289 return storage.read_text(uri)
290
291 @staticmethod
292 def write(obj: bytes, uri: Union[str, Path]) -> None:

Callers 3

get_user_infoMethod · 0.45
loadFunction · 0.45

Calls 1

_get_storageMethod · 0.80

Tested by 1