Skip to content

Fix deprecated import collections #253

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
Sep 29, 2021
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
18 changes: 13 additions & 5 deletions rethinkdb/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@

import base64
import binascii
import collections
import datetime
import json
import sys
import threading

from rethinkdb import ql2_pb2
from rethinkdb.errors import QueryPrinter, ReqlDriverCompileError, ReqlDriverError, T
from rethinkdb.errors import (QueryPrinter, ReqlDriverCompileError,
ReqlDriverError, T)

if sys.version_info < (3, 3):
# python < 3.3 uses collections
import collections
else:
# but collections is deprecated from python >= 3.3
import collections.abc as collections

P_TERM = ql2_pb2.Term.TermType

Expand Down Expand Up @@ -74,7 +82,7 @@ def clear(cls):

def expr(val, nesting_depth=20):
"""
Convert a Python primitive into a RQL primitive value
Convert a Python primitive into a RQL primitive value
"""
if not isinstance(nesting_depth, int):
raise ReqlDriverCompileError("Second argument to `r.expr` must be a number.")
Expand Down Expand Up @@ -759,7 +767,7 @@ def recursively_make_hashable(obj):

class ReQLEncoder(json.JSONEncoder):
"""
Default JSONEncoder subclass to handle query conversion.
Default JSONEncoder subclass to handle query conversion.
"""

def __init__(self):
Expand All @@ -779,7 +787,7 @@ def default(self, obj):

class ReQLDecoder(json.JSONDecoder):
"""
Default JSONDecoder subclass to handle pseudo-type conversion.
Default JSONDecoder subclass to handle pseudo-type conversion.
"""

def __init__(self, reql_format_opts=None):
Expand Down