aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-03 23:58:38 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-03 23:58:38 -0700
commit649913ba9fbab8e9b7b428dec6526797c5b1c532 (patch)
treef89c3807a2b2125512626dcb766bd84c8ba07106
parent4c90b94c24e9e78382d12947fb27c203318d6c9c (diff)
downloadfatcat-scholar-649913ba9fbab8e9b7b428dec6526797c5b1c532.tar.gz
fatcat-scholar-649913ba9fbab8e9b7b428dec6526797c5b1c532.zip
start some annotaition fixes for pytype
-rw-r--r--fatcat_scholar/schema.py4
-rw-r--r--fatcat_scholar/search.py9
-rw-r--r--fatcat_scholar/web.py4
-rw-r--r--pytype.cfg4
-rw-r--r--tests/test_scrub.py2
5 files changed, 16 insertions, 7 deletions
diff --git a/fatcat_scholar/schema.py b/fatcat_scholar/schema.py
index 616857e..187fe58 100644
--- a/fatcat_scholar/schema.py
+++ b/fatcat_scholar/schema.py
@@ -10,8 +10,10 @@ from enum import Enum
from typing import Optional, List, Any
import ftfy
-from pydantic import BaseModel
from bs4 import BeautifulSoup
+# pytype: disable=import-error
+from pydantic import BaseModel
+# pytype: enable=import-error
from fatcat_openapi_client import ReleaseEntity, ReleaseContrib
from fatcat_scholar.api_entities import entity_to_dict
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 6402e2b..a529f6a 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -3,13 +3,16 @@ Helpers to make elasticsearch queries.
"""
import sys
-from gettext import gettext
import datetime
+from gettext import gettext
+from typing import List, Optional, Any
+
import elasticsearch
-from pydantic import BaseModel
from dynaconf import settings
from elasticsearch_dsl import Search, Q
-from typing import List, Optional, Any
+# pytype: disable=import-error
+from pydantic import BaseModel
+# pytype: enable=import-error
# i18n note: the use of gettext below doesn't actually do the translation here,
# it just ensures that the strings are caught by babel for translation later
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py
index 4e912d4..8b55f75 100644
--- a/fatcat_scholar/web.py
+++ b/fatcat_scholar/web.py
@@ -70,14 +70,14 @@ async def search(query: FulltextQuery = Depends(FulltextQuery)) -> Any:
web = APIRouter()
-def locale_gettext(translations: List[Any]) -> Any:
+def locale_gettext(translations: Any) -> Any:
def gt(s):
return translations.ugettext(s)
return gt
-def locale_ngettext(translations: List[Any]) -> Any:
+def locale_ngettext(translations: Any) -> Any:
def ngt(s, n):
return translations.ungettext(s)
diff --git a/pytype.cfg b/pytype.cfg
new file mode 100644
index 0000000..d4916dc
--- /dev/null
+++ b/pytype.cfg
@@ -0,0 +1,4 @@
+[pytype]
+inputs = fatcat_scholar
+pythonpath = .
+
diff --git a/tests/test_scrub.py b/tests/test_scrub.py
index 2cd68cc..fc6ef22 100644
--- a/tests/test_scrub.py
+++ b/tests/test_scrub.py
@@ -1,4 +1,4 @@
-from fatcat_scholar.schema import *
+from fatcat_scholar.schema import scrub_text
def test_scrub() -> None: