Skip to content

Commit 939a80a

Browse files
committed
Ersetze fsspec.core.strip_protocol durch split_protocol und füge lokalen strip_protocol‑Wrapper in dataset, io, metadata, schema und helpers/security hinzu. Bump-Version auf 0.22.3
1 parent a16f736 commit 939a80a

File tree

6 files changed

+66
-6
lines changed

6 files changed

+66
-6
lines changed

pydala/dataset.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import pyarrow.dataset as pds
1616
import tqdm
1717
from fsspec import AbstractFileSystem
18-
from fsspec.core import strip_protocol
18+
from fsspec.core import split_protocol
1919

2020
# Initialize logger
2121
logger = logging.getLogger(__name__)
@@ -41,6 +41,18 @@
4141
from .table import PydalaTable
4242

4343

44+
def strip_protocol(path: str) -> str:
45+
"""Strips the protocol from a given path.
46+
47+
Args:
48+
path (str): The input path which may contain a protocol.
49+
Returns:
50+
str: The path without the protocol.
51+
"""
52+
protocol, path = split_protocol(path)
53+
return path
54+
55+
4456
class BaseDataset:
4557
"""A base class for dataset operations supporting multiple file formats.
4658

pydala/helpers/security.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55
import re
66
import string
77
from typing import Any
8-
from fsspec.core import strip_protocol
8+
from fsspec.core import split_protocol
9+
10+
11+
def strip_protocol(path: str) -> str:
12+
"""Strips the protocol from a given path.
13+
14+
Args:
15+
path (str): The input path which may contain a protocol.
16+
Returns:
17+
str: The path without the protocol.
18+
"""
19+
protocol, path = split_protocol(path)
20+
return path
921

1022

1123
def escape_sql_identifier(identifier: str) -> str:

pydala/io.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pyarrow.parquet as pq
1414
from fsspec import AbstractFileSystem
1515
from fsspec import filesystem as fsspec_filesystem
16-
from fsspec.core import strip_protocol
16+
from fsspec.core import split_protocol
1717
from loguru import logger
1818

1919
# Local imports
@@ -24,6 +24,18 @@
2424
from .table import PydalaTable
2525

2626

27+
def strip_protocol(path: str) -> str:
28+
"""Strips the protocol from a given path.
29+
30+
Args:
31+
path (str): The input path which may contain a protocol.
32+
Returns:
33+
str: The path without the protocol.
34+
"""
35+
protocol, path = split_protocol(path)
36+
return path
37+
38+
2739
def write_table(
2840
table: pa.Table,
2941
path: str,

pydala/metadata.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pyarrow.fs as pfs
1515
import pyarrow.parquet as pq
1616
from fsspec import AbstractFileSystem
17-
from fsspec.core import strip_protocol
17+
from fsspec.core import split_protocol
1818
from loguru import logger
1919

2020
from .filesystem import FileSystem, clear_cache
@@ -28,6 +28,18 @@
2828
)
2929

3030

31+
def strip_protocol(path: str) -> str:
32+
"""Strips the protocol from a given path.
33+
34+
Args:
35+
path (str): The input path which may contain a protocol.
36+
Returns:
37+
str: The path without the protocol.
38+
"""
39+
protocol, path = split_protocol(path)
40+
return path
41+
42+
3143
def serialize_metadata(metadata: dict[str, pq.FileMetaData]) -> dict[str, Any]:
3244
"""Safely serialize metadata to a JSON-compatible format.
3345

pydala/schema.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@
55
import pyarrow.fs as pfs
66
import pyarrow.parquet as pq
77
from fsspec import AbstractFileSystem
8-
from fsspec.core import strip_protocol
8+
from fsspec.core import split_protocol
99
from .helpers.misc import read_table, run_parallel, unify_schemas_pl
1010

1111

12+
def strip_protocol(path: str) -> str:
13+
"""Strips the protocol from a given path.
14+
15+
Args:
16+
path (str): The input path which may contain a protocol.
17+
Returns:
18+
str: The path without the protocol.
19+
"""
20+
protocol, path = split_protocol(path)
21+
return path
22+
23+
1224
def sort_schema(schema: pa.Schema, names: list[str] | None = None) -> pa.Schema:
1325
"""Sort fields of a pyarrow schema in alphabetical order.
1426

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ name = "pydala2"
2525
readme = "README.md"
2626
#repository = "https://github.com/legout/pydala2"
2727
requires-python = ">= 3.11"
28-
version = "0.22.2"
28+
version = "0.22.3"
2929

3030
[project.optional-dependencies]
3131
legacy = ["polars-lts-cpu>=0.20.4"]

0 commit comments

Comments
 (0)