diff --git a/tools/lint-all b/tools/lint-all index b75bd95e65..b4dab921a1 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -12,7 +12,7 @@ import traceback try: import lister - from typing import cast, Any, Callable, Dict, List, Optional, Generator, Tuple + from typing import cast, Any, Callable, Dict, Iterator, List, Optional, Tuple except ImportError as e: print("ImportError: {}".format(e)) print("You need to run the Zulip linters inside a Zulip dev environment.") @@ -38,7 +38,7 @@ zproject/test_settings.py @contextmanager def bright_red_output(): - # type: () -> Generator[None, None, None] + # type: () -> Iterator[None] # Make the lint output bright red sys.stdout.write('\x1B[1;31m') sys.stdout.flush() diff --git a/zerver/lib/context_managers.py b/zerver/lib/context_managers.py index a31d174dbb..a20b7a1acc 100644 --- a/zerver/lib/context_managers.py +++ b/zerver/lib/context_managers.py @@ -6,11 +6,11 @@ from __future__ import absolute_import import fcntl from contextlib import contextmanager -from typing import Generator +from typing import Iterator @contextmanager def flock(lockfile, shared=False): - # type: (int, bool) -> Generator[None, None, None] + # type: (int, bool) -> Iterator[None] """Lock a file object using flock(2) for the duration of a 'with' statement. If shared is True, use a LOCK_SH lock, otherwise LOCK_EX.""" @@ -23,7 +23,7 @@ def flock(lockfile, shared=False): @contextmanager def lockfile(filename, shared=False): - # type: (str, bool) -> Generator[None, None, None] + # type: (str, bool) -> Iterator[None] """Lock a file using flock(2) for the duration of a 'with' statement. If shared is True, use a LOCK_SH lock, otherwise LOCK_EX. diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py index 64afd8f77d..d435ff0bec 100644 --- a/zerver/lib/test_classes.py +++ b/zerver/lib/test_classes.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from __future__ import print_function from contextlib import contextmanager -from typing import (cast, Any, Callable, Dict, Generator, Iterable, List, Mapping, Optional, +from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Sized, Tuple, Union) from django.core.urlresolvers import resolve @@ -406,7 +406,7 @@ class ZulipTestCase(TestCase): @contextmanager def simulated_markdown_failure(self): - # type: () -> Generator[None, None, None] + # type: () -> Iterator[None] ''' This raises a failure inside of the try/except block of bugdown.__init__.do_convert. diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py index bd479bfe2d..c2bae7b0ba 100644 --- a/zerver/lib/test_helpers.py +++ b/zerver/lib/test_helpers.py @@ -1,8 +1,8 @@ from __future__ import absolute_import from __future__ import print_function from contextlib import contextmanager -from typing import (cast, Any, Callable, Dict, Generator, Iterable, List, Mapping, Optional, - Sized, Tuple, Union) +from typing import (cast, Any, Callable, Dict, Generator, Iterable, Iterator, List, Mapping, + Optional, Sized, Tuple, Union) from django.core.urlresolvers import LocaleRegexURLResolver from django.conf import settings @@ -62,7 +62,7 @@ import six @contextmanager def simulated_queue_client(client): - # type: (type) -> Generator[None, None, None] + # type: (type) -> Iterator[None] real_SimpleQueueClient = queue_processors.SimpleQueueClient queue_processors.SimpleQueueClient = client # type: ignore # https://github.com/JukkaL/mypy/issues/1152 yield @@ -70,7 +70,7 @@ def simulated_queue_client(client): @contextmanager def tornado_redirected_to_list(lst): - # type: (List[Mapping[str, Any]]) -> Generator[None, None, None] + # type: (List[Mapping[str, Any]]) -> Iterator[None] real_event_queue_process_notification = event_queue.process_notification event_queue.process_notification = lst.append yield