Skip to content

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

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

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 5 additions & 4 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 >= since:
if new is None:
new = name
self.mod = new
Expand Down Expand Up @@ -138,9 +138,9 @@ def __dir__(self):

class MovedAttribute(_LazyDescr):

def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None, since=(3,)):
super(MovedAttribute, self).__init__(name)
if PY3:
if sys.version_info >= since:
if new_mod is None:
new_mod = name
self.mod = new_mod
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", since=(3, 3)),
]
# Add windows specific modules.
if sys.platform == "win32":
Expand Down