From 419a95fba7b37df7be9a2118e6051aa0c8620371 Mon Sep 17 00:00:00 2001 From: jfriedli Date: Sun, 13 Jun 2021 10:58:02 +0000 Subject: Mypy missing types fix --- .gitlab-ci.yml | 4 ++-- matweb/utils.py | 3 ++- requirements-test.txt | 5 ++++- requirements.txt | 5 +---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e368853..0b1b455 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,8 +23,8 @@ mypy: - apt-get -qqy update - apt-get -qqy install --no-install-recommends python3-pip - pip3 install mypy - - pip3 install -r requirements.txt - - mypy --ignore-missing-imports main.py + - pip3 install -r requirements-test.txt + - mypy --ignore-missing-imports matweb main.py bandit: image: diff --git a/matweb/utils.py b/matweb/utils.py index f4cbca3..270c5f3 100644 --- a/matweb/utils.py +++ b/matweb/utils.py @@ -2,6 +2,7 @@ import hmac import os import hashlib import mimetypes as mtype +from typing import Tuple from flask_restful import abort, current_app from libmat2 import parser_factory @@ -97,7 +98,7 @@ def get_file_paths(filename, upload_folder): return complete_path, filepath -def is_valid_api_download_file(filename: str, key: str, secret: str, upload_folder: str) -> [str, str]: +def is_valid_api_download_file(filename: str, key: str, secret: str, upload_folder: str) -> Tuple[str, str]: if filename != secure_filename(filename): current_app.logger.error('Insecure filename %s', filename) abort(400, message='Insecure filename') diff --git a/requirements-test.txt b/requirements-test.txt index ca44124..70dd298 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1 +1,4 @@ -openapi-spec-validator==0.2.8 \ No newline at end of file +openapi-spec-validator==0.2.8 +types-Flask==1.1.0 +types-Jinja2==2.11.1 +types-PyYAML==0.1.7 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 98ef786..f7262a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,4 @@ Cerberus==1.3.4 Flask-Testing==0.8.1 blinker==1.4 iknl-flasgger==0.9.2.post1 -Flask-Assets==2.0 -types-Flask==1.1.0 -types-Jinja2==2.11.1 -types-PyYAML==0.1.7 \ No newline at end of file +Flask-Assets==2.0 \ No newline at end of file -- cgit v1.3