aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-02-15 20:59:03 -0800
committerBryan Newbold <bnewbold@robocracy.org>2022-02-15 20:59:03 -0800
commitf9b69d0b4343403ecf9318dc6d66725f6144edad (patch)
tree0fe8a3ef272e6540de774b8d9d5138f143d83136 /python/fatcat_web
parentae97f4d8d4446d32b07efba587b57b741a16cfec (diff)
downloadfatcat-f9b69d0b4343403ecf9318dc6d66725f6144edad.tar.gz
fatcat-f9b69d0b4343403ecf9318dc6d66725f6144edad.zip
hack around mypy complaints
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/routes.py6
-rw-r--r--python/fatcat_web/search.py7
2 files changed, 8 insertions, 5 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index f229a572..1f6602d4 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -364,7 +364,7 @@ def container_view_browse(ident: str) -> AnyResponse:
query_sort: Optional[List[str]]
if request.args.get("year") and "volume" in request.args and "issue" in request.args:
# year, volume, issue specified; browse-by-page
- year = int(request.args.get("year"))
+ year = int(request.args["year"])
volume = request.args.get("volume", "")
issue = request.args.get("issue", "")
if volume:
@@ -379,7 +379,7 @@ def container_view_browse(ident: str) -> AnyResponse:
query_sort = ["first_page", "pages", "release_date"]
elif request.args.get("year") and "volume" in request.args:
# year, volume specified (no issue); browse-by-page
- year = int(request.args.get("year"))
+ year = int(request.args["year"])
volume = request.args.get("volume", "")
if volume:
volume = f'volume:"{volume}"'
@@ -389,7 +389,7 @@ def container_view_browse(ident: str) -> AnyResponse:
query_sort = ["issue", "first_page", "pages", "release_date"]
elif request.args.get("year"):
# year specified, not anything else; browse-by-date
- year = int(request.args.get("year"))
+ year = int(request.args["year"])
query_string = f"year:{year}"
query_sort = ["release_date"]
elif request.args.get("volume"):
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index b48302b0..913d6696 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -247,7 +247,7 @@ def get_elastic_container_random_releases(ident: str, limit: int = 5) -> List[Di
return results
-def _sort_vol_key(val: Optional[str]) -> Tuple[bool, bool, int, str]:
+def _sort_vol_key(val: Optional[Any]) -> Tuple[bool, bool, int, str]:
"""
Helper for sorting volume and issue strings. Defined order is:
@@ -255,7 +255,10 @@ def _sort_vol_key(val: Optional[str]) -> Tuple[bool, bool, int, str]:
- any non-integers next, in non-integer order
- any integers next, in integer sorted order (ascending)
- Note that the actual sort used/displayed is reversed
+ Note that the actual sort used/displayed is reversed.
+
+ TODO: 'val' should actually be Optional[str], but getting a mypy error I
+ don't know how to hack around quickly right now.
"""
if val is None:
return (False, False, 0, "")