Bump importlib-resources from 5.10.1 to 5.12.0 (#2004)

* Bump importlib-resources from 5.10.1 to 5.12.0

Bumps [importlib-resources](https://github.com/python/importlib_resources) from 5.10.1 to 5.12.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.10.1...v5.12.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.12.0

---------

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:
dependabot[bot] 2023-03-02 20:50:15 -08:00 committed by GitHub
parent eaa294b2a2
commit c8f43825f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 243 additions and 134 deletions

View file

@ -1,12 +1,16 @@
import pathlib
import functools
from typing import Dict, Union
####
# from jaraco.path 3.4
# from jaraco.path 3.4.1
FilesSpec = Dict[str, Union[str, bytes, 'FilesSpec']] # type: ignore
def build(spec, prefix=pathlib.Path()):
def build(spec: FilesSpec, prefix=pathlib.Path()):
"""
Build a set of files/directories, as described by the spec.
@ -23,15 +27,17 @@ def build(spec, prefix=pathlib.Path()):
... "baz.py": "# Some code",
... }
... }
>>> tmpdir = getfixture('tmpdir')
>>> build(spec, tmpdir)
>>> target = getfixture('tmp_path')
>>> build(spec, target)
>>> target.joinpath('foo/baz.py').read_text(encoding='utf-8')
'# Some code'
"""
for name, contents in spec.items():
create(contents, pathlib.Path(prefix) / name)
@functools.singledispatch
def create(content, path):
def create(content: Union[str, bytes, FilesSpec], path):
path.mkdir(exist_ok=True)
build(content, prefix=path) # type: ignore
@ -43,7 +49,7 @@ def _(content: bytes, path):
@create.register
def _(content: str, path):
path.write_text(content)
path.write_text(content, encoding='utf-8')
# end from jaraco.path