From 157dbc33bf16a69c82234df4290af57a3be93370 Mon Sep 17 00:00:00 2001 From: Marco Rubin <20150305+Rubo3@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:12:43 +0000 Subject: [PATCH 1/3] Fix warnings in collections/__init__.py --- slider/example_data/collections/__init__.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/slider/example_data/collections/__init__.py b/slider/example_data/collections/__init__.py index 37e202f..4bc76ff 100644 --- a/slider/example_data/collections/__init__.py +++ b/slider/example_data/collections/__init__.py @@ -1,4 +1,4 @@ -from pkg_resources import resource_filename +from importlib.resources import files from slider import CollectionDB @@ -11,12 +11,7 @@ def example_collection(name): name : str The name of the example file to open. """ - return CollectionDB.from_path( - resource_filename( - __name__, - name, - ), - ) + return CollectionDB.from_path(files(__name__) / name) def test_db(): From 0734e96dca078c237fb7dee097673cf03c2d0112 Mon Sep 17 00:00:00 2001 From: Marco Rubin <20150305+Rubo3@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:13:44 +0000 Subject: [PATCH 2/3] Fix warnings in beatmaps/__init__.py --- slider/example_data/beatmaps/__init__.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/slider/example_data/beatmaps/__init__.py b/slider/example_data/beatmaps/__init__.py index daca84d..3b20f88 100644 --- a/slider/example_data/beatmaps/__init__.py +++ b/slider/example_data/beatmaps/__init__.py @@ -1,4 +1,4 @@ -from pkg_resources import resource_filename +from importlib.resources import files from slider import Beatmap @@ -11,12 +11,7 @@ def example_beatmap(name): name : str The name of the example file to open. """ - return Beatmap.from_path( - resource_filename( - __name__, - name, - ), - ) + return Beatmap.from_path(files(__name__) / name) _sendan_life_versions = frozenset({ From 1d74cb5057b3026965468beadf7f0be525d0c729 Mon Sep 17 00:00:00 2001 From: Liam DeVoe Date: Wed, 6 Sep 2023 13:08:55 -0400 Subject: [PATCH 3/3] use pathlib instead of pkg_resources --- slider/example_data/beatmaps/__init__.py | 4 ++-- slider/example_data/collections/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slider/example_data/beatmaps/__init__.py b/slider/example_data/beatmaps/__init__.py index 3b20f88..c3a2a43 100644 --- a/slider/example_data/beatmaps/__init__.py +++ b/slider/example_data/beatmaps/__init__.py @@ -1,4 +1,4 @@ -from importlib.resources import files +from pathlib import Path from slider import Beatmap @@ -11,7 +11,7 @@ def example_beatmap(name): name : str The name of the example file to open. """ - return Beatmap.from_path(files(__name__) / name) + return Beatmap.from_path(Path(__file__).parent / name) _sendan_life_versions = frozenset({ diff --git a/slider/example_data/collections/__init__.py b/slider/example_data/collections/__init__.py index 4bc76ff..89e81f3 100644 --- a/slider/example_data/collections/__init__.py +++ b/slider/example_data/collections/__init__.py @@ -1,4 +1,4 @@ -from importlib.resources import files +from pathlib import Path from slider import CollectionDB @@ -11,7 +11,7 @@ def example_collection(name): name : str The name of the example file to open. """ - return CollectionDB.from_path(files(__name__) / name) + return CollectionDB.from_path(Path(__file__).parent / name) def test_db():