mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Bump importlib-resources from 5.12.0 to 6.0.1 (#2126)
* Bump importlib-resources from 5.12.0 to 6.0.1 Bumps [importlib-resources](https://github.com/python/importlib_resources) from 5.12.0 to 6.0.1. - [Release notes](https://github.com/python/importlib_resources/releases) - [Changelog](https://github.com/python/importlib_resources/blob/main/NEWS.rst) - [Commits](https://github.com/python/importlib_resources/compare/v5.12.0...v6.0.1) --- updated-dependencies: - dependency-name: importlib-resources dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update importlib-resources==6.0.1 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
9383d5120c
commit
72f1ce7865
4 changed files with 2 additions and 141 deletions
|
@ -6,31 +6,12 @@ from ._common import (
|
||||||
Package,
|
Package,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ._legacy import (
|
|
||||||
contents,
|
|
||||||
open_binary,
|
|
||||||
read_binary,
|
|
||||||
open_text,
|
|
||||||
read_text,
|
|
||||||
is_resource,
|
|
||||||
path,
|
|
||||||
Resource,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .abc import ResourceReader
|
from .abc import ResourceReader
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Package',
|
'Package',
|
||||||
'Resource',
|
|
||||||
'ResourceReader',
|
'ResourceReader',
|
||||||
'as_file',
|
'as_file',
|
||||||
'contents',
|
|
||||||
'files',
|
'files',
|
||||||
'is_resource',
|
|
||||||
'open_binary',
|
|
||||||
'open_text',
|
|
||||||
'path',
|
|
||||||
'read_binary',
|
|
||||||
'read_text',
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,120 +0,0 @@
|
||||||
import functools
|
|
||||||
import os
|
|
||||||
import pathlib
|
|
||||||
import types
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
from typing import Union, Iterable, ContextManager, BinaryIO, TextIO, Any
|
|
||||||
|
|
||||||
from . import _common
|
|
||||||
|
|
||||||
Package = Union[types.ModuleType, str]
|
|
||||||
Resource = str
|
|
||||||
|
|
||||||
|
|
||||||
def deprecated(func):
|
|
||||||
@functools.wraps(func)
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
warnings.warn(
|
|
||||||
f"{func.__name__} is deprecated. Use files() instead. "
|
|
||||||
"Refer to https://importlib-resources.readthedocs.io"
|
|
||||||
"/en/latest/using.html#migrating-from-legacy for migration advice.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
return func(*args, **kwargs)
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_path(path: Any) -> str:
|
|
||||||
"""Normalize a path by ensuring it is a string.
|
|
||||||
|
|
||||||
If the resulting string contains path separators, an exception is raised.
|
|
||||||
"""
|
|
||||||
str_path = str(path)
|
|
||||||
parent, file_name = os.path.split(str_path)
|
|
||||||
if parent:
|
|
||||||
raise ValueError(f'{path!r} must be only a file name')
|
|
||||||
return file_name
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def open_binary(package: Package, resource: Resource) -> BinaryIO:
|
|
||||||
"""Return a file-like object opened for binary reading of the resource."""
|
|
||||||
return (_common.files(package) / normalize_path(resource)).open('rb')
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def read_binary(package: Package, resource: Resource) -> bytes:
|
|
||||||
"""Return the binary contents of the resource."""
|
|
||||||
return (_common.files(package) / normalize_path(resource)).read_bytes()
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def open_text(
|
|
||||||
package: Package,
|
|
||||||
resource: Resource,
|
|
||||||
encoding: str = 'utf-8',
|
|
||||||
errors: str = 'strict',
|
|
||||||
) -> TextIO:
|
|
||||||
"""Return a file-like object opened for text reading of the resource."""
|
|
||||||
return (_common.files(package) / normalize_path(resource)).open(
|
|
||||||
'r', encoding=encoding, errors=errors
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def read_text(
|
|
||||||
package: Package,
|
|
||||||
resource: Resource,
|
|
||||||
encoding: str = 'utf-8',
|
|
||||||
errors: str = 'strict',
|
|
||||||
) -> str:
|
|
||||||
"""Return the decoded string of the resource.
|
|
||||||
|
|
||||||
The decoding-related arguments have the same semantics as those of
|
|
||||||
bytes.decode().
|
|
||||||
"""
|
|
||||||
with open_text(package, resource, encoding, errors) as fp:
|
|
||||||
return fp.read()
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def contents(package: Package) -> Iterable[str]:
|
|
||||||
"""Return an iterable of entries in `package`.
|
|
||||||
|
|
||||||
Note that not all entries are resources. Specifically, directories are
|
|
||||||
not considered resources. Use `is_resource()` on each entry returned here
|
|
||||||
to check if it is a resource or not.
|
|
||||||
"""
|
|
||||||
return [path.name for path in _common.files(package).iterdir()]
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def is_resource(package: Package, name: str) -> bool:
|
|
||||||
"""True if `name` is a resource inside `package`.
|
|
||||||
|
|
||||||
Directories are *not* resources.
|
|
||||||
"""
|
|
||||||
resource = normalize_path(name)
|
|
||||||
return any(
|
|
||||||
traversable.name == resource and traversable.is_file()
|
|
||||||
for traversable in _common.files(package).iterdir()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def path(
|
|
||||||
package: Package,
|
|
||||||
resource: Resource,
|
|
||||||
) -> ContextManager[pathlib.Path]:
|
|
||||||
"""A context manager providing a file path object to the resource.
|
|
||||||
|
|
||||||
If the resource does not already exist on its own on the file system,
|
|
||||||
a temporary file will be created. If the file was created, the file
|
|
||||||
will be deleted upon exiting the context manager (no exception is
|
|
||||||
raised if the file was deleted prior to the context manager
|
|
||||||
exiting).
|
|
||||||
"""
|
|
||||||
return _common.as_file(_common.files(package) / normalize_path(resource))
|
|
|
@ -1,6 +1,6 @@
|
||||||
apscheduler==3.10.1
|
apscheduler==3.10.1
|
||||||
importlib-metadata==6.8.0
|
importlib-metadata==6.8.0
|
||||||
importlib-resources==5.12.0
|
importlib-resources==6.0.1
|
||||||
pyinstaller==5.13.0
|
pyinstaller==5.13.0
|
||||||
pyopenssl==23.2.0
|
pyopenssl==23.2.0
|
||||||
pycryptodomex==3.18.0
|
pycryptodomex==3.18.0
|
||||||
|
|
|
@ -20,7 +20,7 @@ html5lib==1.1
|
||||||
httpagentparser==1.9.5
|
httpagentparser==1.9.5
|
||||||
idna==3.4
|
idna==3.4
|
||||||
importlib-metadata==6.8.0
|
importlib-metadata==6.8.0
|
||||||
importlib-resources==5.12.0
|
importlib-resources==6.0.1
|
||||||
git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois
|
git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois
|
||||||
IPy==1.01
|
IPy==1.01
|
||||||
Mako==1.2.4
|
Mako==1.2.4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue