Browse Source

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

tags/v1.9.9
Danielle McLean 1 year ago
parent
commit
c9f66eb91c
Signed by: Danielle McLean <dani@00dani.me> GPG Key ID: 8EB789DDF3ABD240
6 changed files with 44 additions and 6 deletions
  1. 1
    0
      .gitignore
  2. 1
    0
      Pipfile
  3. 32
    1
      Pipfile.lock
  4. 2
    1
      lemoncurry/settings/base.py
  5. 6
    3
      lemoncurry/urls.py
  6. 2
    1
      lemonshort/short_url.py

+ 1
- 0
.gitignore View File

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

+ 1
- 0
Pipfile View File

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

+ 32
- 1
Pipfile.lock View File

@@ -1,7 +1,7 @@
1 1
 {
2 2
     "_meta": {
3 3
         "hash": {
4
-            "sha256": "dc9793063aa93db7b1b234778ef59289586a037dab65506c477f4e50ca5dc6df"
4
+            "sha256": "176c601737f4eb5da6b8689846e05d8df8b5b9ef25706fba98ffac6296e3d1d2"
5 5
         },
6 6
         "pipfile-spec": 6,
7 7
         "requires": {
@@ -813,6 +813,14 @@
813 813
             ],
814 814
             "version": "==4.2.0"
815 815
         },
816
+        "mypy": {
817
+            "hashes": [
818
+                "sha256:01cf289838f266ae7c6550c813181ee77d21eac9459dbf067e7a95a0a2db9721",
819
+                "sha256:bc251cb31bc236d9fe4bcc442c994c45fff2541f7161ee52dc949741fe9ca3dd"
820
+            ],
821
+            "index": "pypi",
822
+            "version": "==0.600"
823
+        },
816 824
         "parso": {
817 825
             "hashes": [
818 826
                 "sha256:cdef26e8adc10d589f3ec4eb444bd0a29f3f1eb6d72a4292ab8afcb9d68976a6",
@@ -907,6 +915,29 @@
907 915
             ],
908 916
             "version": "==1.11.0"
909 917
         },
918
+        "typed-ast": {
919
+            "hashes": [
920
+                "sha256:0948004fa228ae071054f5208840a1e88747a357ec1101c17217bfe99b299d58",
921
+                "sha256:25d8feefe27eb0303b73545416b13d108c6067b846b543738a25ff304824ed9a",
922
+                "sha256:29464a177d56e4e055b5f7b629935af7f49c196be47528cc94e0a7bf83fbc2b9",
923
+                "sha256:2e214b72168ea0275efd6c884b114ab42e316de3ffa125b267e732ed2abda892",
924
+                "sha256:3e0d5e48e3a23e9a4d1a9f698e32a542a4a288c871d33ed8df1b092a40f3a0f9",
925
+                "sha256:519425deca5c2b2bdac49f77b2c5625781abbaf9a809d727d3a5596b30bb4ded",
926
+                "sha256:57fe287f0cdd9ceaf69e7b71a2e94a24b5d268b35df251a88fef5cc241bf73aa",
927
+                "sha256:668d0cec391d9aed1c6a388b0d5b97cd22e6073eaa5fbaa6d2946603b4871efe",
928
+                "sha256:68ba70684990f59497680ff90d18e756a47bf4863c604098f10de9716b2c0bdd",
929
+                "sha256:6de012d2b166fe7a4cdf505eee3aaa12192f7ba365beeefaca4ec10e31241a85",
930
+                "sha256:79b91ebe5a28d349b6d0d323023350133e927b4de5b651a8aa2db69c761420c6",
931
+                "sha256:8550177fa5d4c1f09b5e5f524411c44633c80ec69b24e0e98906dd761941ca46",
932
+                "sha256:a8034021801bc0440f2e027c354b4eafd95891b573e12ff0418dec385c76785c",
933
+                "sha256:bc978ac17468fe868ee589c795d06777f75496b1ed576d308002c8a5756fb9ea",
934
+                "sha256:c05b41bc1deade9f90ddc5d988fe506208019ebba9f2578c622516fd201f5863",
935
+                "sha256:c9b060bd1e5a26ab6e8267fd46fc9e02b54eb15fffb16d112d4c7b1c12987559",
936
+                "sha256:edb04bdd45bfd76c8292c4d9654568efaedf76fe78eb246dde69bdb13b2dad87",
937
+                "sha256:f19f2a4f547505fe9072e15f6f4ae714af51b5a681a97f187971f50c283193b6"
938
+            ],
939
+            "version": "==1.1.0"
940
+        },
910 941
         "watchdog": {
911 942
             "hashes": [
912 943
                 "sha256:7e65882adb7746039b6f3876ee174952f8eaaa34491ba34333ddf1fe35de4162"

+ 2
- 1
lemoncurry/settings/base.py View File

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

+ 6
- 3
lemoncurry/urls.py View File

@@ -13,8 +13,11 @@ Including another URLconf
13 13
     1. Import the include() function: from django.conf.urls import url, include
14 14
     2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
15 15
 """
16
+from typing import Tuple
17
+
16 18
 from django.conf import settings
17 19
 from django.urls import include, path
20
+from django.urls.resolvers import URLPattern
18 21
 from django.views.generic import RedirectView
19 22
 
20 23
 from django.contrib import admin
@@ -47,10 +50,10 @@ urlpatterns = (
47 50
     path('sitemap.xml', sitemap.index, maps, name='sitemap'),
48 51
     path('sitemaps/<section>.xml', sitemap.sitemap, maps,
49 52
          name='django.contrib.sitemaps.views.sitemap'),
50
-)
53
+)  # type: Tuple[URLPattern, ...]
51 54
 
52 55
 if settings.DEBUG:
53 56
     import debug_toolbar
54
-    urlpatterns = (
57
+    urlpatterns += (
55 58
         path('__debug__/', include(debug_toolbar.urls)),
56
-    ) + urlpatterns
59
+    )

+ 2
- 1
lemonshort/short_url.py View File

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

Loading…
Cancel
Save