-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: remove string compat related code #3024
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,13 @@ | |
from funcy import cached_property | ||
|
||
from dvc.utils import relpath | ||
from dvc.utils.compat import basestring | ||
from dvc.utils.compat import builtin_str | ||
from dvc.utils.compat import pathlib | ||
from dvc.utils.compat import str | ||
from dvc.utils.compat import urlparse | ||
|
||
|
||
class _BasePath(object): | ||
def overlaps(self, other): | ||
if isinstance(other, basestring): | ||
if isinstance(other, (str, bytes)): | ||
other = self.__class__(other) | ||
elif self.__class__ != other.__class__: | ||
return False | ||
|
@@ -54,7 +51,7 @@ def __str__(self): | |
return relpath(path) | ||
|
||
def __repr__(self): | ||
return builtin_str("{}: '{}'").format(type(self).__name__, self) | ||
return str("{}: '{}'").format(type(self).__name__, self) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
|
||
# This permits passing it to file utils directly in Python 3.6+ | ||
# With Python 2.7, Python 3.5+ we are stuck with path_info.fspath for now | ||
|
@@ -71,7 +68,7 @@ def relpath(self, other): | |
return self.__class__(relpath(self, other)) | ||
|
||
def isin(self, other): | ||
if isinstance(other, basestring): | ||
if isinstance(other, (str, bytes)): | ||
other = self.__class__(other) | ||
elif self.__class__ != other.__class__: | ||
return False | ||
|
@@ -135,13 +132,13 @@ def from_parts( | |
|
||
def fill_parts(self, scheme, host, user, port, path): | ||
assert scheme != "remote" | ||
assert isinstance(path, (basestring, _URLPathInfo)) | ||
assert isinstance(path, (str, bytes, _URLPathInfo)) | ||
|
||
self.scheme, self.host, self.user = scheme, host, user | ||
self.port = int(port) if port else self.DEFAULT_PORTS.get(self.scheme) | ||
|
||
if isinstance(path, _URLPathInfo): | ||
self._spath = builtin_str(path) | ||
self._spath = str(path) | ||
self._path = path | ||
else: | ||
if path and path[0] != "/": | ||
|
@@ -170,7 +167,7 @@ def __repr__(self): | |
return "{}: '{}'".format(type(self).__name__, self) | ||
|
||
def __eq__(self, other): | ||
if isinstance(other, basestring): | ||
if isinstance(other, (str, bytes)): | ||
other = self.__class__(other) | ||
return ( | ||
self.__class__ == other.__class__ | ||
|
@@ -220,7 +217,7 @@ def parents(self): | |
return _URLPathParents(self) | ||
|
||
def relative_to(self, other): | ||
if isinstance(other, basestring): | ||
if isinstance(other, (str, bytes)): | ||
other = self.__class__(other) | ||
if self.__class__ != other.__class__: | ||
msg = "'{}' has incompatible class with '{}'".format(self, other) | ||
|
@@ -231,7 +228,7 @@ def relative_to(self, other): | |
return self._path.relative_to(other._path) | ||
|
||
def isin(self, other): | ||
if isinstance(other, basestring): | ||
if isinstance(other, (str, bytes)): | ||
other = self.__class__(other) | ||
elif self.__class__ != other.__class__: | ||
return False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this conversion though?