satori-python 1.3.8__tar.gz → 1.3.9__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.
Files changed (31) hide show
  1. {satori_python-1.3.8 → satori_python-1.3.9}/PKG-INFO +1 -1
  2. {satori_python-1.3.8 → satori_python-1.3.9}/pyproject.toml +1 -1
  3. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/__init__.py +1 -1
  4. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/model.py +29 -29
  5. {satori_python-1.3.8 → satori_python-1.3.9}/LICENSE +0 -0
  6. {satori_python-1.3.8 → satori_python-1.3.9}/README.md +0 -0
  7. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/_vendor/fleep.py +0 -0
  8. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/__init__.py +0 -0
  9. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/account.py +0 -0
  10. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/account.pyi +0 -0
  11. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/config.py +0 -0
  12. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/network/__init__.py +0 -0
  13. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/network/base.py +0 -0
  14. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/network/util.py +0 -0
  15. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/network/webhook.py +0 -0
  16. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/network/websocket.py +0 -0
  17. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/client/protocol.py +0 -0
  18. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/const.py +0 -0
  19. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/element.py +0 -0
  20. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/event.py +0 -0
  21. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/exception.py +0 -0
  22. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/parser.py +0 -0
  23. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/py.typed +0 -0
  24. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/__init__.py +0 -0
  25. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/adapter.py +0 -0
  26. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/connection.py +0 -0
  27. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/formdata.py +0 -0
  28. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/model.py +0 -0
  29. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/route.py +0 -0
  30. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/server/utils.py +0 -0
  31. {satori_python-1.3.8 → satori_python-1.3.9}/src/satori/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satori-python
3
- Version: 1.3.8
3
+ Version: 1.3.9
4
4
  Summary: Satori Protocol SDK for python
5
5
  Home-page: https://github.com/RF-Tar-Railt/satori-python
6
6
  Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
@@ -30,7 +30,7 @@ classifiers = [
30
30
  "Programming Language :: Python :: 3.14",
31
31
  "Operating System :: OS Independent",
32
32
  ]
33
- version = "1.3.8"
33
+ version = "1.3.9"
34
34
 
35
35
  [project.license]
36
36
  text = "MIT"
@@ -45,7 +45,7 @@ from .model import Role as Role
45
45
  from .model import Upload as Upload
46
46
  from .model import User as User
47
47
 
48
- __version__ = "1.3.8"
48
+ __version__ = "1.3.9"
49
49
 
50
50
 
51
51
  MessageReceipt = MessageObject
@@ -32,7 +32,7 @@ class ModelBase:
32
32
  @classmethod
33
33
  def parse(cls: type[Self], raw: dict) -> Self:
34
34
  data = {}
35
- cls.before_parse(data)
35
+ cls.before_parse(raw)
36
36
  for name in cls.__dataclass_fields__:
37
37
  if name in raw and raw[name] is not None:
38
38
  if name in cls.__converter__:
@@ -46,13 +46,13 @@ class ModelBase:
46
46
  def __init_subclass__(cls, **kwargs):
47
47
  has_converter = False
48
48
  keys = set()
49
- for c in cls.__mro__:
49
+ for c in cls.__mro__[-1:0:-1]:
50
50
  if c is Generic:
51
51
  _generic_init_subclass(cls, **kwargs)
52
52
  if getattr(c, "__converter__", None):
53
53
  has_converter = True
54
54
  keys.update(getattr(c, "__annotations__", {}).keys())
55
- keys = frozenset(k for k in keys if not k.startswith("_"))
55
+ keys = frozenset({k for k in keys if not (k.startswith("_") and k not in {"_type", "_data"})})
56
56
 
57
57
  def parse1(cls_: type[Self], raw: dict, _keys=keys) -> Self:
58
58
  data = {k: v for k, v in raw.items() if k in _keys and v is not None}
@@ -62,7 +62,7 @@ class ModelBase:
62
62
 
63
63
  def parse2(cls_: type[Self], raw: dict, _keys=keys) -> Self:
64
64
  data = {}
65
- cls_.before_parse(data)
65
+ cls_.before_parse(raw)
66
66
  for name in _keys:
67
67
  if name in raw and raw[name] is not None:
68
68
  if name in cls_.__converter__:
@@ -101,9 +101,9 @@ class Channel(ModelBase):
101
101
 
102
102
  def dump(self):
103
103
  res = {"id": self.id, "type": self.type.value}
104
- if self.name:
104
+ if self.name is not None:
105
105
  res["name"] = self.name
106
- if self.parent_id:
106
+ if self.parent_id is not None:
107
107
  res["parent_id"] = self.parent_id
108
108
  return res
109
109
 
@@ -116,9 +116,9 @@ class Guild(ModelBase):
116
116
 
117
117
  def dump(self):
118
118
  res = {"id": self.id}
119
- if self.name:
119
+ if self.name is not None:
120
120
  res["name"] = self.name
121
- if self.avatar:
121
+ if self.avatar is not None:
122
122
  res["avatar"] = self.avatar
123
123
  return res
124
124
 
@@ -133,13 +133,13 @@ class User(ModelBase):
133
133
 
134
134
  def dump(self):
135
135
  res: dict[str, Any] = {"id": self.id}
136
- if self.name:
136
+ if self.name is not None:
137
137
  res["name"] = self.name
138
- if self.nick:
138
+ if self.nick is not None:
139
139
  res["nick"] = self.nick
140
- if self.avatar:
140
+ if self.avatar is not None:
141
141
  res["avatar"] = self.avatar
142
- if self.is_bot:
142
+ if self.is_bot is not None:
143
143
  res["is_bot"] = self.is_bot
144
144
  return res
145
145
 
@@ -157,9 +157,9 @@ class Friend(ModelBase):
157
157
 
158
158
  def dump(self):
159
159
  res = {}
160
- if self.user:
160
+ if self.user is not None:
161
161
  res["user"] = self.user.dump()
162
- if self.nick:
162
+ if self.nick is not None:
163
163
  res["nick"] = self.nick
164
164
  return res
165
165
 
@@ -177,7 +177,7 @@ class Role(ModelBase):
177
177
 
178
178
  def dump(self):
179
179
  res = {"id": self.id}
180
- if self.name:
180
+ if self.name is not None:
181
181
  res["name"] = self.name
182
182
  return res
183
183
 
@@ -200,11 +200,11 @@ class Member(ModelBase):
200
200
  res = {}
201
201
  if self.user:
202
202
  res["user"] = self.user.dump()
203
- if self.nick:
203
+ if self.nick is not None:
204
204
  res["nick"] = self.nick
205
- if self.avatar:
205
+ if self.avatar is not None:
206
206
  res["avatar"] = self.avatar
207
- if self.joined_at:
207
+ if self.joined_at is not None:
208
208
  res["joined_at"] = int(self.joined_at.timestamp() * 1000)
209
209
  if self.roles:
210
210
  res["roles"] = [role.dump() for role in self.roles]
@@ -282,7 +282,7 @@ class ButtonInteraction(ModelBase):
282
282
 
283
283
  def dump(self):
284
284
  res = {"id": self.id}
285
- if self.data:
285
+ if self.data is not None:
286
286
  res["data"] = self.data
287
287
  return res
288
288
 
@@ -362,7 +362,7 @@ class EmojiObject(ModelBase):
362
362
 
363
363
  def dump(self):
364
364
  res = {"id": self.id}
365
- if self.name:
365
+ if self.name is not None:
366
366
  res["name"] = self.name
367
367
  return res
368
368
 
@@ -438,11 +438,11 @@ class MessageObject(ModelBase):
438
438
  res["member"] = self.member.dump()
439
439
  if self.user:
440
440
  res["user"] = self.user.dump()
441
- if self.created_at:
441
+ if self.created_at is not None:
442
442
  res["created_at"] = int(self.created_at.timestamp() * 1000)
443
- if self.updated_at:
443
+ if self.updated_at is not None:
444
444
  res["updated_at"] = int(self.updated_at.timestamp() * 1000)
445
- if self.referrer:
445
+ if self.referrer is not None:
446
446
  res["referrer"] = self.referrer
447
447
  return res
448
448
 
@@ -535,13 +535,13 @@ class Event(ModelBase):
535
535
  res["role"] = self.role.dump()
536
536
  if self.user:
537
537
  res["user"] = self.user.dump()
538
- if self.referrer:
538
+ if self.referrer is not None:
539
539
  res["referrer"] = self.referrer
540
540
  if self.emoji:
541
541
  res["emoji"] = self.emoji.dump()
542
- if self._type:
542
+ if self._type is not None:
543
543
  res["_type"] = self._type
544
- if self._data:
544
+ if self._data is not None:
545
545
  res["_data"] = self._data
546
546
  return res
547
547
 
@@ -561,7 +561,7 @@ class PageResult(ModelBase, Generic[T]):
561
561
 
562
562
  def dump(self):
563
563
  res: dict = {"data": [item.dump() for item in self.data]}
564
- if self.next:
564
+ if self.next is not None:
565
565
  res["next"] = self.next
566
566
  return res
567
567
 
@@ -577,9 +577,9 @@ class PageDequeResult(PageResult[T]):
577
577
 
578
578
  def dump(self):
579
579
  res: dict = {"data": [item.dump() for item in self.data]}
580
- if self.next:
580
+ if self.next is not None:
581
581
  res["next"] = self.next
582
- if self.prev:
582
+ if self.prev is not None:
583
583
  res["prev"] = self.prev
584
584
  return res
585
585
 
File without changes
File without changes