diff options
author | Richard Burton <richard.burton@arm.com> | 2022-03-17 10:54:26 +0000 |
---|---|---|
committer | Richard <richard.burton@arm.com> | 2022-03-17 15:19:16 +0000 |
commit | 17069628a7f28198652a296ac16dc83529c7eaae (patch) | |
tree | adff78b64954e67dc4e29f6f039c63c8c18cde2c /scripts/py/check_update_resources_downloaded.py | |
parent | 624dafd2a206d88da979453442fe5a8d4c05ad51 (diff) | |
download | ml-embedded-evaluation-kit-17069628a7f28198652a296ac16dc83529c7eaae.tar.gz |
MLECO-3036: Update to use Pathlib in Python scripts
* Pathlib used in Python scripts over os
* Bug fix for build_default.py
* Minor code style updates
Signed-off-by: Richard Burton <richard.burton@arm.com>
Change-Id: I5fc2e582a84443c3fb79250eb711b960d63ed8fd
Diffstat (limited to 'scripts/py/check_update_resources_downloaded.py')
-rw-r--r-- | scripts/py/check_update_resources_downloaded.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/py/check_update_resources_downloaded.py b/scripts/py/check_update_resources_downloaded.py index 44e9bd9..021f1b1 100644 --- a/scripts/py/check_update_resources_downloaded.py +++ b/scripts/py/check_update_resources_downloaded.py @@ -13,11 +13,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import json -import os import sys import hashlib from argparse import ArgumentParser +from pathlib import Path def get_md5sum_for_file(filepath: str) -> str: @@ -51,11 +52,9 @@ def check_update_resources_downloaded( set_up_script_path (string): Specifies the path to set_up_default_resources.py file. """ - metadata_file_path = os.path.join( - resource_downloaded_dir, "resources_downloaded_metadata.json" - ) + metadata_file_path = Path(resource_downloaded_dir) / "resources_downloaded_metadata.json" - if os.path.isfile(metadata_file_path): + if metadata_file_path.is_file(): with open(metadata_file_path) as metadata_json: metadata_dict = json.load(metadata_json) @@ -95,8 +94,8 @@ if __name__ == "__main__": required=True) args = parser.parse_args() - # Check validity of script path - if not os.path.isfile(args.setup_script_path): + # Check validity of script path. + if not Path(args.setup_script_path).is_file(): raise ValueError(f'Invalid script path: {args.setup_script_path}') # Check the resources are downloaded as expected |