mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-25 14:37:59 +01:00
Use importlib resources
This commit is contained in:
parent
02228e13d7
commit
da53762804
3 changed files with 5 additions and 5 deletions
|
@ -26,8 +26,8 @@ import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from importlib_resources import read_binary, read_text
|
||||||
from typing import Any, Dict, Optional, Type, TypeVar, Union
|
from typing import Any, Dict, Optional, Type, TypeVar, Union
|
||||||
from pkg_resources import resource_string
|
|
||||||
|
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
@ -172,9 +172,7 @@ class ResourceLoader:
|
||||||
if binary is None:
|
if binary is None:
|
||||||
binary = self.binary
|
binary = self.binary
|
||||||
|
|
||||||
data = resource_string(self.package, name)
|
|
||||||
|
|
||||||
if binary:
|
if binary:
|
||||||
return data
|
return read_binary(self.package, name)
|
||||||
else:
|
else:
|
||||||
return data.decode()
|
return read_text(self.package, name)
|
||||||
|
|
|
@ -4,6 +4,7 @@ blinker
|
||||||
boltons
|
boltons
|
||||||
flake8
|
flake8
|
||||||
git+https://github.com/qvantel/jsonapi-client.git
|
git+https://github.com/qvantel/jsonapi-client.git
|
||||||
|
importlib_resources
|
||||||
jmespath
|
jmespath
|
||||||
mypy
|
mypy
|
||||||
pytest
|
pytest
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -89,6 +89,7 @@ setup(
|
||||||
'bbcode',
|
'bbcode',
|
||||||
'blinker',
|
'blinker',
|
||||||
'boltons',
|
'boltons',
|
||||||
|
'importlib_resources',
|
||||||
'jmespath',
|
'jmespath',
|
||||||
'jsonapi-client',
|
'jsonapi-client',
|
||||||
'requests',
|
'requests',
|
||||||
|
|
Loading…
Reference in a new issue