|
@@ -1,8 +1,8 @@
|
|
|
from __future__ import annotations
|
|
|
|
|
|
import os
|
|
|
+import typing as T
|
|
|
|
|
|
-from typing import List
|
|
|
|
|
|
from pycs import db
|
|
|
from pycs.database.base import NamedBaseModel
|
|
@@ -56,8 +56,7 @@ class Collection(NamedBaseModel):
|
|
|
:return: iterator of files
|
|
|
"""
|
|
|
|
|
|
- # pylint: disable=import-outside-toplevel
|
|
|
- # pylint: disable=cyclic-import
|
|
|
+ # pylint: disable=import-outside-toplevel, cyclic-import
|
|
|
from pycs.database.File import File
|
|
|
return self.files.filter(*filters).order_by(File.id).offset(offset).limit(limit)
|
|
|
|
|
@@ -85,9 +84,12 @@ class Collection(NamedBaseModel):
|
|
|
:param fps: frames per second
|
|
|
:return: file
|
|
|
"""
|
|
|
- path = os.path.join(self.project.data_folder, f"{filename}{extension}")
|
|
|
+ # pylint: disable=import-outside-toplevel, cyclic-import
|
|
|
from pycs.database.File import File
|
|
|
|
|
|
+ path = os.path.join(self.project.data_folder, f"{filename}{extension}")
|
|
|
+
|
|
|
+
|
|
|
file, is_new = File.get_or_create(
|
|
|
project_id=self.project_id, collection_id=self.id, path=path)
|
|
|
|
|
@@ -103,7 +105,7 @@ class Collection(NamedBaseModel):
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
- def update_autoselect(collections: List[Collection]) -> List[Collection]:
|
|
|
+ def update_autoselect(collections: T.List[Collection]) -> T.List[Collection]:
|
|
|
""" disable autoselect if there are no elements in the collection """
|
|
|
|
|
|
found = False
|