@artbysabertoofs · Post #595 · 22.03.2026 г., 22:29
Sparkly #sheath! For Asher! ✨️💙 Thank you again!! ^^ #art
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #397 · 12 ное.
Использование Pydantic сегодня стало нормой, и это правильно. Но иногда на ревью вижу, что используют его не всегда корректно. Например, метод BaseModel.model_dump() по умолчанию не преобразует стандартные типы, такие как datetime, UUID или Decimal, в простой сериализуемый для JSON вид. Тогда пишут кастмоный сериализатор для этих типов чтобы функция json.dump() не падала с ошибкой. import uuid from datetime import datetime from decimal import Decimal from uuid import UUID from pydantic import BaseModel class MyModel(BaseModel): id: UUID date: datetime value: Decimal obj = MyModel( id=uuid.uuid4(), date=datetime.now(), value='1.23' ) print(obj.model_dump()) # не подходит для json.dump # { # 'id': UUID('4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1'), # 'date': datetime.datetime(2025, 12, 12, 12, 12, 12, 111111), # 'value': Decimal('1.23') # } # добавляем свой кастомный сериализатор json.dumps(obj.model_dump(), cls=MySerializer) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2025-12-12T12:12:12.111111', # 'value': '1.23' # } В данном случае класс MySerializer обрабатывает datetime, UUID и Decimal. Например так: class MySerializer(json.JSONEncoder): def default(self, o): if isinstance(o, Decimal): return str(o) elif isinstance(o, datetime): return o.isoformat() elif isinstance(o, UUID): return str(o) return super().default(o) Специально для тех, кто всё еще так делает - в этом нет необходимости! Pydantic может это сделать сам, просто нужно добавить параметр mode="json". json.dumps(obj.model_dump(mode="json")) # { # 'id': '4f8c1bc4-25fd-40cd-9dbe-2c73639b0dc1', # 'date': '2012-12-12T12:12:12.111111', # 'value': '1.23' # } #pydantic#libs
Пребарај: #sheath
@artbysabertoofs · Post #595 · 22.03.2026 г., 22:29
Sparkly #sheath! For Asher! ✨️💙 Thank you again!! ^^ #art
@artbysabertoofs · Post #594 · 21.03.2026 г., 21:45
A YCH finished for Botaatti! Thank you so much!! 💙🐯💚 #art#sheath
@artbysabertoofs · Post #579 · 10.03.2026 г., 14:08
A recent YCH for Ryker! ❤️ Thank you so much! #art#sheath
@artbysabertoofs · Post #552 · 25.02.2026 г., 17:15
A YCH commission for October! Thank you so much for your support!! ❤️ #art#sheath
@artbysabertoofs · Post #556 · 28.02.2026 г., 04:36
SURPRISE PEENITS 😳 #wip#sheath
@artbysabertoofs · Post #553 · 26.02.2026 г., 10:58
More WIP for the yeen! #wip#sheath
@artbysabertoofs · Post #515 · 05.02.2026 г., 03:39
WOOFMAN SOON(TM) #wips#sheath
@artbysabertoofs · Post #456 · 16.12.2025 г., 12:30
BIG sheath and balls! For none other than Fogs! 💙 He's giving off big breeder energy here! 😤 #art#hyper#sheath
@beegbois · Post #43726 · 13.05.2026 г., 09:57
#big#sheath#bulge https://twitter.com/Leoguardianz/status/1638219182738403329
@artbysabertoofs · Post #400 · 18.10.2025 г., 01:09
Offering this fella up for $75! ^^ I went for a "blood moon" themed wolf this time around! 🔴🐺 Feel free to DM to claim if you would like him. He comes with high-res and small res files and character rights upon purchase. Payment through PayPal invoices! #adoptable#werewolf#sheath Can't purchase but want to help? I have a post you can share if you'd like. ^^ Thank you all so much! https://bsky.app/profile/sabertoofs.bsky.social/post/3m3glvbc2fc2r
Hashtags
@artbysabertoofs · Post #399 · 16.10.2025 г., 18:48
Offering this fella up for $80! ^^ He's a spooky werewolf ready to romp around on Halloween! :D Feel free to DM to claim if you would like him. He comes with high-res and small res files and character rights upon purchase. Payment through PayPal invoices! #adoptable#werewolf#sheath Can't purchase but want to help? I have a post you can share if you'd like. ^^ Thank you all so much! https://bsky.app/profile/sabertoofs.bsky.social/post/3m36lkpy52s2y
Hashtags