mirror of https://github.com/zulip/zulip.git
mypy: Fix inconsistencies in use of *args/**kwargs.
This commit is contained in:
parent
473c0ee1fe
commit
32bfebeb7a
|
@ -114,7 +114,7 @@ def get_config(ui, item):
|
|||
return None
|
||||
|
||||
def hook(ui, repo, **kwargs):
|
||||
# type: (ui, repo, Optional[Text]) -> None
|
||||
# type: (ui, repo, **Text) -> None
|
||||
"""
|
||||
Invoked by configuring a [hook] entry in .hg/hgrc.
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,7 @@ import time
|
|||
from psycopg2.extensions import cursor, connection
|
||||
|
||||
from typing import Callable, Optional, Iterable, Any, Dict, Union, TypeVar, \
|
||||
Mapping, Sequence, Text
|
||||
Mapping, Text
|
||||
from zerver.lib.str_utils import NonBinaryStr
|
||||
|
||||
CursorObj = TypeVar('CursorObj', bound=cursor)
|
||||
|
@ -39,7 +39,7 @@ class TimeTrackingConnection(connection):
|
|||
"""A psycopg2 connection class that uses TimeTrackingCursors."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
# type: (Sequence[Any], Mapping[Text, Any]) -> None
|
||||
# type: (*Any, **Any) -> None
|
||||
self.queries = [] # type: List[Dict[str, str]]
|
||||
super(TimeTrackingConnection, self).__init__(*args, **kwargs)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class Command(BaseCommand):
|
|||
help='Remove all users in this realm from this stream.')
|
||||
|
||||
def handle(self, **options):
|
||||
# type: (*Any, **Any) -> None
|
||||
# type: (**Any) -> None
|
||||
if options["string_id"] is None or options["stream"] is None or \
|
||||
(options["users"] is None and options["all_users"] is None):
|
||||
self.print_help("./manage.py", "remove_users_from_stream")
|
||||
|
|
|
@ -37,7 +37,7 @@ Example:
|
|||
'to post the fixture to')
|
||||
|
||||
def handle(self, **options):
|
||||
# type: (*Any, **str) -> None
|
||||
# type: (**str) -> None
|
||||
if options['fixture'] is None or options['url'] is None:
|
||||
self.print_help('./manage.py', 'send_webhook_fixture_message')
|
||||
exit(1)
|
||||
|
|
|
@ -48,7 +48,7 @@ For example:
|
|||
help='A comma-separated list of stream names.')
|
||||
|
||||
def handle(self, **options):
|
||||
# type: (*Any, **str) -> None
|
||||
# type: (**str) -> None
|
||||
if options["string_id"] is None or options["streams"] is None:
|
||||
print("Please provide both a subdomain name or string_id and a default \
|
||||
set of streams (which can be empty, with `--streams=`).", file=sys.stderr)
|
||||
|
|
|
@ -241,7 +241,7 @@ class LogRequests(object):
|
|||
connection.connection.queries = []
|
||||
|
||||
def process_view(self, request, view_func, args, kwargs):
|
||||
# type: (HttpRequest, Callable[..., HttpResponse], *str, **Any) -> None
|
||||
# type: (HttpRequest, Callable[..., HttpResponse], List[str], Dict[str, Any]) -> None
|
||||
# process_request was already run; we save the initialization
|
||||
# time (i.e. the time between receiving the request and
|
||||
# figuring out which view function to call, which is primarily
|
||||
|
@ -299,7 +299,7 @@ class JsonErrorHandler(object):
|
|||
|
||||
class TagRequests(object):
|
||||
def process_view(self, request, view_func, args, kwargs):
|
||||
# type: (HttpRequest, Callable[..., HttpResponse], *str, **Any) -> None
|
||||
# type: (HttpRequest, Callable[..., HttpResponse], List[str], Dict[str, Any]) -> None
|
||||
self.process_request(request)
|
||||
|
||||
def process_request(self, request):
|
||||
|
|
|
@ -292,7 +292,7 @@ class RateLimitTestCase(TestCase):
|
|||
req = Request()
|
||||
|
||||
def f(req):
|
||||
# type: () -> str
|
||||
# type: (Any) -> str
|
||||
return 'some value'
|
||||
|
||||
f = rate_limit()(f)
|
||||
|
@ -316,7 +316,7 @@ class RateLimitTestCase(TestCase):
|
|||
req = Request()
|
||||
|
||||
def f(req):
|
||||
# type: () -> str
|
||||
# type: (Any) -> str
|
||||
return 'some value'
|
||||
|
||||
f = rate_limit()(f)
|
||||
|
@ -342,7 +342,7 @@ class RateLimitTestCase(TestCase):
|
|||
req = Request()
|
||||
|
||||
def f(req):
|
||||
# type: () -> str
|
||||
# type: (Any) -> str
|
||||
return 'some value'
|
||||
|
||||
f = rate_limit()(f)
|
||||
|
@ -367,7 +367,7 @@ class RateLimitTestCase(TestCase):
|
|||
req = Request()
|
||||
|
||||
def f(req):
|
||||
# type: () -> str
|
||||
# type: (Any) -> str
|
||||
return 'some value'
|
||||
|
||||
f = rate_limit()(f)
|
||||
|
|
|
@ -261,7 +261,7 @@ class ExportTest(TestCase):
|
|||
return values
|
||||
|
||||
def find_by_id(table, db_id):
|
||||
# type: (str) -> Dict[str, Any]
|
||||
# type: (str, int) -> Dict[str, Any]
|
||||
return [
|
||||
r for r in data[table]
|
||||
if r['id'] == db_id][0]
|
||||
|
|
|
@ -37,7 +37,7 @@ class MockRedis(object):
|
|||
del self.data[key]
|
||||
|
||||
def expire(self, *args, **kwargs):
|
||||
# type: (Any, Any) -> None
|
||||
# type: (*Any, **Any) -> None
|
||||
pass
|
||||
|
||||
class PushNotificationTest(TestCase):
|
||||
|
@ -75,7 +75,7 @@ class APNsMessageTest(PushNotificationTest):
|
|||
|
||||
class ResponseListenerTest(PushNotificationTest):
|
||||
def get_error_response(self, **kwargs):
|
||||
# type: (Any) -> Dict[str, SupportsInt]
|
||||
# type: (**Any) -> Dict[str, SupportsInt]
|
||||
er = {'identifier': 0, 'status': 0} # type: Dict[str, SupportsInt]
|
||||
er.update({k: v for k, v in kwargs.items() if k in er})
|
||||
return er
|
||||
|
|
|
@ -38,7 +38,7 @@ def add_api_uri_context(context, request):
|
|||
|
||||
class ApiURLView(TemplateView):
|
||||
def get_context_data(self, **kwargs):
|
||||
# type: (Optional[Dict[str, Any]]) -> Dict[str, str]
|
||||
# type: (**Any) -> Dict[str, str]
|
||||
context = super(ApiURLView, self).get_context_data(**kwargs)
|
||||
add_api_uri_context(context, self.request)
|
||||
return context
|
||||
|
@ -52,7 +52,7 @@ class HelpView(ApiURLView):
|
|||
path_template = os.path.join(settings.DEPLOY_ROOT, 'templates/zerver/help/%s.md')
|
||||
|
||||
def get_path(self, article):
|
||||
# type: (**Any) -> str
|
||||
# type: (str) -> str
|
||||
if article == "":
|
||||
article = "index"
|
||||
return self.path_template % (article,)
|
||||
|
@ -84,7 +84,7 @@ class IntegrationView(ApiURLView):
|
|||
template_name = 'zerver/integrations.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# type: (Optional[Dict[str, Any]]) -> Dict[str, Any]
|
||||
# type: (**Any) -> Dict[str, Any]
|
||||
context = super(IntegrationView, self).get_context_data(**kwargs) # type: Dict[str, Any]
|
||||
alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items()))
|
||||
alphabetical_sorted_hubot_lozenges = OrderedDict(sorted(HUBOT_LOZENGES.items()))
|
||||
|
|
Loading…
Reference in New Issue