Пример #1
0
def read_user_config(directory):
    try:
        user_cfg = None
        profile = read_profile(directory)
        if profile:
            user_cfg = profile.get('config', {})
        return UserConfig.from_dict(user_cfg)
    except (RuntimeException, ValidationError):
        return UserConfig()
Пример #2
0
def read_user_config(directory: str) -> UserConfig:
    try:
        profile = read_profile(directory)
        if profile:
            user_cfg = coerce_dict_str(profile.get('config', {}))
            if user_cfg is not None:
                return UserConfig.from_dict(user_cfg)
    except (RuntimeException, ValidationError):
        pass
    return UserConfig()