Skip to content

Commit

Permalink
make fsspec optional
Browse files Browse the repository at this point in the history
  • Loading branch information
liyang committed Nov 20, 2024
1 parent 20760de commit 4d65b59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions megfile/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from datetime import datetime
from typing import IO, BinaryIO, Callable, Iterator, List, Optional, Tuple

import fsspec
try:
import fsspec

Check failure

Code scanning / Pyre

Type Error Error

Undefined import [21]: Could not find a module corresponding to import fsspec.
except ImportError: # pragma: no cover
fsspec = None

from megfile.errors import _create_missing_ok_generator
from megfile.interfaces import ContextIterator, FileEntry, PathLike, StatResult, URIPath
Expand Down Expand Up @@ -60,7 +63,7 @@ def _make_entry(filesystem, info):

class BaseFSSpecPath(URIPath):
protocol: str
filesystem: fsspec.AbstractFileSystem
filesystem: 'fsspec.AbstractFileSystem'

Check failure

Code scanning / Pyre

Type Error Error

Undefined or invalid type [11]: Annotation fsspec.AbstractFileSystem is not defined as a type.

def __init__(self, path: PathLike, *other_paths: PathLike):
super().__init__(path, *other_paths)
Expand Down
2 changes: 2 additions & 0 deletions requirements-fsspec.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fsspec
huggingface_hub

0 comments on commit 4d65b59

Please sign in to comment.