Beispiel #1
0
 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", ""),
     )
Beispiel #2
0
 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)
Beispiel #3
0
 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),
     )
Beispiel #4
0
 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"),
     )
Beispiel #5
0
 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))
Beispiel #7
0
    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, )
Beispiel #8
0
 def from_json(data: JSON) -> "AntaresUser":
     return AntaresUser(
         first_name=data["firstName"],
         last_name=data["lastName"],
         groups=data.get("groups", []),
     )
Beispiel #9
0
 def from_dict(data: JSON) -> "User":
     return User(id=data.get("id"), name=data["name"])
Beispiel #10
0
 def from_dict(data: JSON) -> "Group":
     return Group(
         id=data.get("id"),
         name=data["name"],
     )
Beispiel #11
0
 def from_dict(data: JSON) -> "LoggingConfig":
     return LoggingConfig(
         level=data["level"],
         path=data.get("path", None),
         format=data.get("format", None),
     )
Beispiel #12
0
 def from_dict(data: JSON) -> "WorkspaceConfig":
     return WorkspaceConfig(
         path=Path(data["path"]), groups=data.get("groups", list())
     )