Skip to content

Commit

Permalink
Merge pull request #189 from kalaspuff/fix/awaitable-type-hint
Browse files Browse the repository at this point in the history
Fixes type hinting issues with Python 3.5.1
  • Loading branch information
kalaspuff authored Oct 2, 2017
2 parents 793eacf + b3b0949 commit c6a6e31
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
language: python
sudo: required
python:
- 3.5.1
- 3.5.2
- 3.5.3
- 3.5
- 3.5-dev
- 3.6.0
- 3.6.1
- 3.6.2
- 3.6
- 3.6-dev # 3.6 development branch
services:
Expand Down
4 changes: 2 additions & 2 deletions tomodachi/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import uuid
import os
from types import ModuleType, TracebackType
from typing import Dict, Optional, Any, Type
from typing import Dict, Optional, Any
from tomodachi import CLASS_ATTRIBUTE
from tomodachi.invoker import FUNCTION_ATTRIBUTE, START_ATTRIBUTE
from tomodachi.config import merge_dicts
Expand All @@ -26,7 +26,7 @@ def __init__(self, module_import: ModuleType, configuration: Optional[Dict]=None
self._close_waiter = asyncio.Future() # type: asyncio.Future
self.started_waiter = asyncio.Future() # type: asyncio.Future

def catch_uncaught_exceptions(type_: Type[BaseException], value: BaseException, traceback: TracebackType) -> None:
def catch_uncaught_exceptions(type_: type, value: BaseException, traceback: TracebackType) -> None:
raise value

sys.excepthook = catch_uncaught_exceptions
Expand Down
6 changes: 5 additions & 1 deletion tomodachi/transport/amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import binascii
import asyncio
import inspect
from typing import Any, Dict, Union, Optional, Callable, Awaitable, Match
from typing import Any, Dict, Union, Optional, Callable, Match
try:
from typing import Awaitable
except ImportError:
from collections.abc import Awaitable
from tomodachi.invoker import Invoker


Expand Down
6 changes: 5 additions & 1 deletion tomodachi/transport/aws_sns_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
import ujson
import uuid
import inspect
from typing import Any, Dict, Union, Optional, Callable, Awaitable, List, Tuple, Match
from typing import Any, Dict, Union, Optional, Callable, List, Tuple, Match
try:
from typing import Awaitable
except ImportError:
from collections.abc import Awaitable
from tomodachi.invoker import Invoker

DRAIN_MESSAGE_PAYLOAD = '__TOMODACHI_DRAIN__cdab4416-1727-4603-87c9-0ff8dddf1f22__'
Expand Down
6 changes: 5 additions & 1 deletion tomodachi/transport/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import pathlib
import inspect
from logging.handlers import WatchedFileHandler
from typing import Any, Dict, List, Tuple, Union, Optional, Callable, Awaitable, SupportsInt # noqa
from typing import Any, Dict, List, Tuple, Union, Optional, Callable, SupportsInt # noqa
try:
from typing import Awaitable
except ImportError:
from collections.abc import Awaitable
from multidict import CIMultiDict, CIMultiDictProxy
from aiohttp import web, web_server, web_protocol, web_urldispatcher, hdrs
from aiohttp.web_fileresponse import FileResponse
Expand Down
6 changes: 5 additions & 1 deletion tomodachi/transport/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import pytz
import tzlocal
import inspect
from typing import Any, Dict, List, Union, Optional, Callable, Awaitable, Tuple # noqa
from typing import Any, Dict, List, Union, Optional, Callable, Tuple # noqa
try:
from typing import Awaitable
except ImportError:
from collections.abc import Awaitable
from tomodachi.invoker import Invoker
from tomodachi.helpers.crontab import get_next_datetime

Expand Down

0 comments on commit c6a6e31

Please sign in to comment.