Skip to content
Snippets Groups Projects
Commit 907ee365 authored by vlorentz's avatar vlorentz
Browse files

Restore deprecated functions config_basepath and config_exists

parent 2663c0a4
No related branches found
No related tags found
1 merge request!353Restore deprecated functions config_basepath and config_exists
Pipeline #2443 passed
......@@ -9,6 +9,7 @@ import logging
import os
from typing import Any, Callable, Dict, List, Optional, Tuple
from deprecated import deprecated
import yaml
logger = logging.getLogger(__name__)
......@@ -85,6 +86,25 @@ def read_raw_config(base_config_path: str) -> Dict[str, Any]:
return yaml.safe_load(f)
@deprecated(
version="2.23.0",
reason="pass config paths as-is to read_raw_config/read, and rely on click.Path",
)
def config_exists(path):
"""Check whether the given config exists"""
path = config_path(path)
return path is not None and exists_accessible(path)
@deprecated(version="2.23.0", reason="pass config paths as-is to read_raw_config/read")
def config_basepath(config_path: str) -> str:
"""Return the base path of a configuration file"""
if config_path.endswith(".yml"):
return config_path[:-4]
return config_path
def config_path(config_path):
"""Check whether the given config exists"""
if exists_accessible(config_path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment