[mypy] Enforcing typing for charts (#9411)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2020-03-29 13:39:36 -07:00
committed by GitHub
parent 2e81e27272
commit ec795a4711
14 changed files with 41 additions and 29 deletions

View File

@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import List
from typing import Any, Dict, List
from flask_babel import lazy_gettext as _
from marshmallow import ValidationError
@@ -36,8 +36,8 @@ class CommandInvalidError(CommandException):
status = 422
def __init__(self, message=""):
self._invalid_exceptions = list()
def __init__(self, message="") -> None:
self._invalid_exceptions: List[ValidationError] = []
super().__init__(self.message)
def add(self, exception: ValidationError):
@@ -46,8 +46,8 @@ class CommandInvalidError(CommandException):
def add_list(self, exceptions: List[ValidationError]):
self._invalid_exceptions.extend(exceptions)
def normalized_messages(self):
errors = {}
def normalized_messages(self) -> Dict[Any, Any]:
errors: Dict[Any, Any] = {}
for exception in self._invalid_exceptions:
errors.update(exception.normalized_messages())
return errors