Skip to content

Commit

Permalink
Do not use deprecated API
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
  • Loading branch information
gaborbernat committed Nov 23, 2022
1 parent e6925a6 commit 172621e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/virtualenv/activation/via_template.py
Expand Up @@ -5,9 +5,9 @@
from .activator import Activator

if sys.version_info >= (3, 7):
from importlib.resources import read_binary
from importlib.resources import files
else:
from importlib_resources import read_binary
from importlib_resources import files


class ViaTemplateActivator(Activator, metaclass=ABCMeta):
Expand Down Expand Up @@ -47,7 +47,7 @@ def as_name(self, template):

def instantiate_template(self, replacements, template, creator):
# read content as binary to avoid platform specific line normalization (\n -> \r\n)
binary = read_binary(self.__module__, str(template))
binary = (files(self.__module__) / str(template)).read_bytes()
text = binary.decode("utf-8", errors="strict")
for key, value in replacements.items():
value = self._repr_unicode(creator, value)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -67,7 +67,7 @@ setenv =
skip_install = true
deps =
coverage>=6.5
diff_cover>=7.0.1
diff_cover>=7.0.2
extras =
parallel_show_output = true
commands =
Expand Down

0 comments on commit 172621e

Please sign in to comment.