mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-21 12:00:49 +08:00
removed non-needed code
This commit is contained in:
parent
47f7c7ee8c
commit
0b795dc7a7
@ -2,10 +2,8 @@ from .filters import apply_metadata_filter, apply_tag_filters
|
|||||||
from .ownership import visible_owner_clause
|
from .ownership import visible_owner_clause
|
||||||
from .projection import is_scalar, project_kv
|
from .projection import is_scalar, project_kv
|
||||||
from .tags import (
|
from .tags import (
|
||||||
add_missing_tag_for_asset_hash,
|
|
||||||
add_missing_tag_for_asset_id,
|
add_missing_tag_for_asset_id,
|
||||||
ensure_tags_exist,
|
ensure_tags_exist,
|
||||||
remove_missing_tag_for_asset_hash,
|
|
||||||
remove_missing_tag_for_asset_id,
|
remove_missing_tag_for_asset_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,8 +14,6 @@ __all__ = [
|
|||||||
"project_kv",
|
"project_kv",
|
||||||
"ensure_tags_exist",
|
"ensure_tags_exist",
|
||||||
"add_missing_tag_for_asset_id",
|
"add_missing_tag_for_asset_id",
|
||||||
"add_missing_tag_for_asset_hash",
|
|
||||||
"remove_missing_tag_for_asset_id",
|
"remove_missing_tag_for_asset_id",
|
||||||
"remove_missing_tag_for_asset_hash",
|
|
||||||
"visible_owner_clause",
|
"visible_owner_clause",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from sqlalchemy.dialects import sqlite as d_sqlite
|
|||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
from ..._assets_helpers import normalize_tags
|
from ..._assets_helpers import normalize_tags
|
||||||
from ..models import Asset, AssetInfo, AssetInfoTag, Tag
|
from ..models import AssetInfo, AssetInfoTag, Tag
|
||||||
from ..timeutil import utcnow
|
from ..timeutil import utcnow
|
||||||
|
|
||||||
|
|
||||||
@ -77,18 +77,6 @@ async def add_missing_tag_for_asset_id(
|
|||||||
return len(to_add)
|
return len(to_add)
|
||||||
|
|
||||||
|
|
||||||
async def add_missing_tag_for_asset_hash(
|
|
||||||
session: AsyncSession,
|
|
||||||
*,
|
|
||||||
asset_hash: str,
|
|
||||||
origin: str = "automatic",
|
|
||||||
) -> int:
|
|
||||||
asset = (await session.execute(select(Asset).where(Asset.hash == asset_hash).limit(1))).scalars().first()
|
|
||||||
if not asset:
|
|
||||||
return 0
|
|
||||||
return await add_missing_tag_for_asset_id(session, asset_id=asset.id, origin=origin)
|
|
||||||
|
|
||||||
|
|
||||||
async def remove_missing_tag_for_asset_id(
|
async def remove_missing_tag_for_asset_id(
|
||||||
session: AsyncSession,
|
session: AsyncSession,
|
||||||
*,
|
*,
|
||||||
@ -107,14 +95,3 @@ async def remove_missing_tag_for_asset_id(
|
|||||||
)
|
)
|
||||||
await session.flush()
|
await session.flush()
|
||||||
return int(res.rowcount or 0)
|
return int(res.rowcount or 0)
|
||||||
|
|
||||||
|
|
||||||
async def remove_missing_tag_for_asset_hash(
|
|
||||||
session: AsyncSession,
|
|
||||||
*,
|
|
||||||
asset_hash: str,
|
|
||||||
) -> int:
|
|
||||||
asset = (await session.execute(select(Asset).where(Asset.hash == asset_hash).limit(1))).scalars().first()
|
|
||||||
if not asset:
|
|
||||||
return 0
|
|
||||||
return await remove_missing_tag_for_asset_id(session, asset_id=asset.id)
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user