Blender Kitsu: Fix Gazu Module out of sync #119

Merged
Nick Alberelli merged 11 commits from :fix/restore-gazu-out-of-sync into main 2023-07-13 19:39:30 +02:00
3 changed files with 14 additions and 13 deletions
Showing only changes of commit 7cffbccf95 - Show all commits

View File

@ -1,4 +1,4 @@
from blender_kitsu import gazu import gazu
from . import client as raw from . import client as raw
from .sorting import sort_by_name from .sorting import sort_by_name

View File

@ -26,8 +26,8 @@ from pathlib import Path
from typing import Dict, List, Set, Optional, Tuple, Any from typing import Dict, List, Set, Optional, Tuple, Any
import datetime import datetime
import bpy import bpy
import gazu
from blender_kitsu import gazu, cache, util, prefs, bkglobals from blender_kitsu import cache, util, prefs, bkglobals
from blender_kitsu.sqe import push, pull, checkstrip, opsdata, checksqe from blender_kitsu.sqe import push, pull, checkstrip, opsdata, checksqe
from blender_kitsu.logger import LoggerFactory from blender_kitsu.logger import LoggerFactory
@ -2423,7 +2423,7 @@ class KITSU_OT_vse_publish_edit_revision(bpy.types.Operator):
def get_edit_task_items( def get_edit_task_items(
self: Any, context: bpy.types.Context self: Any, context: bpy.types.Context
) -> List[Tuple[str, str, str]]: ) -> List[Tuple[str, str, str]]:
tasks = connectors.all_tasks_for_edit(self.edit_entry) tasks = gazu.tasks.all_tasks_for_edit(self.edit_entry)
return [ return [
( (
item.get("id"), item.get("id"),

View File

@ -23,7 +23,7 @@ import inspect
from dataclasses import asdict, dataclass, field from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar from typing import Any, Dict, List, Optional, Union, Tuple, TypeVar
from blender_kitsu import gazu import gazu
from blender_kitsu.logger import LoggerFactory from blender_kitsu.logger import LoggerFactory
logger = LoggerFactory.getLogger() logger = LoggerFactory.getLogger()
@ -619,7 +619,6 @@ class Asset(Entity):
asset_name: str, asset_name: str,
asset_type: Optional[AssetType] = None, asset_type: Optional[AssetType] = None,
) -> Optional[Asset]: ) -> Optional[Asset]:
# Convert args to dict for api call. # Convert args to dict for api call.
project_dict = asdict(project) project_dict = asdict(project)
asset_type_dict = asdict(asset_type) if asset_type else asset_type asset_type_dict = asdict(asset_type) if asset_type else asset_type
@ -693,12 +692,19 @@ class TaskType(Entity):
@classmethod @classmethod
def all_shot_task_types(cls) -> List[TaskType]: def all_shot_task_types(cls) -> List[TaskType]:
return [cls.from_dict(t) for t in gazu.task.all_task_types() if t["for_entity"] == "Shot"] return [
cls.from_dict(t)
for t in gazu.task.all_task_types()
if t["for_entity"] == "Shot"
]
@classmethod @classmethod
def all_asset_task_types(cls) -> List[TaskType]: def all_asset_task_types(cls) -> List[TaskType]:
return [ return [
cls.from_dict(t) for t in gazu.task.all_task_types() if t["for_entity"] == "Asset"] cls.from_dict(t)
for t in gazu.task.all_task_types()
if t["for_entity"] == "Asset"
]
def __bool__(self) -> bool: def __bool__(self) -> bool:
return bool(self.id) return bool(self.id)
@ -777,7 +783,6 @@ class Task(Entity):
task_type: TaskType, task_type: TaskType,
name: str = "main", name: str = "main",
) -> Optional[Task]: ) -> Optional[Task]:
# Convert args to dict for api call. # Convert args to dict for api call.
asset_shotdict = asdict(asset_shot) asset_shotdict = asdict(asset_shot)
task_type_dict = asdict(task_type) task_type_dict = asdict(task_type)
@ -804,7 +809,6 @@ class Task(Entity):
assigner: Optional[Person] = None, assigner: Optional[Person] = None,
assignees: Optional[List[Person]] = None, assignees: Optional[List[Person]] = None,
) -> Task: ) -> Task:
# Convert args. # Convert args.
assigner = asdict(assigner) if assigner else assigner assigner = asdict(assigner) if assigner else assigner
task_status = asdict(task_status) if task_status else task_status task_status = asdict(task_status) if task_status else task_status
@ -857,7 +861,6 @@ class Task(Entity):
# I think attachements is equal to attachment_files in Comment class. # I think attachements is equal to attachment_files in Comment class.
created_at: Optional[str] = None, created_at: Optional[str] = None,
) -> Comment: ) -> Comment:
# Convert args. # Convert args.
person = asdict(user) if user else user person = asdict(user) if user else user
@ -909,7 +912,6 @@ class TaskStatus(Entity):
@classmethod @classmethod
def by_short_name(cls, short_name: str) -> Optional[TaskStatus]: def by_short_name(cls, short_name: str) -> Optional[TaskStatus]:
# Can return None if task status does not exist. # Can return None if task status does not exist.
task_status_dict = gazu.task.get_task_status_by_short_name(short_name) task_status_dict = gazu.task.get_task_status_by_short_name(short_name)
@ -919,7 +921,6 @@ class TaskStatus(Entity):
@classmethod @classmethod
def by_name(cls, name: str) -> Optional[TaskStatus]: def by_name(cls, name: str) -> Optional[TaskStatus]:
# Can return None if task status does not exist. # Can return None if task status does not exist.
task_status_dict = gazu.task.get_task_status_by_name(name) task_status_dict = gazu.task.get_task_status_by_name(name)