Skip to content

Commit eb8e8e5

Browse files
authored
Merge pull request #23 from datarevenue-berlin/ah-windows-support
Add windows support
2 parents ff47775 + d7c955c commit eb8e8e5

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

drfs/filesystems/util.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_fs(path, opts=None, rtype="instance"):
2525
try:
2626
protocol = path.scheme
2727
except AttributeError:
28-
protocol = urllib.parse.urlparse(str(path)).scheme
28+
protocol = _get_protocol(path)
2929

3030
try:
3131
cls = FILESYSTEMS[protocol]
@@ -44,6 +44,15 @@ def get_fs(path, opts=None, rtype="instance"):
4444
return cls(**opts_)
4545

4646

47+
def _get_protocol(path):
48+
if "://" in str(path):
49+
protocol = urllib.parse.urlparse(str(path)).scheme
50+
else:
51+
# most likely a windows path, basically if in doubt assume local
52+
protocol = ""
53+
return protocol
54+
55+
4756
def _fix_opts_abfs(cls, path, opts: dict):
4857
try:
4958
from drfs.filesystems.azure_blob import AzureBlobFileSystem, extract_abfs_parts

drfs/tests/test_filesystem.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def _get_fs_tuples():
4848
('user/some_file.txt', LocalFileSystem),
4949
('file://user/some_file.txt', LocalFileSystem),
5050
('/home/user/some_file.txt', LocalFileSystem),
51-
('memory:/home/directory/some_file.txt', MemoryFileSystem),
51+
(r"C:\Users\alhoeng\drfs", LocalFileSystem),
52+
('memory://home/directory/some_file.txt', MemoryFileSystem),
5253
]
5354
if S3FileSystem:
5455
res.append(

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pytz
22
urlpath==1.1.*
3+
fsspec==0.8.0

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import versioneer
88

9-
with open('README.rst') as readme_file:
9+
with open('README.md') as readme_file:
1010
readme = readme_file.read()
1111

1212
with open('HISTORY.rst') as history_file:

0 commit comments

Comments
 (0)