Skip to content

Commit ac8a1f8

Browse files
committed
Fix fail on Python 3.7
1 parent f8fe699 commit ac8a1f8

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

.travis.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
sudo: required
2-
language: generic
2+
language: python
3+
python:
4+
- "3.6"
35
services:
46
- docker
57
env:
@@ -9,10 +11,14 @@ env:
911
script:
1012
- ./ci/run_tests_in_docker.sh $PYTHON_IMAGE
1113

12-
deploy:
13-
provider: pypi
14-
user: "$TWINE_USER"
15-
password: "$TWINE_PASSWORD"
16-
distributions: "sdist bdist_wheel"
17-
on:
18-
tags: true
14+
jobs:
15+
include:
16+
- stage: deploy
17+
skript: skip
18+
deploy:
19+
provider: pypi
20+
user: "$TWINE_USER"
21+
password: "$TWINE_PASSWORD"
22+
distributions: "sdist bdist_wheel"
23+
on:
24+
tags: true

src/purerpc/rpc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import enum
22
import typing
3+
import collections
34

45

56
Stream = typing.AsyncIterator
@@ -43,14 +44,16 @@ def response_type(self):
4344

4445
@staticmethod
4546
def from_annotations(request_annotation, response_annotation):
46-
if issubclass(request_annotation, Stream):
47+
if (hasattr(request_annotation, "__origin__") and
48+
issubclass(request_annotation.__origin__, collections.abc.AsyncIterator)):
4749
request_type = request_annotation.__args__[0]
4850
request_stream = True
4951
else:
5052
request_type = request_annotation
5153
request_stream = False
5254

53-
if issubclass(response_annotation, Stream):
55+
if (hasattr(response_annotation, "__origin__") and
56+
issubclass(response_annotation.__origin__, collections.abc.AsyncIterator)):
5457
response_type = response_annotation.__args__[0]
5558
response_stream = True
5659
else:

0 commit comments

Comments
 (0)