Last active
February 10, 2022 08:59
-
-
Save statguy/f92b8fc08211b232c4ae77ca8662a704 to your computer and use it in GitHub Desktop.
Revisions
-
statguy revised this gist
Feb 10, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import fsspec import pickle def write_pickle(data: Any, path: str) -> None: with fsspec.open(path, "wb") as file: pickle.dump(data, file) -
statguy created this gist
Feb 10, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ from typing import Any import fsspec import pickle def write_pickle(data: Any, path: str) -> None: with fsspec.open(path, "wb") as file: pickle.dump(data, file) def read_pickle(path: str) -> Any: with fsspec.open(path, "rb") as file: return pickle.load(file) data = {"a": 1} write_pickle(data, "s3://my_bucket/data.tmp") write_pickle(data, "file:///tmp/data.tmp") assert read_pickle("s3://my_bucket/data.tmp") == data assert read_pickle("file:///tmp/data.tmp") == data