mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +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
|
||||
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import typing
|
||||
from abc import abstractmethod
|
||||
from dataclasses import dataclass, asdict
|
||||
import typing
|
||||
from typing import Optional, Any
|
||||
|
||||
import ayon_api
|
||||
|
|
@ -57,7 +58,13 @@ class WorkfileInfo:
|
|||
available: bool
|
||||
|
||||
@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
|
||||
if filepath and os.path.exists(filepath):
|
||||
filestat = os.stat(filepath)
|
||||
|
|
@ -85,7 +92,7 @@ class WorkfileInfo:
|
|||
available=available,
|
||||
)
|
||||
|
||||
def to_data(self):
|
||||
def to_data(self) -> dict[str, Any]:
|
||||
"""Converts file item to data.
|
||||
|
||||
Returns:
|
||||
|
|
@ -95,7 +102,7 @@ class WorkfileInfo:
|
|||
return asdict(self)
|
||||
|
||||
@classmethod
|
||||
def from_data(cls, data):
|
||||
def from_data(cls, data: dict[str, Any]) -> "WorkfileInfo":
|
||||
"""Converts data to workfile item.
|
||||
|
||||
Args:
|
||||
|
|
@ -173,7 +180,7 @@ class PublishedWorkfileInfo:
|
|||
file_modified=file_modified,
|
||||
)
|
||||
|
||||
def to_data(self):
|
||||
def to_data(self) -> dict[str, Any]:
|
||||
"""Converts file item to data.
|
||||
|
||||
Returns:
|
||||
|
|
@ -183,7 +190,7 @@ class PublishedWorkfileInfo:
|
|||
return asdict(self)
|
||||
|
||||
@classmethod
|
||||
def from_data(cls, data):
|
||||
def from_data(cls, data: dict[str, Any]) -> "PublishedWorkfileInfo":
|
||||
"""Converts data to workfile item.
|
||||
|
||||
Args:
|
||||
|
|
@ -193,7 +200,7 @@ class PublishedWorkfileInfo:
|
|||
WorkfileInfo: File item.
|
||||
|
||||
"""
|
||||
return WorkfileInfo(**data)
|
||||
return PublishedWorkfileInfo(**data)
|
||||
|
||||
|
||||
class IWorkfileHost:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue