Skip to content

Commit 540012a

Browse files
committed
WIP support Py 3.12+
1 parent 5dab4c6 commit 540012a

File tree

7 files changed

+93
-38
lines changed

7 files changed

+93
-38
lines changed

kglab/decorators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
import typing
1616

1717
from icecream import ic # type: ignore # pylint: disable=W0611,E0401
18-
import urlpath # type: ignore # pylint: disable=E0401
18+
import apeye.url
1919

2020

2121
def _test_path (
22-
path: typing.Union[ pathlib.Path, urlpath.URL ]
22+
path: typing.Union[ pathlib.Path, apeye.url.URL ]
2323
) -> bool:
2424
"""
2525
Semi-private function to test whether the given path parameter is an
26-
instance of `pathlib.Path`, `urlpath.URL`, or a related class.
26+
instance of `pathlib.Path`, `apeye.url.URL`, or a related class.
2727
2828
path:
2929
parameter to be tested
3030
3131
returns:
3232
test condition
3333
"""
34-
return isinstance(path, (pathlib.Path, urlpath.URL))
34+
return isinstance(path, (pathlib.Path, apeye.url.URL))
3535

3636

3737
def multifile (

kglab/pkg_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
import pandas as pd # type: ignore # pylint: disable=E0401
1313
import rdflib # type: ignore # pylint: disable=E0401
14-
import urlpath # type: ignore # pylint: disable=E0401
14+
import apeye.url
1515

1616

17-
PathLike = typing.Union[ str, pathlib.Path, urlpath.URL ]
17+
PathLike = typing.Union[ str, pathlib.Path, apeye.url.URL ]
1818
IOPathLike = typing.Union[ PathLike, typing.IO ]
1919

2020
RDF_Node = typing.Union[ rdflib.term.Node, rdflib.term.URIRef, rdflib.term.Literal, rdflib.term.BNode ]

kglab/serde.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"""
55

66
## Python standard libraries
7+
import codecs
78
import datetime
89
import io
910
import json
10-
import typing
11-
import codecs
12-
import urlpath
1311
import pathlib
12+
import typing
1413

1514
### third-parties libraries
1615
from icecream import ic # type: ignore
16+
import apeye.url
1717
import chocolate # type: ignore
1818
import csvwlib # type: ignore
1919
import morph_kgc # type: ignore
@@ -135,7 +135,7 @@ def _get_filename (
135135
"""
136136
if not path:
137137
filename = None
138-
elif isinstance(path, urlpath.URL):
138+
elif isinstance(path, apeye.url.URL):
139139
filename = str(path)
140140
elif isinstance(path, pathlib.Path):
141141
filename = path.as_posix()

poetry.lock

Lines changed: 76 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ python-dateutil = "^2.9.0.post0"
7676
icecream = "^2.1.7"
7777
cryptography = "^45.0.6"
7878
pynvml = "^12.0.0"
79-
urlpath = "^1.2.0"
8079
requests = "^2.32.5"
8180
gcsfs = "^2025.7.0"
8281
pyarrow = "^21.0.0"
8382
tqdm = "^4.67.1"
8483
igraph = "^0.11.9"
84+
apeye = "^1.4.1"
8585

8686

8787
[tool.poetry.group.dev.dependencies]

tests/test_composed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from sklearn import datasets
77
import pandas as pd
8-
import urlpath
8+
import apeye.url
99

1010
import kglab
1111

@@ -15,7 +15,7 @@ def test_load_save_measure ():
1515
Coverage:
1616
1717
* KnowledgeGraph() constructor
18-
* KnowledgeGraph.load_rdf() from pathlib.Path, urlpath.URL
18+
* KnowledgeGraph.load_rdf() from pathlib.Path, apeye.url.URL
1919
* KnowledgeGraph.safe_rdf()
2020
* KnowledgeGraph.load_jsonld()
2121
* KnowledgeGraph.save_jsonld()
@@ -30,9 +30,9 @@ def test_load_save_measure ():
3030
with warnings.catch_warnings():
3131
warnings.filterwarnings("ignore", message="unclosed file*")
3232

33-
# load RDF from urlpath.URL
33+
# load RDF from apeye.url.URL
3434
kg = kglab.KnowledgeGraph()
35-
path = urlpath.URL("https://storage.googleapis.com/kglab-tutorial/foaf.rdf")
35+
path = apeye.url.URL("https://storage.googleapis.com/kglab-tutorial/foaf.rdf")
3636
kg.load_rdf(path, format="xml")
3737
tmp.close()
3838

tests/test_kbgraph_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def test_get_filename(kg_test_data):
4848
assert test1 is None
4949

5050
# an address
51-
from urlpath import URL
52-
test2 = kg_test_data._get_filename(URL("gs://kglab-tutorial/foaf.parquet"))
51+
import apeye.url
52+
test2 = kg_test_data._get_filename(apeye.url.URL("gs://kglab-tutorial/foaf.parquet"))
5353
assert type(test2) == str
5454
assert test2 == "gs://kglab-tutorial/foaf.parquet"
5555

0 commit comments

Comments
 (0)