def from_dict(data: JSON) -> "SecurityConfig": return SecurityConfig( jwt_key=data["jwt"]["key"], admin_pwd=data["login"]["admin"]["pwd"], disabled=data.get("disabled", False), ldap_url=data.get("ldapUrl", ""), )
def replace_study_name(data: JSON) -> None: if isinstance(data, dict): for key, value in data.items(): if isinstance(value, str) and value.startswith("file/"): data[key] = value.replace(uuid, source_study_name) else: replace_study_name(value)
def from_dict(data: JSON) -> "BotCreateDTO": return BotCreateDTO( name=data["name"], group=data["group"], role=RoleType.from_dict(data["role"]), is_author=data.get("isAuthor", True), )
def from_dict(data: JSON) -> "LauncherConfig": return LauncherConfig( binaries={ v: Path(p) for v, p in data["local"]["binaries"].items() }, default=data.get("default", "local"), )
def from_dict(data: JSON) -> "StorageConfig": return StorageConfig( workspaces={ n: WorkspaceConfig.from_dict(w) for n, w in data["workspaces"].items() }, watcher_lock=data.get("watcher_lock", True), )
def save(self, data: JSON, url: Optional[List[str]] = None) -> None: if not self.config.path.exists(): self.config.path.mkdir() if url: RawFileNode(config=self.config.next_file(url[0])).save(str(data)) else: for file, content in data.items(): RawFileNode(config=self.config.next_file(file)).save( str(content))
def _parse_parameters(json: JSON) -> Tuple[bool]: general = json.get("settings", {}).get("generaldata", {}) store_new_set = general.get("output", {}).get("storenewset", False) return (store_new_set, )
def from_json(data: JSON) -> "AntaresUser": return AntaresUser( first_name=data["firstName"], last_name=data["lastName"], groups=data.get("groups", []), )
def from_dict(data: JSON) -> "User": return User(id=data.get("id"), name=data["name"])
def from_dict(data: JSON) -> "Group": return Group( id=data.get("id"), name=data["name"], )
def from_dict(data: JSON) -> "LoggingConfig": return LoggingConfig( level=data["level"], path=data.get("path", None), format=data.get("format", None), )
def from_dict(data: JSON) -> "WorkspaceConfig": return WorkspaceConfig( path=Path(data["path"]), groups=data.get("groups", list()) )