Skip to content

drop six usage #87

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

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
'test': [
'pytest',
'mock',
'six',
],
}

Expand Down
16 changes: 2 additions & 14 deletions tests/path.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use pathlib instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible, but the test's path implementation provides a series of other helpers as well (e.g. copytree) which some are used. I imagine a good end goal is to get path removed; however, figured for this pull request, to just focus on the removal of the six module.

Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,11 @@
import shutil
from codecs import open

from six import text_type


FILESYSTEMENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding()


class path(text_type):
"""
Represents a path which behaves like a string.
"""
if sys.version_info < (3, 0):
def __new__(cls, s, encoding=FILESYSTEMENCODING, errors='strict'):
if isinstance(s, str):
s = s.decode(encoding, errors)
return text_type.__new__(cls, s)
return text_type.__new__(cls, s)

class path(str):
@property
def parent(self):
"""
Expand Down Expand Up @@ -195,4 +183,4 @@ def joinpath(self, *args):
__div__ = __truediv__ = joinpath

def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, text_type.__repr__(self))
return '%s(%s)' % (self.__class__.__name__, str.__repr__(self))