pkg_resources -> importlib.resources
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
.DS_store
|
||||
.idea
|
||||
**/*.npy
|
||||
.conda-env
|
||||
/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
|
||||
|
||||
import datetime
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
@@ -9,12 +10,12 @@ from typing import BinaryIO, Protocol, Sequence
|
||||
from zipfile import ZipFile
|
||||
|
||||
import numpy as np
|
||||
import pkg_resources
|
||||
|
||||
|
||||
def data_file(path: str) -> Path:
|
||||
"""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):
|
||||
|
||||
Reference in New Issue
Block a user