Skip to content

Commit a8711ca

Browse files
authored
Merge pull request #15 from syrusakbary/features/typed
Initial version of static typed promises
2 parents c0c7d17 + 74d8d19 commit a8711ca

File tree

7 files changed

+179
-102
lines changed

7 files changed

+179
-102
lines changed

.coveragerc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = promise/compat.py,promise/iterate_promise.py

.travis.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ install:
1616
fi
1717
- pip install -e .
1818
script:
19-
- flake8
2019
- py.test --cov=promise tests
2120
after_success:
2221
- coveralls
22+
matrix:
23+
fast_finish: true
24+
include:
25+
- python: '2.7'
26+
script: flake8
27+
- python: '3.5'
28+
script: |
29+
pip install mypy-lang
30+
mypy promise/ --check-untyped-defs

promise/compat.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
try:
2-
from asyncio import Future, iscoroutine, ensure_future
2+
from asyncio import Future, iscoroutine, ensure_future # type: ignore
33
except ImportError:
4-
class Future:
4+
class Future: # type: ignore
55
def __init__(self):
66
raise Exception("You need asyncio for using Futures")
77

8-
def ensure_future():
8+
def set_result(self):
9+
raise Exception("You need asyncio for using Futures")
10+
11+
def set_exception(self):
12+
raise Exception("You need asyncio for using Futures")
13+
14+
def ensure_future(): # type: ignore
915
raise Exception("ensure_future needs asyncio for executing")
1016

11-
def iscoroutine(obj):
17+
def iscoroutine(obj): # type: ignore
1218
return False
1319

1420
try:

0 commit comments

Comments
 (0)