From 75f62c28b82842d9a520e99f6a7c7dd112717fda Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 18 Mar 2020 11:24:18 +0000 Subject: [PATCH 1/2] path_info: HTTPURLInfo minor inheritance tweak --- dvc/path_info.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dvc/path_info.py b/dvc/path_info.py index 613a76c014..0d23db7c0d 100644 --- a/dvc/path_info.py +++ b/dvc/path_info.py @@ -244,6 +244,8 @@ def path(self): class HTTPURLInfo(URLInfo): + __hash__ = URLInfo.__hash__ + def __init__(self, url): p = urlparse(url) stripped = p._replace(params=None, query=None, fragment=None) @@ -314,6 +316,3 @@ def __eq__(self, other): and self._path == other._path and self._extra_parts == other._extra_parts ) - - def __hash__(self): - return hash(self.parts) From 1b744425db86c1a8375a5d612650dbc0bd670698 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 24 Mar 2020 18:54:46 +0000 Subject: [PATCH 2/2] path_info: rename `fill_parts` => `_fill_parts` --- dvc/path_info.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dvc/path_info.py b/dvc/path_info.py index 0d23db7c0d..4f757b00b6 100644 --- a/dvc/path_info.py +++ b/dvc/path_info.py @@ -115,7 +115,7 @@ def __init__(self, url): assert not p.query and not p.params and not p.fragment assert p.password is None - self.fill_parts(p.scheme, p.hostname, p.username, p.port, p.path) + self._fill_parts(p.scheme, p.hostname, p.username, p.port, p.path) @classmethod def from_parts( @@ -127,10 +127,10 @@ def from_parts( return cls("{}://{}{}".format(scheme, netloc, path)) obj = cls.__new__(cls) - obj.fill_parts(scheme, host, user, port, path) + obj._fill_parts(scheme, host, user, port, path) return obj - def fill_parts(self, scheme, host, user, port, path): + def _fill_parts(self, scheme, host, user, port, path): assert scheme != "remote" assert isinstance(path, (str, bytes, _URLPathInfo)) @@ -282,7 +282,7 @@ def from_parts( ) obj = cls.__new__(cls) - obj.fill_parts(scheme, host, user, port, path) + obj._fill_parts(scheme, host, user, port, path) obj.params = params obj.query = query obj.fragment = fragment