Skip to content

Commit 5825017

Browse files
committed
Merge branch 'master' into fork-safe
2 parents b97fff7 + d1aaebf commit 5825017

File tree

16 files changed

+1511
-50
lines changed

16 files changed

+1511
-50
lines changed

docs/source/changelog.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Changelog
22
=========
33

4+
2025.3.0
5+
--------
6+
7+
Enhancements
8+
9+
- add pipe_file to HTTP (#1799, 1801)
10+
- add sync http for pyodide (#1177)
11+
- ls performance for local and detail=False (#1789)
12+
13+
Fixes
14+
15+
- dir/info consistency in dirfs (#1798)
16+
- referenceFS async consistency (#1794, 1795)
17+
- CI (#1793)
18+
19+
420
2025.2.0
521
--------
622

fsspec/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def open(
452452
newline: bytes or None
453453
Used for line terminator in text mode. If None, uses system default;
454454
if blank, uses no translation.
455-
expand: bool or Nonw
455+
expand: bool or None
456456
Whether to regard file paths containing special glob characters as needing
457457
expansion (finding the first match) or absolute. Setting False allows using
458458
paths which do embed such characters. If None (default), this argument

fsspec/implementations/asyn_wrapper.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import functools
33
import inspect
44

5-
from fsspec.asyn import AsyncFileSystem
5+
from fsspec.asyn import AsyncFileSystem, running_async
66

77

88
def async_wrapper(func, obj=None):
@@ -42,10 +42,14 @@ class AsyncFileSystemWrapper(AsyncFileSystem):
4242
The synchronous filesystem instance to wrap.
4343
"""
4444

45-
def __init__(self, sync_fs, *args, **kwargs):
46-
super().__init__(*args, **kwargs)
47-
self.asynchronous = True
48-
self.sync_fs = sync_fs
45+
protocol = "async_wrapper"
46+
cachable = False
47+
48+
def __init__(self, fs, *args, asynchronous=None, **kwargs):
49+
if asynchronous is None:
50+
asynchronous = running_async()
51+
super().__init__(*args, asynchronous=asynchronous, **kwargs)
52+
self.sync_fs = fs
4953
self.protocol = self.sync_fs.protocol
5054
self._wrap_all_sync_methods()
5155

fsspec/implementations/dirfs.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ def __init__(
3636
super().__init__(**storage_options)
3737
if fs is None:
3838
fs = filesystem(protocol=target_protocol, **(target_options or {}))
39-
if (path is not None) ^ (fo is not None) is False:
40-
raise ValueError("Provide path or fo, not both")
4139
path = path or fo
4240

4341
if self.asynchronous and not fs.async_impl:
@@ -233,10 +231,16 @@ def exists(self, path):
233231
return self.fs.exists(self._join(path))
234232

235233
async def _info(self, path, **kwargs):
236-
return await self.fs._info(self._join(path), **kwargs)
234+
info = await self.fs._info(self._join(path), **kwargs)
235+
info = info.copy()
236+
info["name"] = self._relpath(info["name"])
237+
return info
237238

238239
def info(self, path, **kwargs):
239-
return self.fs.info(self._join(path), **kwargs)
240+
info = self.fs.info(self._join(path), **kwargs)
241+
info = info.copy()
242+
info["name"] = self._relpath(info["name"])
243+
return info
240244

241245
async def _ls(self, path, detail=True, **kwargs):
242246
ret = (await self.fs._ls(self._join(path), detail=detail, **kwargs)).copy()

fsspec/implementations/http.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,30 @@ async def _isdir(self, path):
522522
except (FileNotFoundError, ValueError):
523523
return False
524524

525+
async def _pipe_file(self, path, value, mode="overwrite", **kwargs):
526+
"""
527+
Write bytes to a remote file over HTTP.
528+
529+
Parameters
530+
----------
531+
path : str
532+
Target URL where the data should be written
533+
value : bytes
534+
Data to be written
535+
mode : str
536+
How to write to the file - 'overwrite' or 'append'
537+
**kwargs : dict
538+
Additional parameters to pass to the HTTP request
539+
"""
540+
url = self._strip_protocol(path)
541+
headers = kwargs.pop("headers", {})
542+
headers["Content-Length"] = str(len(value))
543+
544+
session = await self.set_session()
545+
546+
async with session.put(url, data=value, headers=headers, **kwargs) as r:
547+
r.raise_for_status()
548+
525549

526550
class HTTPFile(AbstractBufferedFile):
527551
"""

0 commit comments

Comments
 (0)