squirrel.driver.file_driver
¶
Module Contents¶
Classes¶
Drives the access to a data source. |
-
class
squirrel.driver.file_driver.
FileDriver
(path: str, **kwargs)¶ Bases:
squirrel.driver.driver.Driver
Drives the access to a data source.
Initializes FileDriver.
- Parameters
path (str) – Path to a file.
**kwargs – Keyword arguments passed to the super class initializer.
-
name
= file¶
-
open
(self, mode: str = 'r', create_if_not_exists: bool = False, **kwargs) → IO¶ Returns a handler for the file.
Uses
squirrel.fsspec.fs.get_fs_from_url()
to get a filesystem object corresponding to self.path. Simply returns the handler returned from the open() method of the filesystem.- Parameters
mode (str) – IO mode to use when opening the file. Will be forwarded to filesystem.open() method. Defaults to “r”.
create_if_not_exists (bool) – If True, the file will be created if it does not exist (along with the parent directories). This is achieved by providing auto_mkdir=create_if_not_exists as a storage option to the filesystem. Defaults to False.
**kwargs – Keyword arguments that are passed to the filesystem.open() method.
- Returns
(IO) File handler for the file at self.path.