mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-12 20:30:57 +00:00
More type hints
This commit is contained in:
parent
11f7559ef3
commit
c93d7b8715
51 changed files with 1374 additions and 957 deletions
|
@ -21,18 +21,24 @@ Take a look at the class ``BaseWeb`` if you want to implement your own.
|
|||
|
||||
"""
|
||||
|
||||
from radicale import httputils, utils
|
||||
from typing import Sequence
|
||||
|
||||
INTERNAL_TYPES = ("none", "internal")
|
||||
from radicale import config, httputils, types, utils
|
||||
|
||||
INTERNAL_TYPES: Sequence[str] = ("none", "internal")
|
||||
|
||||
|
||||
def load(configuration):
|
||||
def load(configuration: "config.Configuration") -> "BaseWeb":
|
||||
"""Load the web module chosen in configuration."""
|
||||
return utils.load_plugin(INTERNAL_TYPES, "web", "Web", configuration)
|
||||
return utils.load_plugin(INTERNAL_TYPES, "web", "Web", BaseWeb,
|
||||
configuration)
|
||||
|
||||
|
||||
class BaseWeb:
|
||||
def __init__(self, configuration):
|
||||
|
||||
configuration: "config.Configuration"
|
||||
|
||||
def __init__(self, configuration: "config.Configuration") -> None:
|
||||
"""Initialize BaseWeb.
|
||||
|
||||
``configuration`` see ``radicale.config`` module.
|
||||
|
@ -42,7 +48,8 @@ class BaseWeb:
|
|||
"""
|
||||
self.configuration = configuration
|
||||
|
||||
def get(self, environ, base_prefix, path, user):
|
||||
def get(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
|
||||
user: str) -> types.WSGIResponse:
|
||||
"""GET request.
|
||||
|
||||
``base_prefix`` is sanitized and never ends with "/".
|
||||
|
@ -54,7 +61,8 @@ class BaseWeb:
|
|||
"""
|
||||
return httputils.METHOD_NOT_ALLOWED
|
||||
|
||||
def post(self, environ, base_prefix, path, user):
|
||||
def post(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
|
||||
user: str) -> types.WSGIResponse:
|
||||
"""POST request.
|
||||
|
||||
``base_prefix`` is sanitized and never ends with "/".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue