From 172621e9558749920118570d085b11a1faeccdb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 22 Nov 2022 18:38:08 -0800 Subject: [PATCH] Do not use deprecated API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- src/virtualenv/activation/via_template.py | 6 +++--- tox.ini | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/virtualenv/activation/via_template.py b/src/virtualenv/activation/via_template.py index bfb974413..2900b4a92 100644 --- a/src/virtualenv/activation/via_template.py +++ b/src/virtualenv/activation/via_template.py @@ -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): @@ -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) diff --git a/tox.ini b/tox.ini index 3d14359fc..d1fe09108 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =