File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 28
28
from builtins import range
29
29
30
30
import gevent
31
- import collections
32
31
33
32
import zerorpc
34
33
from .testutils import teardown , random_ipc_endpoint , TIME_FACTOR
35
34
35
+ try :
36
+ # Try collections.abc for 3.4+
37
+ from collections .abc import Iterator
38
+ except ImportError :
39
+ # Fallback to collections for Python 2
40
+ from collections import Iterator
41
+
36
42
37
43
def test_rcp_streaming ():
38
44
endpoint = random_ipc_endpoint ()
@@ -58,7 +64,7 @@ def xrange(self, max):
58
64
assert list (r ) == list (range (10 ))
59
65
60
66
r = client .xrange (10 )
61
- assert isinstance (r , collections . Iterator )
67
+ assert isinstance (r , Iterator )
62
68
l = []
63
69
print ('wait 4s for fun' )
64
70
gevent .sleep (TIME_FACTOR * 4 )
Original file line number Diff line number Diff line change 33
33
import inspect
34
34
import os
35
35
import logging
36
- import collections
37
36
from pprint import pprint
38
37
39
38
import zerorpc
40
39
40
+ try :
41
+ # Try collections.abc for 3.4+
42
+ from collections .abc import Iterator
43
+ except ImportError :
44
+ # Fallback to collections for Python 2
45
+ from collections import Iterator
46
+
41
47
42
48
parser = argparse .ArgumentParser (
43
49
description = 'Make a zerorpc call to a remote service.'
@@ -267,7 +273,7 @@ def run_client(args):
267
273
else :
268
274
call_args = args .params
269
275
results = client (args .command , * call_args )
270
- if not isinstance (results , collections . Iterator ):
276
+ if not isinstance (results , Iterator ):
271
277
if args .print_json :
272
278
json .dump (results , sys .stdout )
273
279
else :
You can’t perform that action at this time.
0 commit comments