satori-python-core 0.11.0__tar.gz → 0.11.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/PKG-INFO +1 -1
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/pyproject.toml +1 -1
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/__init__.py +1 -1
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/element.py +5 -5
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/.mina/core.toml +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/LICENSE +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/README.md +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/config.py +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/const.py +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/event.py +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/exception.py +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/model.py +0 -0
- {satori_python_core-0.11.0 → satori_python_core-0.11.2}/src/satori/parser.py +0 -0
|
@@ -2,7 +2,7 @@ from base64 import b64encode
|
|
|
2
2
|
from dataclasses import InitVar, dataclass, field, fields
|
|
3
3
|
from io import BytesIO
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Any, Dict, List, Optional, TypeVar, Union
|
|
5
|
+
from typing import Any, Dict, List, Optional, TypeVar, Union, get_args
|
|
6
6
|
from typing_extensions import override
|
|
7
7
|
|
|
8
8
|
from .parser import Element as RawElement
|
|
@@ -24,13 +24,14 @@ class Element:
|
|
|
24
24
|
for f in fields(self):
|
|
25
25
|
if f.name in ("_attrs", "_children"):
|
|
26
26
|
continue
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
_type = get_args(f.type)[0] if hasattr(f.type, "__origin__") else f.type
|
|
28
|
+
if _type is not str and isinstance(attr := getattr(self, f.name), str):
|
|
29
|
+
if _type is bool:
|
|
29
30
|
if attr.lower() not in ("true", "false"):
|
|
30
31
|
raise TypeError(f.name, attr)
|
|
31
32
|
setattr(self, f.name, attr.lower() == "true")
|
|
32
33
|
else:
|
|
33
|
-
setattr(self, f.name,
|
|
34
|
+
setattr(self, f.name, _type(attr))
|
|
34
35
|
self._attrs[f.name] = getattr(self, f.name)
|
|
35
36
|
self._attrs = {k: v for k, v in self._attrs.items() if v is not None}
|
|
36
37
|
|
|
@@ -332,7 +333,6 @@ class Message(Element):
|
|
|
332
333
|
self.__call__(*content or [])
|
|
333
334
|
|
|
334
335
|
|
|
335
|
-
@dataclass
|
|
336
336
|
class Quote(Message):
|
|
337
337
|
"""<quote> 元素用于表示对消息引用。
|
|
338
338
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|