From 352ac8144eb37ab639586172c1063c2f4f736a97 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Mon, 18 Mar 2019 03:54:54 -0700 Subject: [PATCH] Make compare_urls() a class method. --- src/pip/_internal/vcs/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pip/_internal/vcs/__init__.py b/src/pip/_internal/vcs/__init__.py index 03cc5571907..6fca0793008 100644 --- a/src/pip/_internal/vcs/__init__.py +++ b/src/pip/_internal/vcs/__init__.py @@ -364,7 +364,8 @@ def get_url_rev_options(self, url): return url, rev_options - def normalize_url(self, url): + @staticmethod + def normalize_url(url): # type: (str) -> str """ Normalize a URL for comparison by unquoting it and removing any @@ -372,12 +373,13 @@ def normalize_url(self, url): """ return urllib_parse.unquote(url).rstrip('/') - def compare_urls(self, url1, url2): + @classmethod + def compare_urls(cls, url1, url2): # type: (str, str) -> bool """ Compare two repo URLs for identity, ignoring incidental differences. """ - return (self.normalize_url(url1) == self.normalize_url(url2)) + return (cls.normalize_url(url1) == cls.normalize_url(url2)) @classmethod def fetch_new(cls, dest, url, rev_options):