diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c53c667f3ef9dbe496f67a7fb15b77151b2e99cd..064060d1b93cc812f0058c4a1ab1f18375aef0d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ Documentation: Mypy: script: - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-mypy.sh - - ". ./prepare-and-run-mypy.sh python3.6 mypy==0.521 typed-ast==1.0.4" + - ". ./prepare-and-run-mypy.sh python3.6 mypy==0.560" tags: - python3.6 except: diff --git a/course/auth.py b/course/auth.py index 6cfed74bfab4e4db820b0e96d7a9b881446f8011..65212907ed487e50c09587c7d8c579618e34fea2 100644 --- a/course/auth.py +++ b/course/auth.py @@ -68,7 +68,7 @@ from relate.utils import StyledForm, StyledModelForm, string_concat, get_site_na from django_select2.forms import ModelSelect2Widget if False: - from typing import Any, Text # noqa + from typing import Any, Text, Optional # noqa from django.db.models import query # noqa @@ -1178,6 +1178,7 @@ class APIContext(object): self.restrict_to_role = restrict_to_role def has_permission(self, perm, argument=None): + # type: (Text, Optional[Text]) -> bool if self.restrict_to_role is None: return self.participation.has_permission(perm, argument) else: diff --git a/course/page/text.py b/course/page/text.py index dc5a5fb27f14bcb8c897e2d1d1a7c9b707de2c81..61fce9365e74d2a49d3c3a6b5106cc52ae76ce52 100644 --- a/course/page/text.py +++ b/course/page/text.py @@ -38,6 +38,8 @@ from course.page.base import ( get_editor_interaction_mode) +from typing import cast + import re import sys @@ -308,7 +310,7 @@ class RegexMatcher(TextAnswerMatcher): class CaseSensitiveRegexMatcher(RegexMatcher): type = "case_sens_regex" - re_flags = 0 + re_flags = cast(re.RegexFlag, 0) is_case_sensitive = True pattern_type = "string" diff --git a/run-travis-ci.sh b/run-travis-ci.sh index f54ca49e611b00e34b1d1962cc99a8fade46e87e..9ae669a0321782448eeb6ebce6d58c6c0c181bf6 100644 --- a/run-travis-ci.sh +++ b/run-travis-ci.sh @@ -13,7 +13,7 @@ fi if [[ $PY == true ]]; then . ./run-tests-for-ci.sh elif [[ $Mypy == true ]]; then - . ./prepare-and-run-mypy.sh python3.6 mypy==0.521 typed-ast==1.0.4 + . ./prepare-and-run-mypy.sh python3.6 mypy==0.560 elif [[ $Flake8 == true ]]; then . ./prepare-and-run-flake8.sh relate course accounts tests bin -fi \ No newline at end of file +fi