From be1ac445bb998fcdaab2bc3cad2dbfca30cea1e8 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Thu, 31 Dec 2020 17:19:16 -0500 Subject: [PATCH 1/4] disable py-cache prior to mypy on cli --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acf4a90307..4ca2b67f42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,8 +104,9 @@ jobs: flake8 . black onefuzz examples tests --check isort --profile black ./onefuzz ./examples/ ./tests/ --check - mypy . --ignore-missing-imports pytest -v tests + ../ci/disable-py-cache.sh + mypy . --ignore-missing-imports # set a minimum confidence to ignore known false positives vulture --min-confidence 61 onefuzz From 42c17b15fd0e4894ebb2bfb3d6e3b9ff7aeb81c2 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Fri, 1 Jan 2021 15:30:23 -0500 Subject: [PATCH 2/4] modify nested @cache calls --- src/ci/disable-py-cache.sh | 2 +- src/ci/enable-py-cache.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ci/disable-py-cache.sh b/src/ci/disable-py-cache.sh index 9e2afc4dc3..6759b1b33a 100755 --- a/src/ci/disable-py-cache.sh +++ b/src/ci/disable-py-cache.sh @@ -15,4 +15,4 @@ set -ex SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) sed -i "s/^from memoization import cached/##### from memoization import cached/" $(find . -name '*.py' -not -path .python_packages) -sed -i "s/^@cached/##### @cached/" $(find . -name '*.py' -not -path .python_packages) +sed -i "s/@cached/##### @cached/" $(find . -name '*.py' -not -path .python_packages) diff --git a/src/ci/enable-py-cache.sh b/src/ci/enable-py-cache.sh index 403457302d..9d15fbee22 100755 --- a/src/ci/enable-py-cache.sh +++ b/src/ci/enable-py-cache.sh @@ -14,4 +14,4 @@ set -ex SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) sed -i "s/^##### from memoization import cached/from memoization import cached/" $(find . -name '*.py' -not -path .python_packages) -sed -i "s/^##### @cached/@cached/" $(find . -name '*.py' -not -path .python_packages) +sed -i "s/##### @cached/@cached/" $(find . -name '*.py' -not -path .python_packages) From cfa4ac70d06602b2674f6cea64f67d7289fd433a Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Fri, 1 Jan 2021 15:30:44 -0500 Subject: [PATCH 3/4] remove redundant cast --- src/cli/onefuzz/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/onefuzz/api.py b/src/cli/onefuzz/api.py index f632df659d..973378feaf 100644 --- a/src/cli/onefuzz/api.py +++ b/src/cli/onefuzz/api.py @@ -178,7 +178,7 @@ def get(self, container: str, filename: str) -> bytes: """ get a file from a container """ self.logger.debug("getting file from container: %s:%s", container, filename) client = self._get_client(container) - downloaded = cast(bytes, client.download_blob(filename)) + downloaded = client.download_blob(filename) return downloaded def upload_file( From a4ff6862281121ab8a23d279af2e0bf8b561e5d5 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Fri, 1 Jan 2021 15:53:07 -0500 Subject: [PATCH 4/4] remove unused import --- src/cli/onefuzz/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/onefuzz/api.py b/src/cli/onefuzz/api.py index 973378feaf..53495aa0e8 100644 --- a/src/cli/onefuzz/api.py +++ b/src/cli/onefuzz/api.py @@ -11,7 +11,7 @@ import uuid from enum import Enum from shutil import which -from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar, cast +from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar from uuid import UUID import pkg_resources