diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-06-03 23:30:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-06-03 23:30:46 -0700 |
commit | 4c90b94c24e9e78382d12947fb27c203318d6c9c (patch) | |
tree | 56756e5ff572201369634a5cd90c7e529e032e13 /fatcat_scholar/web.py | |
parent | ba7295cdf09c6b2bf288db85e15aa44b6782da06 (diff) | |
download | fatcat-scholar-4c90b94c24e9e78382d12947fb27c203318d6c9c.tar.gz fatcat-scholar-4c90b94c24e9e78382d12947fb27c203318d6c9c.zip |
flake8-annotation linting
Added some new annotations; need to finish more.
Diffstat (limited to 'fatcat_scholar/web.py')
-rw-r--r-- | fatcat_scholar/web.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index 3f6982d..4e912d4 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -9,7 +9,7 @@ import babel.support from fastapi import FastAPI, APIRouter, Request, Depends from fastapi.staticfiles import StaticFiles from dynaconf import settings -from typing import Optional +from typing import Optional, List, Any from fatcat_scholar.hacks import Jinja2Templates from fatcat_scholar.search import do_fulltext_search, FulltextQuery, FulltextHits @@ -58,26 +58,26 @@ api = APIRouter() @api.get("/", operation_id="get_home") -async def home(): +async def home() -> Any: return {"endpoints": {"/": "this", "/search": "fulltext search"}} @api.get("/search", operation_id="get_search") -async def search(query: FulltextQuery = Depends(FulltextQuery)): +async def search(query: FulltextQuery = Depends(FulltextQuery)) -> Any: return {"message": "search results would go here, I guess"} web = APIRouter() -def locale_gettext(translations): +def locale_gettext(translations: List[Any]) -> Any: def gt(s): return translations.ugettext(s) return gt -def locale_ngettext(translations): +def locale_ngettext(translations: List[Any]) -> Any: def ngt(s, n): return translations.ungettext(s) @@ -144,7 +144,7 @@ async def web_about(request: Request, lang: LangPrefix = Depends(LangPrefix)): @web.get("/help", include_in_schema=False) -async def web_help(request: Request, lang: LangPrefix = Depends(LangPrefix)): +async def web_help(request: Request, lang: LangPrefix = Depends(LangPrefix)) -> Any: return i18n_templates[lang.code].TemplateResponse( "help.html", {"request": request, "locale": lang.code, "lang_prefix": lang.prefix}, @@ -157,7 +157,7 @@ async def web_search( query: FulltextQuery = Depends(FulltextQuery), lang: LangPrefix = Depends(LangPrefix), content: ContentNegotiation = Depends(ContentNegotiation), -): +) -> Any: if content.mimetype == "application/json": return await search(query) |