Files
zulip/zerver/lib/request.pyi
Hemanth V. Alluri 2738b09044 openapi: Remove a few "buggy" endpoints in the validation test.
By importing a few view modules in the validation test itself we
can remove a few endpoints which were marked as buggy. What was
happening was that the view functions weren't imported and hence
the arguments map was not filled. Thus the test complained that
there was documentation for request parameters that seemed to be
missing in the code. Also, for the events register endpoint, we
have renamed one of the documented request parameters from
"stream" to "topic" (the API itself was not modified though).

We add a new "documentation_pending" attribute to req variables
so that any arguments not currently documented but should be
documented can be properly accounted for.
2019-07-08 12:34:31 -07:00

36 lines
1.5 KiB
Python

# This mypy stubs file ensures that mypy can correctly analyze REQ.
#
# Note that here REQ is claimed to be a function, with a return type to match
# that of the parameter of which it is the default value, allowing type
# checking. However, in request.py, REQ is a class to enable the decorator to
# scan the parameter list for REQ objects and patch the parameters as the true
# types.
from typing import Any, Dict, Callable, List, TypeVar, Optional, Union, Type
from zerver.lib.types import ViewFuncT, Validator, ExtractRecipients
from zerver.lib.exceptions import JsonableError as JsonableError
ResultT = TypeVar('ResultT')
class RequestConfusingParmsError(JsonableError): ...
class RequestVariableMissingError(JsonableError): ...
class RequestVariableConversionError(JsonableError): ...
class _NotSpecified: ...
NotSpecified = _NotSpecified()
def REQ(whence: Optional[str] = None,
*,
type: Type[ResultT] = Type[None],
converter: Union[Optional[Callable[[str], ResultT]], ExtractRecipients] = None,
default: Union[_NotSpecified, ResultT, None] = Optional[NotSpecified],
validator: Optional[Validator] = None,
str_validator: Optional[Validator] = None,
argument_type: Optional[str] = None,
intentionally_undocumented: bool=False,
documentation_pending: bool=False,
aliases: Optional[List[str]] = None) -> ResultT: ...
def has_request_variables(view_func: ViewFuncT) -> ViewFuncT: ...
arguments_map = ... # type: Dict[str, List[str]]