#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 """ A tool for validating entity manager configurations. """ import argparse import json import os import re import sys from concurrent.futures import ProcessPoolExecutor import jsonschema.exceptions import jsonschema.validators import referencing from referencing.jsonschema import DRAFT202012 DEFAULT_SCHEMA_FILENAME = "global.json" def get_default_thread_count() -> int: """ Returns the number of CPUs available to the current process. """ try: # This will respect CPU affinity settings return len(os.sched_getaffinity(0)) except AttributeError: # Fallback for systems without sched_getaffinity return os.cpu_count() or 1 def remove_c_comments(string): # first group captures quoted strings (double or single) # second group captures comments (//single-line or /* multi-line */) pattern = r"(\".*?(?