mirror of https://github.com/zulip/zulip.git
mypy: Change Generator[None, None, None] to Iterator[None].
Fixes #1648.
This commit is contained in:
parent
b162969841
commit
443cf92640
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue