Skip to content

Commit 32c1bba

Browse files
authored
Import Iterable from collections.abc for Py 3.9 compatibility (#58)
Import Iterable from collections.abc instead of collections for Python 3.9 compatibility, and add Python 3.9 to CI.
1 parent 0580da8 commit 32c1bba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python:
66
- 3.6
77
- 3.7
88
- 3.8
9+
- 3.9-dev
910
- pypy
1011
- pypy3
1112
cache: pip

gql/dsl.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import collections
21
import decimal
32
from functools import partial
43

@@ -10,6 +9,11 @@
109

1110
from .utils import to_camel_case
1211

12+
if six.PY3:
13+
from collections.abc import Iterable
14+
else:
15+
from collections import Iterable
16+
1317

1418
class DSLSchema(object):
1519
def __init__(self, client):
@@ -134,7 +138,7 @@ def query(*fields):
134138

135139

136140
def serialize_list(serializer, values):
137-
assert isinstance(values, collections.Iterable), 'Expected iterable, received "{}"'.format(repr(values))
141+
assert isinstance(values, Iterable), 'Expected iterable, received "{}"'.format(repr(values))
138142
return [serializer(v) for v in values]
139143

140144

0 commit comments

Comments
 (0)