@TestFlightX · Post #34607 · 14.11.2024 г., 11:55
#ZAP#NOTES https://testflight.apple.com/join/pjpeTkap
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
Пребарај: #zap
@TestFlightX · Post #34607 · 14.11.2024 г., 11:55
#ZAP#NOTES https://testflight.apple.com/join/pjpeTkap
@TestFlightX · Post #34286 · 12.10.2024 г., 03:54
#ZAP#ZAP#MULTIPLAYER https://testflight.apple.com/join/GJrfD9Ue
Hashtags
@tonevents_en · Post #1726 · 12.08.2025 г., 13:29
ZAP and Auto-fill for Bidask, reward distribution and contest with TaskOn 💪ZAP and Auto-fill: now you can add liquidity with only one type of tokens in your wallet, your position will be balanced automatically. Auto-fill is useful for selecting and evenly distributing the second type of tokens, depending on the chosen strategy. 👍 Reward distribution: farming in the 🪙WEB3 / TON pool ended on August 5, the final reward calculation is underway. For the 🪙 HYDRA / TON pool, everything has already been sent to wallets, while the long-term distribution from HYDRA themselves will continue. 🪙 TeFi Alliance campaign has also ended, $2 000 for farming tgUSD has already been sent. 🏆Bidask x TaskOn contest - prize pool $500, the contest will last from August 7 to 21. Conditions below: ➡️Swaps tokens worth $10 or more. ➡️Add liquidity from $10. ➡️More actions = more XP = higher chance of getting a reward. 1st place — $100 2nd place — $90 3rd place — $75 4th place — $60 5th place — $50 6th place — $40 7th place — $30 8th place — $25 9th–10th places — $15 each #Bidask#ZAP#rewards#contest
@swift_airdrops · Post #5125 · 10.04.2024 г., 17:57
⚡️ Airdrop ZAP Chain is finally here! Just Follow the steps 🔥 👉 Join here :- zapchain.io/node-sale/0M7WMX6JXO ➖ Connect your X ➖ Connect your evm ➖ Complete all tasks ➖ Done #Note : 3 days left only guys Don't miss because Snapshot on 13 April at 13:00 UTC Confirmed 🔥#ZAP#ZAPlayer2#Runes#Airdrop