Skip to content

Commit 8341de6

Browse files
committed
Avoid deprecation warnings in is_iterable
1 parent 3d8d36a commit 8341de6

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/graphql/pyutils/is_iterable.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
from typing import (
2-
Any,
3-
ByteString,
4-
Collection,
5-
Iterable,
6-
Mapping,
7-
Text,
8-
ValuesView,
9-
)
1+
from collections.abc import Collection, Iterable, Mapping, ValuesView
2+
from typing import Any
103

114
__all__ = ["is_collection", "is_iterable"]
125

136
collection_types: Any = Collection
147
if not isinstance({}.values(), Collection): # Python < 3.7.2
158
collection_types = (Collection, ValuesView)
169
iterable_types: Any = Iterable
17-
not_iterable_types: Any = (ByteString, Mapping, Text)
10+
not_iterable_types: Any = (bytes, bytearray, memoryview, str, Mapping)
1811

1912

2013
def is_collection(value: Any) -> bool:

0 commit comments

Comments
 (0)