Skip to content
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

Add a six.moves for collections and collections.abc in preparation fo… #241

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions six.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def __get__(self, obj, tp):

class MovedModule(_LazyDescr):

def __init__(self, name, old, new=None):
def __init__(self, name, old, new=None, since=(3,)):
super(MovedModule, self).__init__(name)
if PY3:
if sys.version_info[0:len(since)] >= since:

Choose a reason for hiding this comment

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

The 0 can be left out.

Choose a reason for hiding this comment

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

As well as slicing at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can suggest changes via GH now :)

Suggested change
if sys.version_info[0:len(since)] >= since:
if sys.version_info >= since:

if new is None:
new = name
self.mod = new
Expand Down Expand Up @@ -300,6 +300,7 @@ class _MovedItems(_LazyModule):
MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
MovedModule("collections_abc", "collections", "collections.abc", (3, 3)),

Choose a reason for hiding this comment

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

I would use since as kwarg here to make it more readable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MovedModule("collections_abc", "collections", "collections.abc", (3, 3)),
MovedModule("collections_abc", "collections", "collections.abc", since=(3, 3)),

]
# Add windows specific modules.
if sys.platform == "win32":
Expand Down