pkg_resources -> importlib.resources
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
.DS_store
|
.DS_store
|
||||||
.idea
|
.idea
|
||||||
**/*.npy
|
|
||||||
.conda-env
|
.conda-env
|
||||||
/play.py
|
/play.py
|
||||||
|
|
||||||
|
|||||||
BIN
src/scgenerator/data/raman_response.npy
Normal file
BIN
src/scgenerator/data/raman_response.npy
Normal file
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import importlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@@ -9,12 +10,12 @@ from typing import BinaryIO, Protocol, Sequence
|
|||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
|
|
||||||
def data_file(path: str) -> Path:
|
def data_file(path: str) -> Path:
|
||||||
"""returns a `Path` object pointing to the desired data file included in `scgenerator`"""
|
"""returns a `Path` object pointing to the desired data file included in `scgenerator`"""
|
||||||
return Path(pkg_resources.resource_filename("scgenerator", path))
|
file = importlib.resources.files("scgenerator") / "data" / path
|
||||||
|
return importlib.resources.as_file(file)
|
||||||
|
|
||||||
|
|
||||||
class CustomEncoder(json.JSONEncoder):
|
class CustomEncoder(json.JSONEncoder):
|
||||||
|
|||||||
Reference in New Issue
Block a user