Install mypy and make the minimum changes necessary for it to pass, albeit using --ignore-missing-imports

This commit is contained in:
Danielle McLean 2018-05-29 09:37:28 +10:00
parent 142e3eff2b
commit c9f66eb91c
Signed by: 00dani
GPG key ID: 8EB789DDF3ABD240
6 changed files with 44 additions and 6 deletions

1
.gitignore vendored
View file

@ -15,6 +15,7 @@ media
# <django-project-name>/staticfiles/
# End of https://www.gitignore.io/api/django
/.mypy_cache
/.pytest_cache
/static
node_modules

View file

@ -54,3 +54,4 @@ ptpython = "*"
pytest-django = "*"
werkzeug = "*"
watchdog = "*"
mypy = "*"

33
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "dc9793063aa93db7b1b234778ef59289586a037dab65506c477f4e50ca5dc6df"
"sha256": "176c601737f4eb5da6b8689846e05d8df8b5b9ef25706fba98ffac6296e3d1d2"
},
"pipfile-spec": 6,
"requires": {
@ -813,6 +813,14 @@
],
"version": "==4.2.0"
},
"mypy": {
"hashes": [
"sha256:01cf289838f266ae7c6550c813181ee77d21eac9459dbf067e7a95a0a2db9721",
"sha256:bc251cb31bc236d9fe4bcc442c994c45fff2541f7161ee52dc949741fe9ca3dd"
],
"index": "pypi",
"version": "==0.600"
},
"parso": {
"hashes": [
"sha256:cdef26e8adc10d589f3ec4eb444bd0a29f3f1eb6d72a4292ab8afcb9d68976a6",
@ -907,6 +915,29 @@
],
"version": "==1.11.0"
},
"typed-ast": {
"hashes": [
"sha256:0948004fa228ae071054f5208840a1e88747a357ec1101c17217bfe99b299d58",
"sha256:25d8feefe27eb0303b73545416b13d108c6067b846b543738a25ff304824ed9a",
"sha256:29464a177d56e4e055b5f7b629935af7f49c196be47528cc94e0a7bf83fbc2b9",
"sha256:2e214b72168ea0275efd6c884b114ab42e316de3ffa125b267e732ed2abda892",
"sha256:3e0d5e48e3a23e9a4d1a9f698e32a542a4a288c871d33ed8df1b092a40f3a0f9",
"sha256:519425deca5c2b2bdac49f77b2c5625781abbaf9a809d727d3a5596b30bb4ded",
"sha256:57fe287f0cdd9ceaf69e7b71a2e94a24b5d268b35df251a88fef5cc241bf73aa",
"sha256:668d0cec391d9aed1c6a388b0d5b97cd22e6073eaa5fbaa6d2946603b4871efe",
"sha256:68ba70684990f59497680ff90d18e756a47bf4863c604098f10de9716b2c0bdd",
"sha256:6de012d2b166fe7a4cdf505eee3aaa12192f7ba365beeefaca4ec10e31241a85",
"sha256:79b91ebe5a28d349b6d0d323023350133e927b4de5b651a8aa2db69c761420c6",
"sha256:8550177fa5d4c1f09b5e5f524411c44633c80ec69b24e0e98906dd761941ca46",
"sha256:a8034021801bc0440f2e027c354b4eafd95891b573e12ff0418dec385c76785c",
"sha256:bc978ac17468fe868ee589c795d06777f75496b1ed576d308002c8a5756fb9ea",
"sha256:c05b41bc1deade9f90ddc5d988fe506208019ebba9f2578c622516fd201f5863",
"sha256:c9b060bd1e5a26ab6e8267fd46fc9e02b54eb15fffb16d112d4c7b1c12987559",
"sha256:edb04bdd45bfd76c8292c4d9654568efaedf76fe78eb246dde69bdb13b2dad87",
"sha256:f19f2a4f547505fe9072e15f6f4ae714af51b5a681a97f187971f50c283193b6"
],
"version": "==1.1.0"
},
"watchdog": {
"hashes": [
"sha256:7e65882adb7746039b6f3876ee174952f8eaaa34491ba34333ddf1fe35de4162"

View file

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from os import path
from typing import List
APPEND_SLASH = False
@ -30,7 +31,7 @@ SECRET_KEY = '6riil57g@r^wprf7mdy((+bs&(6l*phcn9&fd$l0@t-kzj+xww'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = [] # type: List[str]
INTERNAL_IPS = ['127.0.0.1', '::1']
# Settings to tighten up security - these can safely be on in dev mode too,

View file

@ -13,8 +13,11 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from typing import Tuple
from django.conf import settings
from django.urls import include, path
from django.urls.resolvers import URLPattern
from django.views.generic import RedirectView
from django.contrib import admin
@ -47,10 +50,10 @@ urlpatterns = (
path('sitemap.xml', sitemap.index, maps, name='sitemap'),
path('sitemaps/<section>.xml', sitemap.sitemap, maps,
name='django.contrib.sitemaps.views.sitemap'),
)
) # type: Tuple[URLPattern, ...]
if settings.DEBUG:
import debug_toolbar
urlpatterns = (
urlpatterns += (
path('__debug__/', include(debug_toolbar.urls)),
) + urlpatterns
)

View file

@ -1,9 +1,10 @@
from django.apps import apps
from django.conf import settings
from typing import Any, Dict, Type
from .convert import id_to_abc
prefixes = {}
prefixes = {} # type: Dict[Type[Any], str]
def short_url(entity):