[FEATURE] Simplify `video_tags`
This commit is contained in:
parent
0cbd2af4d3
commit
6163c47708
1 changed files with 9 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import copy
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
|
|
@ -26,7 +27,8 @@ class VideoTagsOptions(OptionsDictValidator):
|
||||||
description: "{description}"
|
description: "{description}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_required_keys = {"tags"}
|
_optional_keys = {"tags"}
|
||||||
|
_allow_extra_keys = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def partial_validate(cls, name: str, value: Any) -> None:
|
def partial_validate(cls, name: str, value: Any) -> None:
|
||||||
|
|
@ -39,7 +41,12 @@ class VideoTagsOptions(OptionsDictValidator):
|
||||||
|
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
super().__init__(name, value)
|
super().__init__(name, value)
|
||||||
self._tags = self._validate_key(key="tags", validator=DictFormatterValidator)
|
old_tags = self._validate_key(key="tags", validator=DictFormatterValidator, default={})
|
||||||
|
|
||||||
|
new_tags_dict: Dict[str, Any] = copy.deepcopy(value)
|
||||||
|
new_tags_dict.pop("tags", None)
|
||||||
|
|
||||||
|
self._tags = DictFormatterValidator(name=name, value=dict(old_tags._dict, **new_tags_dict))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tags(self) -> DictFormatterValidator:
|
def tags(self) -> DictFormatterValidator:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue