From 2bd5b870c13d2785a3ff7177647f307e9ff3e58a Mon Sep 17 00:00:00 2001 From: Benjamin Klimczak Date: Wed, 15 Nov 2023 12:58:02 +0000 Subject: Add linters/checkers for TOML files to pre-commits Change-Id: I8a228cbab405b4d4112e5e38856b3cb92304cba7 Signed-off-by: Benjamin Klimczak --- .pre-commit-config.yaml | 8 ++++++++ pyproject.toml | 21 +++++++++------------ src/mlia/resources/target_profiles/cortex-a.toml | 4 ++-- .../resources/target_profiles/ethos-u55-128.toml | 11 ++++------- .../resources/target_profiles/ethos-u55-256.toml | 11 ++++------- .../resources/target_profiles/ethos-u65-256.toml | 11 ++++------- .../resources/target_profiles/ethos-u65-512.toml | 11 ++++------- src/mlia/resources/target_profiles/tosa.toml | 2 +- 8 files changed, 36 insertions(+), 43 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57ef192..81e0acb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,8 @@ repos: hooks: - id: check-yaml + - id: check-toml + - id: end-of-file-fixer - id: trailing-whitespace @@ -93,6 +95,12 @@ repos: - id: bandit args: ["--skip", "B101"] +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.11.0 + hooks: + - id: pretty-format-toml + args: [--autofix, "--no-sort", --indent, "4"] + - repo: local hooks: - id: mypy diff --git a/pyproject.toml b/pyproject.toml index 52b7f41..827ae30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ # SPDX-FileCopyrightText: Copyright (c) 2015-2022 Dropbox, Inc. # SPDX-License-Identifier: Apache-2.0 AND MIT - [build-system] requires = [ "setuptools>=42", @@ -18,9 +17,9 @@ build-backend = "setuptools.build_meta" [tool.pytest.ini_options] testpaths = "tests" markers = [ - "e2e", # e2e tests - "install", # installation tests - "command", # command tests + "e2e", # e2e tests + "install", # installation tests + "command", # command tests "model_gen" # model generation tests ] junit_logging = "all" @@ -30,17 +29,15 @@ min-similarity-lines = 10 min-public-methods = 1 max-line-length = 88 max-args = 8 -max-attributes=10 - +max-attributes = 10 # Provide basic compatibility with black disable = [ - "wrong-import-order" + "wrong-import-order" ] - enable = [ - "dangerous-default-value", # W0102 - # black will reflow code lines, but won't touch comments, error on those - "line-too-long" # C0301 + "dangerous-default-value", # W0102 + # black will reflow code lines, but won't touch comments, error on those + "line-too-long" # C0301 ] [tool.pylint.similarities] @@ -73,6 +70,6 @@ check_untyped_defs = true [[tool.mypy.overrides]] module = [ "pkg_resources", - "requests", + "requests" ] ignore_missing_imports = true diff --git a/src/mlia/resources/target_profiles/cortex-a.toml b/src/mlia/resources/target_profiles/cortex-a.toml index 3781206..7b39a60 100644 --- a/src/mlia/resources/target_profiles/cortex-a.toml +++ b/src/mlia/resources/target_profiles/cortex-a.toml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="cortex-a" +target = "cortex-a" [backend.armnn-tflite-delegate] -version="23.05" +version = "23.05" diff --git a/src/mlia/resources/target_profiles/ethos-u55-128.toml b/src/mlia/resources/target_profiles/ethos-u55-128.toml index 71c6ec6..566e064 100644 --- a/src/mlia/resources/target_profiles/ethos-u55-128.toml +++ b/src/mlia/resources/target_profiles/ethos-u55-128.toml @@ -1,13 +1,10 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="ethos-u55" - +target = "ethos-u55" # Number of MACs [32, 64, 128, 256] -mac=128 - +mac = 128 # Memory mode: [SRAM Only, Shared SRAM, Dedicated SRAM] -memory_mode="Shared_Sram" - +memory_mode = "Shared_Sram" # System configuration -system_config="Ethos_U55_High_End_Embedded" +system_config = "Ethos_U55_High_End_Embedded" diff --git a/src/mlia/resources/target_profiles/ethos-u55-256.toml b/src/mlia/resources/target_profiles/ethos-u55-256.toml index f44cdfe..4f3b39b 100644 --- a/src/mlia/resources/target_profiles/ethos-u55-256.toml +++ b/src/mlia/resources/target_profiles/ethos-u55-256.toml @@ -1,13 +1,10 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="ethos-u55" - +target = "ethos-u55" # Number of MACs [32, 64, 128, 256] -mac=256 - +mac = 256 # Memory mode: [SRAM Only, Shared SRAM, Dedicated SRAM] -memory_mode="Shared_Sram" - +memory_mode = "Shared_Sram" # System configuration -system_config="Ethos_U55_High_End_Embedded" +system_config = "Ethos_U55_High_End_Embedded" diff --git a/src/mlia/resources/target_profiles/ethos-u65-256.toml b/src/mlia/resources/target_profiles/ethos-u65-256.toml index 078f60a..0a194af 100644 --- a/src/mlia/resources/target_profiles/ethos-u65-256.toml +++ b/src/mlia/resources/target_profiles/ethos-u65-256.toml @@ -1,13 +1,10 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="ethos-u65" - +target = "ethos-u65" # Number of MACs [256, 512] -mac=256 - +mac = 256 # Memory mode: [SRAM Only, Shared SRAM, Dedicated SRAM] -memory_mode="Dedicated_Sram" - +memory_mode = "Dedicated_Sram" # System configuration -system_config="Ethos_U65_High_End" +system_config = "Ethos_U65_High_End" diff --git a/src/mlia/resources/target_profiles/ethos-u65-512.toml b/src/mlia/resources/target_profiles/ethos-u65-512.toml index 6d32e63..1c6897f 100644 --- a/src/mlia/resources/target_profiles/ethos-u65-512.toml +++ b/src/mlia/resources/target_profiles/ethos-u65-512.toml @@ -1,13 +1,10 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="ethos-u65" - +target = "ethos-u65" # Number of MACs [256, 512] -mac=512 - +mac = 512 # Memory mode: [SRAM Only, Shared SRAM, Dedicated SRAM] -memory_mode="Dedicated_Sram" - +memory_mode = "Dedicated_Sram" # System configuration -system_config="Ethos_U65_High_End" +system_config = "Ethos_U65_High_End" diff --git a/src/mlia/resources/target_profiles/tosa.toml b/src/mlia/resources/target_profiles/tosa.toml index fb179ab..8eb0131 100644 --- a/src/mlia/resources/target_profiles/tosa.toml +++ b/src/mlia/resources/target_profiles/tosa.toml @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -target="tosa" +target = "tosa" -- cgit v1.2.1