From 16cfd970cba2d9d85b966ca4e50cd23a6d024cdf Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Mon, 21 Jan 2019 09:53:16 -0700 Subject: [PATCH] Fix invalid regex and escape sequences causing DeprecationWarning (#646) These bad escape sequences were causing `DeprecationWarning`s when running Pants with Python 3. Invalid entries were found through the regex `'re\..*\\'`, and equality to original string tested by comparing the two in a REPL. --- pex/finders.py | 2 +- pex/vendor/_vendored/wheel/wheel/metadata.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pex/finders.py b/pex/finders.py index 1698a61f3..a2b8aa568 100644 --- a/pex/finders.py +++ b/pex/finders.py @@ -103,7 +103,7 @@ class WheelMetadata(pkg_resources.EggMetadata): @classmethod def _escape(cls, filename_component): # See: https://www.python.org/dev/peps/pep-0427/#escaping-and-unicode - return re.sub("[^\w\d.]+", "_", filename_component, re.UNICODE) + return re.sub(r"[^\w\d.]+", "_", filename_component, re.UNICODE) @classmethod def _split_wheelname(cls, wheelname): diff --git a/pex/vendor/_vendored/wheel/wheel/metadata.py b/pex/vendor/_vendored/wheel/wheel/metadata.py index eca49bc09..7afdf7876 100644 --- a/pex/vendor/_vendored/wheel/wheel/metadata.py +++ b/pex/vendor/_vendored/wheel/wheel/metadata.py @@ -13,7 +13,7 @@ # Wheel itself is probably the only program that uses non-extras markers # in METADATA/PKG-INFO. Support its syntax with the extra at the end only. -EXTRA_RE = re.compile("""^(?P.*?)(;\s*(?P.*?)(extra == '(?P.*?)')?)$""") +EXTRA_RE = re.compile(r"^(?P.*?)(;\s*(?P.*?)(extra == '(?P.*?)')?)$") MayRequiresKey = namedtuple('MayRequiresKey', ('condition', 'extra'))