AnP/Python/Models/PseudoLoRAModel.py

24 lines
933 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Self, Any, Sequence, Optional
from Utils.Checks import Check
from Utils.Common import Common
class PseudoLoRAModel:
def __init__(self:Self,
title:str,
content:str|dict[str, str|Sequence[str, str|Sequence[Any], Optional[str|Sequence[str]], bool]],
keys:Optional[str|Sequence[str]] = None,
cacheable:bool = False
) -> None:
self.title:str = title
self.path:str|None = content if Check.is_string(content) else None
self.memory:int = 0
self.cache:str = ""
self.i:int = 0
self.keys:list[str] = Common.get_keys(keys)
self.cacheable:bool = cacheable
self.nested:list[PseudoLoRAModel] = [
PseudoLoRAModel(subtitle, subcontent, subkeys, subcacheable) for subtitle, subcontent, subkeys, subcacheable in content
] if Check.is_array(content) else []