mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
Add type assertion
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user