-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
204 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import squirrel.artifact_manager.drivers # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Any, Optional | ||
|
||
from squirrel.driver.store import StoreDriver | ||
from squirrel.framework.plugins.plugin_manager import register_driver | ||
from squirrel.store import AbstractStore, FilesystemStore | ||
|
||
|
||
class DirectoryDriver(StoreDriver): | ||
name = "directory" | ||
|
||
def __init__(self, url: str, storage_options: Optional[dict[str, Any]] = None, **kwargs) -> None: | ||
"""Initializes FileSystemDriver. | ||
Args: | ||
url (str): the url of the store | ||
**kwargs: Keyword arguments to pass to the super class initializer. | ||
""" | ||
if "store" in kwargs: | ||
raise ValueError("Store of DirectoryDriver is fixed, `store` cannot be provided.") | ||
|
||
super().__init__(url=url, serializer=None, storage_options=storage_options, **kwargs) | ||
|
||
@property | ||
def store(self) -> AbstractStore: | ||
"""Store that is used by the driver.""" | ||
if self._store is None: | ||
self._store = FilesystemStore(url=self.url, serializer=self.serializer, **self.storage_options) | ||
return self._store | ||
|
||
|
||
register_driver(DirectoryDriver) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test: Bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test: Baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test: Foo |
Oops, something went wrong.