How to use the tsrc.config function in tsrc

To help you get started, we’ve selected a few tsrc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TankerHQ / tsrc / tsrc / github.py View on Github external
def get_config_auth_object(auth_system: str) -> Dict[str, Any]:
    config = tsrc.config.parse_tsrc_config()
    auth = config.get("auth")
    if not auth:
        return {}
    return cast(Dict[str, Any], auth.get(auth_system, {}))
github TankerHQ / tsrc / tsrc / github.py View on Github external
def save_token(token: str, auth_system: str) -> None:
    cfg_path = tsrc.config.get_tsrc_config_path()
    if cfg_path.exists():
        config = tsrc.config.parse_tsrc_config(roundtrip=True)
    else:
        config = tsrc.Config({})
    if "auth" not in config:
        config["auth"] = {}
    auth = config["auth"]
    if auth_system not in auth:
        auth[auth_system] = {}
    auth[auth_system]["token"] = token
    tsrc.config.dump_tsrc_config(config)
github TankerHQ / tsrc / tsrc / workspace / manifest_config.py View on Github external
def from_file(cls, cfg_path: Path) -> "ManifestConfig":
        as_dict = tsrc.config.parse_config(cfg_path)  # type: Dict[str, Any]
        file_path = as_dict.get("file_path")
        if file_path:
            as_dict["file_path"] = Path(file_path)
        return cls.from_dict(as_dict)
github TankerHQ / tsrc / tsrc / github.py View on Github external
def save_token(token: str, auth_system: str) -> None:
    cfg_path = tsrc.config.get_tsrc_config_path()
    if cfg_path.exists():
        config = tsrc.config.parse_tsrc_config(roundtrip=True)
    else:
        config = tsrc.Config({})
    if "auth" not in config:
        config["auth"] = {}
    auth = config["auth"]
    if auth_system not in auth:
        auth[auth_system] = {}
    auth[auth_system]["token"] = token
    tsrc.config.dump_tsrc_config(config)
github TankerHQ / tsrc / tsrc / github.py View on Github external
def save_token(token: str, auth_system: str) -> None:
    cfg_path = tsrc.config.get_tsrc_config_path()
    if cfg_path.exists():
        config = tsrc.config.parse_tsrc_config(roundtrip=True)
    else:
        config = tsrc.Config({})
    if "auth" not in config:
        config["auth"] = {}
    auth = config["auth"]
    if auth_system not in auth:
        auth[auth_system] = {}
    auth[auth_system]["token"] = token
    tsrc.config.dump_tsrc_config(config)