Skip to main content

open

Asynchronously open a file and return an async context manager. This function checks if the underlying filesystem supports obstore bypass. If it does, it uses obstore to open the file. Otherwise, it falls back to the standard _open function which uses AsyncFileSystem.

def open(
path: str,
mode: str = "rb",
kwargs: Any
) - > AsyncReadableFile | AsyncWritableFile

Asynchronously open a file and return an async context manager. This function checks if the underlying filesystem supports obstore bypass. If it does, it uses obstore to open the file. Otherwise, it falls back to the standard _open function which uses AsyncFileSystem. It will raise NotImplementedError if neither obstore nor AsyncFileSystem is supported.

Parameters

NameTypeDescription
pathstrThe file path to open. This path is used to determine the underlying filesystem.
modestr = "rb"The mode in which to open the file (e.g., 'rb' for read binary, 'wb' for write binary). This determines whether the returned file object is readable or writable.
kwargsAnyAdditional keyword arguments to pass to the underlying file opening mechanism, such as obstore bypass or AsyncFileSystem.

Returns

TypeDescription
`AsyncReadableFileAsyncWritableFile`