Bump importlib-resources from 5.4.0 to 5.6.0 (#1699)

* Bump importlib-resources from 5.4.0 to 5.6.0

Bumps [importlib-resources](https://github.com/python/importlib_resources) from 5.4.0 to 5.6.0.
- [Release notes](https://github.com/python/importlib_resources/releases)
- [Changelog](https://github.com/python/importlib_resources/blob/main/CHANGES.rst)
- [Commits](https://github.com/python/importlib_resources/compare/v5.4.0...v5.6.0)

---
updated-dependencies:
- dependency-name: importlib-resources
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update importlib-resources==5.6.0

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:
dependabot[bot] 2022-04-12 18:42:48 -07:00 committed by GitHub
parent c54c811eec
commit fa52d99691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 15 deletions

View file

@ -1,9 +1,12 @@
# flake8: noqa # flake8: noqa
import abc import abc
import os
import sys import sys
import pathlib import pathlib
from contextlib import suppress from contextlib import suppress
from typing import Union
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
from zipfile import Path as ZipPath # type: ignore from zipfile import Path as ZipPath # type: ignore
@ -96,3 +99,10 @@ def wrap_spec(package):
from . import _adapters from . import _adapters
return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader) return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
if sys.version_info >= (3, 9):
StrPath = Union[str, os.PathLike[str]]
else:
# PathLike is only subscriptable at runtime in 3.9+
StrPath = Union[str, "os.PathLike[str]"]

View file

@ -1,7 +1,11 @@
import abc import abc
from typing import BinaryIO, Iterable, Text import io
from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional
from ._compat import runtime_checkable, Protocol from ._compat import runtime_checkable, Protocol, StrPath
__all__ = ["ResourceReader", "Traversable", "TraversableResources"]
class ResourceReader(metaclass=abc.ABCMeta): class ResourceReader(metaclass=abc.ABCMeta):
@ -54,19 +58,19 @@ class Traversable(Protocol):
""" """
@abc.abstractmethod @abc.abstractmethod
def iterdir(self): def iterdir(self) -> Iterator["Traversable"]:
""" """
Yield Traversable objects in self Yield Traversable objects in self
""" """
def read_bytes(self): def read_bytes(self) -> bytes:
""" """
Read contents of self as bytes Read contents of self as bytes
""" """
with self.open('rb') as strm: with self.open('rb') as strm:
return strm.read() return strm.read()
def read_text(self, encoding=None): def read_text(self, encoding: Optional[str] = None) -> str:
""" """
Read contents of self as text Read contents of self as text
""" """
@ -86,12 +90,12 @@ class Traversable(Protocol):
""" """
@abc.abstractmethod @abc.abstractmethod
def joinpath(self, child): def joinpath(self, child: StrPath) -> "Traversable":
""" """
Return Traversable child in self Return Traversable child in self
""" """
def __truediv__(self, child): def __truediv__(self, child: StrPath) -> "Traversable":
""" """
Return Traversable child in self Return Traversable child in self
""" """
@ -121,17 +125,17 @@ class TraversableResources(ResourceReader):
""" """
@abc.abstractmethod @abc.abstractmethod
def files(self): def files(self) -> "Traversable":
"""Return a Traversable object for the loaded package.""" """Return a Traversable object for the loaded package."""
def open_resource(self, resource): def open_resource(self, resource: StrPath) -> io.BufferedReader:
return self.files().joinpath(resource).open('rb') return self.files().joinpath(resource).open('rb')
def resource_path(self, resource): def resource_path(self, resource: Any) -> NoReturn:
raise FileNotFoundError(resource) raise FileNotFoundError(resource)
def is_resource(self, path): def is_resource(self, path: StrPath) -> bool:
return self.files().joinpath(path).is_file() return self.files().joinpath(path).is_file()
def contents(self): def contents(self) -> Iterator[str]:
return (item.name for item in self.files().iterdir()) return (item.name for item in self.files().iterdir())

View file

@ -42,7 +42,7 @@ def generate(suffix):
def walk(datapath): def walk(datapath):
for dirpath, dirnames, filenames in os.walk(datapath): for dirpath, dirnames, filenames in os.walk(datapath):
with contextlib.suppress(KeyError): with contextlib.suppress(ValueError):
dirnames.remove('__pycache__') dirnames.remove('__pycache__')
for filename in filenames: for filename in filenames:
res = pathlib.Path(dirpath) / filename res = pathlib.Path(dirpath) / filename

View file

@ -1,5 +1,5 @@
apscheduler==3.8.0 apscheduler==3.8.0
importlib-resources==5.4.0 importlib-resources==5.6.0
pyinstaller==4.9 pyinstaller==4.9
pyopenssl==22.0.0 pyopenssl==22.0.0
pycryptodomex==3.14.1 pycryptodomex==3.14.1

View file

@ -18,7 +18,7 @@ gntp==1.0.3
html5lib==1.1 html5lib==1.1
httpagentparser==1.9.2 httpagentparser==1.9.2
idna==3.3 idna==3.3
importlib-resources==5.4.0 importlib-resources==5.6.0
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.1.6 Mako==1.1.6