TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

Пронајдени 3 слични објави

Пребарај: #tashkentevents

当前筛选 #tashkentevents清除筛选
GAMEFEST.UZ

@gamefestuz · Post #274 · 07.04.2026 г., 05:08

O‘zbekiston o‘yin sanoati tarixida yangi sahifa! Biz Game Fest 2026 doirasida navbatdagi maxsus mehmonimizni e’lon qilishdan faxrlanamiz. 🌍HOMA GAMES — ENDI TOSHKENTDA! Homa Games - bu dunyo miqyosidagi mobil o‘yinlar nashriyoti (publisher) bo‘lib, ularning portfelidagi o‘yinlar 1 milliarddan ortiq marta yuklab olingan! Ular "Hyper-casual" va "Hybrid-casual" yo‘nalishlarida dunyo yetakchilari hisoblanadi. Nega bu siz uchun muhim? 📌 Direct Pitching: O‘z o‘yiningizni dunyodagi eng kuchli nashriyotlardan biriga shaxsan taqdim etish imkoniyati. 📌 Market Insights: Homa Lab texnologiyalari va o‘yinlarni global darajaga olib chiqish sirlari haqida eksklyuziv bilimlar. 📌 ScaleUp: Loyihangizni jahon bozoriga olib chiqish va investitsiya jalb qilish uchun eng qisqa yo‘l. Creative Tech va Game Fest 2026 - bu shunchaki festival emas, bu sizning global karyerangiz boshlanish nuqtasidir. 📅Sana: 2026-yil, 15-16 may 📍Manzil: Renaissance Hall, Toshkent 🏛Tashkilotchi: O‘zbekiston Kreativ uyushmasi 🚀O‘z o‘yiningizni dunyoga ko‘rsatishga tayyormisiz?🌐 Batafsil va ro‘yxatdan o‘tish: CreativeTech.uz 📢 Kanalimiz: @creative_tech_official 📞 Aloqa: +998-95-474-19-19 ————————— A New Chapter for Uzbekistan’s Gaming Industry! 🚀🎮 We are thrilled to announce our next special guest for Game Fest 2026 ! Join us as we welcome a global powerhouse to Tashkent: 🌍 HOMA GAMES — NOW IN UZBEKISTAN! Homa Games is a world-class mobile games publisher with over 1 billion downloads across their portfolio. They are undisputed global leaders in the "Hyper-casual" and "Hybrid-casual" sectors. Why is this a game-changer for you? 📌 Direct Pitching: A rare opportunity to present your game personally to one of the world’s most influential publishers. 📌 Market Insights: Gain exclusive knowledge on Homa Lab technologies and the secrets to scaling games to a global audience. 📌 ScaleUp & Funding: The fastest route to taking your project to the international market and securing professional backing. Creative Tech & Game Fest 2026 is more than just a festival—it is the launchpad for your global career. 📅 Date: May 15-16, 2026 📍 Venue: Renaissance Hall, Tashkent 🏛 Organizer: Uzbekistan Creative Association 🚀 Ready to show your game to the world? 🌐 Details & Registration: CreativeTech.uz 📢 Follow us: @creative_tech_official 📞 Contact: +998-95-474-19-19 #GameFest2026#HomaGames#GamedevUzbekistan#CreativeTech#AnimationUz#GameDev#TashkentEvents

Yoshlar Markazi | Ziyo Forum

@YouthCenterZiyo · Post #293 · 24.05.2024 г., 07:32

Hey ziyocommunity fam! ✌️ On May 23rd, we had an incredible event with the legendary Professor Randall Abate from George Washington University! 🌎📚 He shared his extensive knowledge on climate change governance and how nations tackle this global issue. 🚀 Check out these amazing photos from the event and relive the moments of enlightenment! 📸✨ @YouthCenterZiyo #ZiyoCommunity#ZiyoForum#YouthCenter#TerritoryOfYourDevelopment #EcoHub#ClimateChange#TashkentEvents#ProfessorAbate#YouthEngagement

GAMEFEST.UZ

@gamefestuz · Post #272 · 06.04.2026 г., 10:21

Kokko - Game Fest 2026 da! 🎮✨ O‘yin sanoati va animatsiya olamining eng kutilgan voqeasiga tayyormisiz? Bizda ajoyib yangilik bor! O‘zining kreativ loyihalari bilan tanilgan Kokko studiyasi bu yilgi Game Fest 2026 festivalida ishtirok etadi. Bu - soha mutaxassislari, geymerlar va vizual san’at ishqibozlari uchun haqiqiy bayram bo‘ladi. Festivalda bizni nimalar kutyapti? Kokko studiyasining eng so‘nggi loyihalari taqdimoti; 🔹 Animatsiya va Gamedev olamidagi yangi trendlar; 🔹 Sanoat yetakchilari bilan networking va tajriba almashish. 🗓Sana: 15-16 may, 2026-yil 📍Manzil: Renaissance Hall, Toshkent O‘tkazib yubormang! Biz bilan birga o‘yinlar va animatsiya olamiga sho‘ng‘ing. 🚀 ———————— O‘tkazib yubormang! Biz bilan birga o‘yinlar va animatsiya olamiga sho‘ng‘ing. 🚀 #GameFest2026#Kokko#GamedevUz#Animation#TashkentEvents#CreativeEconomy#KokkoStudio Kokko at Game Fest 2026! 🎮✨ Are you ready for the most anticipated event in the gaming and animation industry? We have some exciting news to share! Kokko Studio , renowned for its creative projects, is officially joining Game Fest 2026 . This is going to be a true celebration for industry professionals, gamers, and visual arts enthusiasts alike. What can you expect at the festival? 🔹 Presentation of the latest projects from Kokko Studio; 🔹 Insights into the newest trends in Animation and GameDev; 🔹 Exclusive networking and knowledge sharing with industry leaders. 🗓 Date: May 15-16, 2026 📍 Venue: Renaissance Hall, Tashkent Don’t miss out! Come and dive into the world of gaming and animation with us. 🚀 #GameFest2026#Kokko#GamedevUz#Animation#TashkentEvents#CreativeEconomy#KokkoStudio#GameDev#DigitalArts