mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-14 19:08:08 +00:00
Address typing issues hidden by memoization.caching (#322)
This commit is contained in:
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -212,6 +212,9 @@ jobs:
|
||||
|
||||
# set a minimum confidence to ignore known false positives
|
||||
vulture --min-confidence 61 __app__
|
||||
|
||||
../ci/disable-py-cache.sh
|
||||
mypy __app__ ./tests
|
||||
afl:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
|
@ -41,7 +41,7 @@ def get_vm(name: str) -> Optional[VirtualMachine]:
|
||||
|
||||
def create_vm(
|
||||
name: str,
|
||||
location: str,
|
||||
location: Region,
|
||||
vm_sku: str,
|
||||
image: str,
|
||||
password: str,
|
||||
|
@ -47,6 +47,8 @@ class Task(BASE_TASK, ORMMixin):
|
||||
) -> Union["Task", Error]:
|
||||
if config.vm:
|
||||
os = get_os(config.vm.region, config.vm.image)
|
||||
if isinstance(os, Error):
|
||||
return os
|
||||
elif config.pool:
|
||||
pool = Pool.get_by_name(config.pool.pool_name)
|
||||
if isinstance(pool, Error):
|
||||
|
18
src/ci/disable-py-cache.sh
Executable file
18
src/ci/disable-py-cache.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
|
||||
# Temporary work-around to improve the efficacy of static analysis of functions
|
||||
# decorated with memoization.cached.
|
||||
#
|
||||
# For more information:
|
||||
# https://github.com/lonelyenvoy/python-memoization/issues/16
|
||||
|
||||
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)
|
17
src/ci/enable-py-cache.sh
Executable file
17
src/ci/enable-py-cache.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# Temporary work-around to improve the efficacy of static analysis of functions
|
||||
# decorated with memoization.cached.
|
||||
#
|
||||
# For more information:
|
||||
# https://github.com/lonelyenvoy/python-memoization/issues/16
|
||||
|
||||
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)
|
Reference in New Issue
Block a user