Add type assertion

This commit is contained in:
awsr
2025-12-17 16:44:35 -08:00
parent ab7ca7e303
commit 3fa20d8fce
+3
View File
@@ -8,6 +8,7 @@ import html
import base64
import urllib.parse
import threading
from typing import TYPE_CHECKING
from types import SimpleNamespace
from pathlib import Path
from html.parser import HTMLParser
@@ -860,6 +861,8 @@ def create_ui(container, button_parent, tabname, skip_indexing = False):
is_valid = (item is not None) and hasattr(item, 'name') and hasattr(item, 'filename')
if is_valid:
if TYPE_CHECKING:
assert item is not None # Part of the definition of "is_valid"
stat_size, stat_mtime = modelstats.stat(item.filename)
if hasattr(item, 'size') and item.size > 0:
stat_size = item.size