fix: implemented artwork.add_data
This commit is contained in:
@@ -156,6 +156,7 @@ def create_dataclass_instance(t, data: dict):
|
||||
Tuple[Type, dict]: The created instance and a dict, containing the data, which was not used in the creation
|
||||
"""
|
||||
|
||||
data = {k: v for k, v in data.items() if hasattr(t, k)}
|
||||
removed_data = {k: v for k, v in data.items() if not hasattr(t, k)}
|
||||
return t(**data), removed_data
|
||||
needed_data = {k: v for k, v in data.items() if k in t.__dataclass_fields__}
|
||||
removed_data = {k: v for k, v in data.items() if k not in t.__dataclass_fields__}
|
||||
|
||||
return t(**needed_data), removed_data
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
import string
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
@@ -237,5 +238,6 @@ def is_url(value: Any) -> bool:
|
||||
|
||||
if not isinstance(value, str):
|
||||
return True
|
||||
|
||||
return re.match(URL_PATTERN, query) is not None
|
||||
|
||||
# value has to be a string
|
||||
return re.match(URL_PATTERN, value) is not None
|
||||
|
||||
Reference in New Issue
Block a user