Skip to content

Import ABC from collections.abc for Python 3. #187

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
Apr 21, 2020
Merged
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
8 changes: 4 additions & 4 deletions rethinkdb/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import base64
import binascii
import collections
import collections.abc
import datetime
import json
import threading
Expand Down Expand Up @@ -74,7 +74,7 @@ def expr(val, nesting_depth=20):

if isinstance(val, RqlQuery):
return val
elif isinstance(val, collections.Callable):
elif isinstance(val, collections.abc.Callable):
return Func(val)
elif isinstance(val, (datetime.datetime, datetime.date)):
if not hasattr(val, "tzinfo") or not val.tzinfo:
Expand All @@ -95,14 +95,14 @@ def expr(val, nesting_depth=20):
return Datum(val)
elif isinstance(val, bytes):
return Binary(val)
elif isinstance(val, collections.Mapping):
elif isinstance(val, collections.abc.Mapping):
# MakeObj doesn't take the dict as a keyword args to avoid
# conflicting with the `self` parameter.
obj = {}
for k, v in dict_items(val):
obj[k] = expr(v, nesting_depth - 1)
return MakeObj(obj)
elif isinstance(val, collections.Iterable):
elif isinstance(val, collections.abc.Iterable):
val = [expr(v, nesting_depth - 1) for v in val]
return MakeArray(*val)
else:
Expand Down