Skip to content

Commit ae1d76c

Browse files
committed
fix
1 parent 90c64f9 commit ae1d76c

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

pyiceberg/io/fsspec.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ def s3v4_rest_signer(properties: Properties, request: "AWSRequest", **_: Any) ->
129129
SIGNERS: Dict[str, Callable[[Properties, "AWSRequest"], "AWSRequest"]] = {"S3V4RestSigner": s3v4_rest_signer}
130130

131131

132-
def _file(_: Properties) -> LocalFileSystem:
132+
def _file(properties: Properties, netloc: Optional[str]) -> LocalFileSystem:
133133
return LocalFileSystem(auto_mkdir=True)
134134

135135

136-
def _s3(properties: Properties) -> AbstractFileSystem:
136+
def _s3(properties: Properties, netloc: Optional[str]) -> AbstractFileSystem:
137137
from s3fs import S3FileSystem
138138

139139
client_kwargs = {
@@ -180,7 +180,7 @@ def _s3(properties: Properties) -> AbstractFileSystem:
180180
return fs
181181

182182

183-
def _gs(properties: Properties) -> AbstractFileSystem:
183+
def _gs(properties: Properties, netloc: Optional[str]) -> AbstractFileSystem:
184184
# https://gcsfs.readthedocs.io/en/latest/api.html#gcsfs.core.GCSFileSystem
185185
from gcsfs import GCSFileSystem
186186

@@ -198,15 +198,15 @@ def _gs(properties: Properties) -> AbstractFileSystem:
198198
)
199199

200200

201-
def _adls(properties: Properties) -> AbstractFileSystem:
201+
def _adls(properties: Properties, netloc: Optional[str]) -> AbstractFileSystem:
202202
# https://fsspec.github.io/adlfs/api/
203203

204204
from adlfs import AzureBlobFileSystem
205205
from azure.core.credentials import AccessToken
206206
from azure.core.credentials_async import AsyncTokenCredential
207207

208208
# https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction-abfs-uri#uri-syntax
209-
if netloc := properties.get("netloc"):
209+
if netloc:
210210
account_uri = netloc.split("@")[-1]
211211
else:
212212
account_uri = None
@@ -249,7 +249,7 @@ async def get_token(self, *scopes: str, **kwargs: Any) -> AccessToken:
249249
)
250250

251251

252-
def _hf(properties: Properties) -> AbstractFileSystem:
252+
def _hf(properties: Properties, netloc: Optional[str]) -> AbstractFileSystem:
253253
from huggingface_hub import HfFileSystem
254254

255255
return HfFileSystem(
@@ -424,10 +424,7 @@ def _get_fs(self, scheme: str, netloc: Optional[str] = None) -> AbstractFileSyst
424424
"""Get a filesystem for a specific scheme and netloc."""
425425
if scheme not in self._scheme_to_fs:
426426
raise ValueError(f"No registered filesystem for scheme: {scheme}")
427-
properties = self.properties.copy()
428-
if netloc:
429-
properties["netloc"] = netloc
430-
return self._scheme_to_fs[scheme](properties)
427+
return self._scheme_to_fs[scheme](self.properties, netloc)
431428

432429
def __getstate__(self) -> Dict[str, Any]:
433430
"""Create a dictionary of the FsSpecFileIO fields used when pickling."""

0 commit comments

Comments
 (0)