mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
fix 'PublishedWorkfileInfo'
This commit is contained in:
parent
7cb22fbe1f
commit
df55a32b95
1 changed files with 14 additions and 7 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
|
import typing
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass, asdict
|
||||||
import typing
|
|
||||||
from typing import Optional, Any
|
from typing import Optional, Any
|
||||||
|
|
||||||
import ayon_api
|
import ayon_api
|
||||||
|
|
@ -57,7 +58,13 @@ class WorkfileInfo:
|
||||||
available: bool
|
available: bool
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def new(cls, filepath, rootless_path, available, workfile_entity):
|
def new(
|
||||||
|
cls,
|
||||||
|
filepath: str,
|
||||||
|
rootless_path: str,
|
||||||
|
available: bool,
|
||||||
|
workfile_entity: dict[str, Any],
|
||||||
|
):
|
||||||
file_size = file_modified = file_created = None
|
file_size = file_modified = file_created = None
|
||||||
if filepath and os.path.exists(filepath):
|
if filepath and os.path.exists(filepath):
|
||||||
filestat = os.stat(filepath)
|
filestat = os.stat(filepath)
|
||||||
|
|
@ -85,7 +92,7 @@ class WorkfileInfo:
|
||||||
available=available,
|
available=available,
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_data(self):
|
def to_data(self) -> dict[str, Any]:
|
||||||
"""Converts file item to data.
|
"""Converts file item to data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
@ -95,7 +102,7 @@ class WorkfileInfo:
|
||||||
return asdict(self)
|
return asdict(self)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_data(cls, data):
|
def from_data(cls, data: dict[str, Any]) -> "WorkfileInfo":
|
||||||
"""Converts data to workfile item.
|
"""Converts data to workfile item.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -173,7 +180,7 @@ class PublishedWorkfileInfo:
|
||||||
file_modified=file_modified,
|
file_modified=file_modified,
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_data(self):
|
def to_data(self) -> dict[str, Any]:
|
||||||
"""Converts file item to data.
|
"""Converts file item to data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
@ -183,7 +190,7 @@ class PublishedWorkfileInfo:
|
||||||
return asdict(self)
|
return asdict(self)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_data(cls, data):
|
def from_data(cls, data: dict[str, Any]) -> "PublishedWorkfileInfo":
|
||||||
"""Converts data to workfile item.
|
"""Converts data to workfile item.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -193,7 +200,7 @@ class PublishedWorkfileInfo:
|
||||||
WorkfileInfo: File item.
|
WorkfileInfo: File item.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return WorkfileInfo(**data)
|
return PublishedWorkfileInfo(**data)
|
||||||
|
|
||||||
|
|
||||||
class IWorkfileHost:
|
class IWorkfileHost:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue