satori-python 1.3.5__tar.gz → 1.3.6__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-1.3.5 → satori_python-1.3.6}/PKG-INFO +1 -1
- {satori_python-1.3.5 → satori_python-1.3.6}/pyproject.toml +1 -1
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/__init__.py +1 -1
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/element.py +25 -11
- {satori_python-1.3.5 → satori_python-1.3.6}/LICENSE +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/README.md +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/_vendor/fleep.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/__init__.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/account.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/account.pyi +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/config.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/network/__init__.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/network/base.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/network/util.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/network/webhook.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/network/websocket.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/client/protocol.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/const.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/event.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/exception.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/model.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/parser.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/py.typed +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/__init__.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/adapter.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/connection.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/formdata.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/model.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/route.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/server/utils.py +0 -0
- {satori_python-1.3.5 → satori_python-1.3.6}/src/satori/utils.py +0 -0
|
@@ -129,7 +129,7 @@ class Element:
|
|
|
129
129
|
args = {**self._attrs}
|
|
130
130
|
elem = f"{self.__class__.__name__}(" + ", ".join(f"{k}={v!r}" for k, v in args.items())
|
|
131
131
|
if self._children:
|
|
132
|
-
elem += ",
|
|
132
|
+
elem += ", [" + ", ".join(repr(i) for i in self._children) + "]"
|
|
133
133
|
return elem + ")"
|
|
134
134
|
|
|
135
135
|
def __call__(self, *content: "str | Element"):
|
|
@@ -257,7 +257,6 @@ class Link(Element):
|
|
|
257
257
|
class Resource(Element):
|
|
258
258
|
src: str
|
|
259
259
|
title: str | None = None
|
|
260
|
-
extra: InitVar[dict[str, Any] | None] = None
|
|
261
260
|
cache: bool | None = None
|
|
262
261
|
timeout: int | None = None
|
|
263
262
|
|
|
@@ -271,14 +270,15 @@ class Resource(Element):
|
|
|
271
270
|
raw: bytes | BytesIO | None = None,
|
|
272
271
|
mime: str | None = None,
|
|
273
272
|
name: str | None = None,
|
|
273
|
+
width: int | None = None,
|
|
274
|
+
height: int | None = None,
|
|
274
275
|
duration: float | None = None,
|
|
275
276
|
poster: str | None = None,
|
|
276
|
-
extra: dict[str, Any] | None = None,
|
|
277
277
|
cache: bool | None = None,
|
|
278
278
|
timeout: int | None = None,
|
|
279
279
|
**kwargs,
|
|
280
280
|
) -> Self:
|
|
281
|
-
data: dict[str, Any] = {
|
|
281
|
+
data: dict[str, Any] = {**kwargs}
|
|
282
282
|
if url is not None:
|
|
283
283
|
data |= {"src": url}
|
|
284
284
|
elif path:
|
|
@@ -296,6 +296,10 @@ class Resource(Element):
|
|
|
296
296
|
raise ValueError(f"{cls} need at least one of url, path and raw")
|
|
297
297
|
if name is not None:
|
|
298
298
|
data["title"] = name
|
|
299
|
+
if width is not None and cls in (Image, Video):
|
|
300
|
+
data["width"] = width
|
|
301
|
+
if height is not None and cls in (Image, Video):
|
|
302
|
+
data["height"] = height
|
|
299
303
|
if duration is not None and cls is Audio:
|
|
300
304
|
data["duration"] = duration
|
|
301
305
|
if poster is not None and cls in (Video, Audio, File):
|
|
@@ -304,11 +308,7 @@ class Resource(Element):
|
|
|
304
308
|
data["cache"] = cache
|
|
305
309
|
if timeout is not None:
|
|
306
310
|
data["timeout"] = timeout
|
|
307
|
-
return cls(
|
|
308
|
-
|
|
309
|
-
def __post_init__(self, extra: dict[str, Any] | None = None):
|
|
310
|
-
if extra:
|
|
311
|
-
self._attrs.update(extra)
|
|
311
|
+
return cls.unpack(data)
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
@dataclass(repr=False)
|
|
@@ -582,7 +582,7 @@ class Custom(Element):
|
|
|
582
582
|
attrs: dict[str, Any] | None = None,
|
|
583
583
|
children: Sequence[str | Element] | None = None,
|
|
584
584
|
):
|
|
585
|
-
self.
|
|
585
|
+
self._type = type
|
|
586
586
|
if not hasattr(self, "_attrs"):
|
|
587
587
|
self._attrs = attrs or {}
|
|
588
588
|
else:
|
|
@@ -595,7 +595,21 @@ class Custom(Element):
|
|
|
595
595
|
@property
|
|
596
596
|
@override
|
|
597
597
|
def tag(self) -> str:
|
|
598
|
-
return self.
|
|
598
|
+
return self._type
|
|
599
|
+
|
|
600
|
+
def __repr__(self) -> str:
|
|
601
|
+
if not self._attrs:
|
|
602
|
+
self._attrs = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
|
|
603
|
+
args = {**self._attrs}
|
|
604
|
+
elem = (
|
|
605
|
+
f"{self.__class__.__name__}({self._type!r}"
|
|
606
|
+
+ ", {"
|
|
607
|
+
+ ", ".join(f"{k!r}: {v!r}" for k, v in args.items())
|
|
608
|
+
+ "}"
|
|
609
|
+
)
|
|
610
|
+
if self._children:
|
|
611
|
+
elem += ", [" + ", ".join(repr(i) for i in self._children) + "]"
|
|
612
|
+
return elem + ")"
|
|
599
613
|
|
|
600
614
|
|
|
601
615
|
@dataclass(repr=False)
|
|
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
|
|
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
|
|
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
|