MCPcopy
hub / github.com/huggingface/datasets / open

Method open

src/datasets/utils/file_utils.py:1191–1201  ·  view source on GitHub ↗

Extend :func:`xopen` to support argument of type :obj:`~pathlib.Path`. Args: **args: Arguments passed to :func:`fsspec.open`. **kwargs: Keyword arguments passed to :func:`fsspec.open`. Returns: `io.FileIO`: File-like object.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

1189 return PurePosixPath(self.as_posix().split("::")[0]).suffix
1190
1191 def open(self, *args, **kwargs):
1192 """Extend :func:`xopen` to support argument of type :obj:`~pathlib.Path`.
1193
1194 Args:
1195 **args: Arguments passed to :func:`fsspec.open`.
1196 **kwargs: Keyword arguments passed to :func:`fsspec.open`.
1197
1198 Returns:
1199 `io.FileIO`: File-like object.
1200 """
1201 return xopen(str(self), *args, **kwargs)
1202
1203 def joinpath(self, *p: tuple[str, ...]) -> "xPath":
1204 """Extend :func:`xjoin` to support argument of type :obj:`~pathlib.Path`.

Callers 15

write_to_directoryMethod · 0.80
from_directoryMethod · 0.80
save_to_diskMethod · 0.80
load_from_diskMethod · 0.80
__init__Method · 0.80
save_to_diskMethod · 0.80
get_moduleMethod · 0.80
saveMethod · 0.80
loadMethod · 0.80
catMethod · 0.80
_openMethod · 0.80
_get_extraction_protocolFunction · 0.80

Calls 1

xopenFunction · 0.85