def save_output(cls, destination: str, output: str) -> None: if is_url(destination): cls.post_output(destination, output) else: if Path(destination).is_absolute(): save_path = Path(destination) else: base_path = config_resolver.get_base_path() save_path = base_path.joinpath(destination) # create the folders if not exists save_path.parent.mkdir(parents=True, exist_ok=True) with save_path.open(mode="w") as fout: fout.write(output)
def resolve_config(config_str: str) -> Dict[str, YamlTree]: """ resolves if config arg is a registry entry, a url, or a file, folder, or loads from defaults if None""" start_t = time.time() if config_str in RULES_REGISTRY: config = download_config(RULES_REGISTRY[config_str]) elif is_url(config_str): config = download_config(config_str) else: config = load_config_from_local_path(config_str) if config: logger.debug( f"loaded {len(config)} configs in {time.time() - start_t}") return config