Hugo Brito 30df79b36a Apply black formatter to dcmanager/orchestrator
This commit applies the Black format to the `dcmanager/orchestrator`
files to ensure that it adheres to the Black code style guidelines.

Test Plan:
PASS: Success in stx-distcloud-tox-black

Story: 2011149
Task: 50444

Change-Id: I89cd3c661eb783468fa486e685c7f2aec6a56f0f
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-07-29 21:25:33 -03:00

52 lines
1.1 KiB
Python

# noqa: H102
import subprocess
import sys
# List of module directories to check
modules = [
"dccommon",
"dcdbsync",
"dcagent",
"dcorch",
"dcmanager/api",
"dcmanager/audit",
"dcmanager/common",
"dcmanager/db",
"dcmanager/orchestrator",
"dcmanager/tests",
"dcmanager",
]
# List of modules that are already formatted with black
formatted_modules = [
"dccommon",
"dcdbsync",
"dcorch",
"dcagent",
"dcmanager/api",
"dcmanager/audit",
"dcmanager/common",
"dcmanager/db",
"dcmanager/orchestrator",
]
# Function to run black check
def run_black_check(module):
try:
subprocess.run(
["black", "--check", "--diff", "--quiet", f"./{module}"], check=True
)
print(f"Black check passed for {module}")
except subprocess.CalledProcessError as e:
print(f"Black check failed for {module}")
# If the module is in formatted_modules, stx-distcloud-tox-black will fail
if module in formatted_modules:
sys.exit(e.returncode)
# Iterate over modules and run black check
for module in modules:
run_black_check(module)