Files
zulip/zerver/lib/request.pyi
Greg Price ff5013c619 JsonableError: Add types, and eliminate duck-typing.
In order to benefit from the modern conveniences of type-checking,
add concrete, non-Any types to the interface for JsonableError.

Relatedly, there's no need at this point to duck-type things at
the places where we receive a JsonableError and try to use it.
Simplify those by using straightforward standard typing.
2017-07-24 16:41:22 -07:00

19 lines
641 B
Python

# This mypy stubs file ensures that mypy can correctly analyze REQ.
from typing import Any, Callable, Text, TypeVar
from django.http import HttpResponse
ViewFuncT = TypeVar('ViewFuncT', bound=Callable[..., HttpResponse])
class JsonableError(Exception):
error = ... # type: Text
status_code = ... # type: int
def __init__(self, error: Text) -> None: ...
def to_json_error_msg(self) -> Text: ...
class RequestVariableMissingError(JsonableError): ...
class RequestVariableConversionError(JsonableError): ...
def REQ(*args: Any, **kwargs: Any) -> Any: ...
def has_request_variables(view_func: ViewFuncT) -> ViewFuncT: ...