@itsmealexaliza · Post #368 · 18.10.2022 г., 06:31
Today arm pro offers only #Lifetime Key Rs₹ 1500 Instantly key Buy key dm @alexalizaca
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
Пребарај: #lifetime
@itsmealexaliza · Post #368 · 18.10.2022 г., 06:31
Today arm pro offers only #Lifetime Key Rs₹ 1500 Instantly key Buy key dm @alexalizaca
Hashtags
@cryptocurreniesbtc · Post #23052 · 10.08.2024 г., 15:57
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@cryptocurreniesbtc · Post #23003 · 08.08.2024 г., 02:51
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@cryptocurreniesbtc · Post #22878 · 20.07.2024 г., 10:31
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@cryptocurreniesbtc · Post #22840 · 10.07.2024 г., 15:31
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@cryptocurreniesbtc · Post #22804 · 03.07.2024 г., 16:15
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @Wh_VIPCryptocurrenc
@cryptocurreniesbtc · Post #22775 · 26.06.2024 г., 08:48
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@cryptocurreniesbtc · Post #22739 · 20.06.2024 г., 19:12
💵 Subscription fee #VIP Spot only 👇💰👇💰👇💰👇 #month - $200 - $700 #lifetime 📞 To join every service based on your needs, contact me: ✅ @TopTraden
@itsmealexaliza · Post #396 · 28.10.2022 г., 07:28
Today arm Ultra offers only #New Offers #Lifetime Key Rs₹ 1299 lifetime Rs₹ 999 Yearly Rs ₹700 6 month Rs₹ 200 monthly For dollars $22 lifetime $15 Yearly $ 5 monthly Global Server Noo Need VPN #noVpnNeedAnymore Note 📝 It's Global Server So Need Vpn Instantly key Buy key dm @alexalizaca Note 📝 This Is Arm Pro Source it's Not Arm Pro. So don't be confuse. We want function with Cheap rate that's why it's posted. Some hater tell copy version. it's source arm pro. With full function cheap rate.
Hashtags
@cryptocurreniesbtc · Post #22648 · 01.02.2024 г., 04:13
💵 Subscription fee #VIP 👇💰👇💰👇💰👇 #month - $150 3 #months - $300 6 #months - $600 #VIP, #VIP_ Plus #VIP#VIP_PLUS - $2000 #lifetime 📞 To join every service based on your needs, contact me: ✅ @VICryptocurrenc
@cryptocurreniesbtc · Post #22617 · 30.01.2024 г., 10:27
💵 Subscription fee #VIP 👇💰👇💰👇💰👇 #month - $150 3 #months - $300 6 #months - $600 #VIP, #VIP_ Plus #VIP#VIP_PLUS - $2000 #lifetime 📞 To join every service based on your needs, contact me: ✅@Wh_VIPCryptocurrency
@cryptocurreniesbtc · Post #22139 · 14.11.2023 г., 22:00
💵 Subscription fee #VIP 👇💰👇💰👇💰👇 #month - $150 3 #months - $300 6 #months - $600 #VIP, #VIP_ Plus #VIP#VIP_PLUS - $2000 #lifetime We publish the strongest signals on the VIP and VIP_PLUS channel 4-8 per day, the average profit per trade ranges from 150% to 300% and the risk ratio is very low, the success rate of trades is high, almost 97%. We provide support and assistance all the time to help you make good daily profits Signal type is #Futures and #Spot 📞 To join every service based on your needs, contact me: ✅@Wh_VIPCryptocurrency