mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
reduce mandatory requirements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import re
|
||||
import inspect
|
||||
from typing import Any, Optional, Dict, List, Type, Callable, Union
|
||||
from pydantic import BaseModel, Field, create_model # pylint: disable=no-name-in-module
|
||||
from inflection import underscore
|
||||
from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img
|
||||
import modules.shared as shared
|
||||
|
||||
@@ -29,6 +29,12 @@ if not hasattr(BaseModel, "__config__"):
|
||||
BaseModel.__config__ = DummyConfig
|
||||
|
||||
|
||||
def underscore(name: str) -> str: # Convert CamelCase or PascalCase string to underscore_case (snake_case).
|
||||
# use instead of inflection.underscore
|
||||
s1 = re.sub('([a-z0-9])([A-Z])', r'\1_\2', name)
|
||||
s2 = re.sub('([A-Z]+)([A-Z][a-z])', r'\1_\2', s1)
|
||||
return s2.lower()
|
||||
|
||||
class PydanticModelGenerator:
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user