@visuals1 · Post #19722 · 03.02.2026 г., 05:23
#satisfying кирагазка
Hashtags
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
Пребарај: #satisfying
@visuals1 · Post #19722 · 03.02.2026 г., 05:23
#satisfying кирагазка
Hashtags
@Viral_Today · Post #1522 · 21.07.2021 г., 20:33
A mixture of Oobleck Cornstarch and water is solid while moved and liquid when at rest YouTubeNews/ #satisfying
Hashtags
@Viral_Today · Post #1508 · 13.07.2021 г., 23:00
Miniature pottery YouTubeNews/ #satisfying
Hashtags
@Viral_Today · Post #1506 · 12.07.2021 г., 23:00
Making the FC Barcelona logo out of sand YouTubeNews/ #satisfying
Hashtags
@dzdigital3 · Post #19397 · 17.01.2026 г., 14:31
🪵🔴 The "Crimson Velvet" River Table Raw wood meets deep red resin. ✨ Witness the satisfying transformation from a simple pour to a luxury masterpiece. 👇 Watch the process: #Woodworking#EpoxyResin#RiverTable#Satisfying#LuxuryDesign
@dzdigital3 · Post #19396 · 05.01.2026 г., 21:45
Preserving nature forever. 🌿🪵 "Wood + Flowers + Resin = Masterpiece 😍 Wait for the gloss pour... 🤤#Satisfying #epoxybank#rivertable#flowerpreservation#satisfyingvideo#resinart#luxuryfurniture#interiordesign Link similar product 🔗 https://amzn.to/4qBg3UA
@dzdigital3 · Post #19399 · 24.01.2026 г., 19:19
Oddly satisfying resin art. Wait for the glow up! 🤤🕰️ #Satisfying#Luxury#WallClock#Decor#InteriorDesign#Art#fyp#foryou#viral
@dzdigital3 · Post #19425 · 27.02.2026 г., 00:04
100+ Hot Wheels in Resin! The Most Satisfying Project Ever 😍 #ResinArt#ToyCars#HotWheels#DIY#Satisfying#Handmade#EpoxyResin#Crafts#WorkShop#AmazingResult More videos https://www.facebook.com/share/1CNa2oWEgF/
@dzdigital3 · Post #19403 · 30.01.2026 г., 19:15
When you want your car to be as cozy as your living room 🛋️🚗 #Satisfying#Transformation#DIY#Craftsmanship#UniqueRides#CarLovers#ViralVideo#Reels#FacebookWatch#AmazingCars Full video 👇 https://www.facebook.com/share/r/1Dg1M4jKCs/
@dzdigital3 · Post #19406 · 01.02.2026 г., 13:59
La Novena memories frozen in time ⏳⚽ #RealMadrid#Zidane#ZinedineZidane#UCL#Football#Soccer#ResinArt#Epoxy#DIY#HalaMadrid#Satisfying#Art#ChampionsLeague#FYP#ForYou