Serialize Python UUIDs to strings for QML
This commit is contained in:
parent
bbb872e5dc
commit
ae009c7412
|
@ -12,6 +12,7 @@ from enum import auto as autostr
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Any, Callable, Dict, Tuple, Type
|
from typing import Any, Callable, Dict, Tuple, Type
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
import filetype
|
import filetype
|
||||||
from aiofiles.threadpool.binary import AsyncBufferedReader
|
from aiofiles.threadpool.binary import AsyncBufferedReader
|
||||||
|
@ -136,6 +137,9 @@ def serialize_value_for_qml(value: Any) -> Any:
|
||||||
if isinstance(value, Path):
|
if isinstance(value, Path):
|
||||||
return f"file://{value!s}"
|
return f"file://{value!s}"
|
||||||
|
|
||||||
|
if isinstance(value, UUID):
|
||||||
|
return str(value)
|
||||||
|
|
||||||
if inspect.isclass(value):
|
if inspect.isclass(value):
|
||||||
return value.__name__
|
return value.__name__
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user