@masterprotocol_news · Post #129 · 09.09.2024 г., 08:11
🇰🇷 Master Protocol at #KBW2024 🥰 What a Week!
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
Пребарај: #kbw2024
@masterprotocol_news · Post #129 · 09.09.2024 г., 08:11
🇰🇷 Master Protocol at #KBW2024 🥰 What a Week!
Hashtags
@DWFLabs · Post #835 · 12.09.2024 г., 05:32
We had a blast at DWF Labs Haus: Korea Blockchain Week 2024. Check out some of our highlights 🥂 It was a treat to welcome our guests at a luxurious venue with a stunning view; delicious food and drinks; and great vibes to celebrate #KBW2024. We're grateful for every opportunity to meet our friends and partners in person. Thank you to everyone who attended 🤝 #DWFLabsxKBW2024
Hashtags
@DWFLabs · Post #796 · 30.08.2024 г., 05:30
Ready for DWF Labs Haus: Korea Blockchain Week? 🇰🇷 We're gearing up to host another 🔥 edition of DWF Labs Haus during #KBW2024. The event is in less than a week — reserve your spot now to meet our top tier community. Register here. 📆 4 Sep 2024 ⏱️ 7PM to 11PM GMT+9 #DWFLabsxKBW2024
Hashtags
@DWFLabs · Post #787 · 26.08.2024 г., 04:48
Have you registered for DWF Labs Haus: Korea Blockchain Week yet? Get ready to meet our team and a top tier crypto community at our event during #KBW2024. Register here. 📆 4 Sep 2024 ⏱️ 7PM to 11PM GMT+9 #DWFLabsxKBW2024
Hashtags
@DWFLabs · Post #772 · 08.08.2024 г., 08:00
Get ready for DWF Labs Haus: Korea Blockchain Week 🔥 We're excited to host some of the brightest innovators and crypto enthusiasts over delicious cocktails and canapés during #KBW2024. Register here. 📆 4 Sep 2024 ⏱️ 7PM to 11PM GMT+9 #DWFLabsxKBW2024
Hashtags
@DWFLabs · Post #779 · 15.08.2024 г., 04:00
DWF Labs Haus is coming to #KBW2024 and #TOKEN2049! Come meet with industry leaders and our top tier KOL community in Seoul and Singapore 🤝 All approved DWF Labs KOLs will receive priority registration approval for our events, as well as access to exclusive deal flow from over 700 projects. If you have yet to join our community, register here: https://dwf-labs.com/wavemakers Register for DWF Labs Haus: Korea Blockchain Weekhere. Register for DWF Labs Haus: TOKEN2049 Singaporehere. P.S. We will only reach out to shortlisted KOLs. #DWFLabsxWaveMaker
@DWFLabs · Post #800 · 02.09.2024 г., 08:43
Our Business Partner of Business Development Lingling Jiang is sharing on our work and support for the space 🙌🔥 If you're around, come say hi to the team! #KSL2024#KBW2024#DWFLabs