mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-20 14:28:54 +00:00
Tree: Use safe loader for YAML
Loaders that read use a safe type while loaders that write use both round-trip and safe options. Also don't create module-level parsers where they're not needed. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -11,8 +11,6 @@ from typing import Dict, List, Optional, Union
|
||||
|
||||
from common.utils import unwrap, prune_dict
|
||||
|
||||
yaml = YAML()
|
||||
|
||||
|
||||
# Common class for sampler params
|
||||
class BaseSamplerRequest(BaseModel):
|
||||
@@ -418,7 +416,10 @@ async def overrides_from_file(preset_name: str):
|
||||
overrides_container.selected_preset = preset_path.stem
|
||||
async with aiofiles.open(preset_path, "r", encoding="utf8") as raw_preset:
|
||||
contents = await raw_preset.read()
|
||||
preset = yaml.safe_load(contents)
|
||||
|
||||
# Create a temporary YAML parser
|
||||
yaml = YAML(typ="safe")
|
||||
preset = yaml.load(contents)
|
||||
overrides_from_dict(preset)
|
||||
|
||||
logger.info("Applied sampler overrides from file.")
|
||||
|
||||
Reference in New Issue
Block a user