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

Резултати

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

Пребарај: #teslacalls

当前筛选 #teslacalls清除筛选
Tesla Calls Official

@teslacallsofficial · Post #9996 · 13.03.2026 г., 12:02

🔥$CAT Entered this position as a speculative play within the SOLANA ecosystem. Monitor pullbacks carefully, manage entries with discipline, and always conduct your own due diligence before participating. #TSLA Telegram: https://t.me/theoriginalcatcoin X: https://x.com/itscatcoin?s=21 Website: https://bitcointalk.org/index.php?topic=441402.msg4849923#msg4849923 🔗 Contract: https://solscan.io/token/4vncMi4j819n9ndBZXwVXaVHPN8oTgebtEPWcaEipump https://dexscreener.com/solana/Cctnuj42QAx9CXuG2HWxab1tiVrwMkwkgReoLDC9Y3qv $CAT #SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10023 · 15.03.2026 г., 20:56

🔥$RAY Entered this position as a speculative play within the SOLANA ecosystem. Monitor pullbacks carefully, manage entries with discipline, and always conduct your own due diligence before participating. X: https://x.com/i/communities/2033099708164378981 Website: https://x.com/bbcworld/status/2033099192877429170?s=46 🔗 Contract: https://solscan.io/token/G7ydggVFm4RVTTsd3E8MWh7angBs78MTmZN3gVZPpump https://dexscreener.com/solana/HAVxMaLK96qgiyRdvX4YVpjfajU49zWot4tdjxPesMrg #RAY#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10048 · 16.03.2026 г., 11:50

🔥$PEEP Pepe is tired of the dips. With $PEEP, he finally found his inner peace. Pepe enjoys the continuous rise and profits that come with this coin. No more red candles, just Endless Pumps. Telegram: https://t.me/PepeEnjoysEndlessPump X: https://x.com/i/communities/2033273028843638853 Website: https://pepeenjoysendlesspump.fun/ 🔗 Contract: https://solscan.io/token/8HeSKdX9XkJB9PBZiXhFuTYaWbfn3u6sftyPbAcxpump https://dexscreener.com/solana/3N7BHVKWTvzehC1MxsRcmHRAg9vX6fuZj1JFD2zFPiQk #PEEP#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10024 · 15.03.2026 г., 21:05

🔥 $BAGWORKOOR Entered this position as a speculative play within the SOLANA ecosystem. Monitor pullbacks carefully, manage entries with discipline, and always conduct your own due diligence before participating. X: https://x.com/i/communities/2033254050209153139 🔗 Contract: https://solscan.io/token/FDQ77aHDgV6ozbv1b4WM5oXuHGV1cMnjSXpxvgSzpump https://dexscreener.com/solana/ED41PwcJhsPgbUHQb4LZJbWzFXtcEC6RAherWC2YgEU3 #BAGWORKOOR#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10005 · 14.03.2026 г., 22:09

🔥$AGENTJAK An AI-powered Web3 project built around autonomous agents, combining blockchain and intelligent automation to create smarter tools for the crypto ecosystem. 🚀 Telegram: https://t.me/agentwojak X: https://x.com/agentjak_?s=21 Website: https://agentjak.xyz/ 🔗 Contract: https://solscan.io/token/GKyTdLZG7BXjwWUW3QFwz7UykZE9wGXU9bKYDLdbpump https://dexscreener.com/solana/363sZVoQVmwTbZ5LhCZperw7HJBoTK3dWT8Bqy8rMTqY #AGENTJAK#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10004 · 14.03.2026 г., 22:04

🔥$GOMU A meme-powered token inspired by Gomu Gator, bringing fun, viral energy, and a strong community to the Solana ecosystem. Built for memes, momentum, and the next wave of degen culture. 🚀 Telegram: https://t.me/+pTID8PQmyps5ZGRl X: https://x.com/gomugator?s=21 Website: https://www.gomugator.com/ 🔗 Contract: https://solscan.io/token/Bx74hpFiaiBbSonrjyqxjGfAA7gRxM2CeKiy31uN6biR https://dexscreener.com/solana/2h282gdoEDejWWtXTMfPxvMDVPqKb7rVf24b2gWS1cg4 #GOMU#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10002 · 14.03.2026 г., 21:53

🔥$NOTGAY A pure meme-driven token built around internet culture and community momentum. Simple narrative, strong meme energy, and a growing degen community pushing the movement forward. 🚀 Telegram: https://t.me/notgaymeme X: https://x.com/notgaymeme?s=21 Website: https://notgaysool.framer.website/ 🔗 Contract: https://solscan.io/token/uphcYhzNzLBQQcQdpsbQXTFSNApMuh1Y4Jp6KTYpump https://dexscreener.com/solana/Dd4hsmWhwEfkoRh2NxGXmbfYPh474K4yUXuoNmmPYALY #NOTGAY#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #9999 · 14.03.2026 г., 21:44

🔥$MEMECARD When Solana joined Mastercard's crypto partner program, it signaled crypto entering global payments-but on Solana innovation comes from the internet. Discord: https://discord.gg/72wPyXsM X: https://x.com/memecardss?s=21 Website: https://memecard.fun/ 🔗 Contract: https://solscan.io/token/ACc3ZBq1c9h7pofwn2J8b8bvRHvqMFwynVg8neLZpump https://dexscreener.com/solana/CoZ9t3sCeYoNfZwU9kc7fFnpEjcBXptndNwpgbrpqZQR #MEMECARD#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #9997 · 13.03.2026 г., 12:44

🔥$SOS Strategic Oil Supply ($SOS) is built to represent strength, resilience, and energy independence in the digital economy. Our mission is to create a decentralized reserve that empowers holders and fuels long-term value through a strong global community. Telegram: https://t.me/sos_portal X: https://x.com/i/communities/2031245794964344896 Website: https://sos.republican/ 🔗 Contract: https://solscan.io/token/DpxKNEi3XVeRByaGqYKvz2w6E2PhPgBAqdayLcQEpump https://dexscreener.com/solana/BM7Qw7JbGtyLoZw3canKF6Q6EJDp1Q3PYuHQhTNwoq2D #SOS#SOLANA#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10007 · 14.03.2026 г., 22:22

$ROSIE is showing early momentum. Market activity remains stable with minor consolidation, and the market cap sits at approximately $105K. Initial indicators point to renewed investor interest. https://dexscreener.com/bsc/0xe8298b28bf4ee4c9c87b8d26d8d2a237f5f54e23 #ROSIE#BSC#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #10006 · 14.03.2026 г., 22:17

🔥$FROGS Rolled the dice on this BSC play dip hunters know the drill: time it right, and always DYOR. X: https://x.com/christanxsx/status/2019762141427900628?s=46 🔗 Contract: https://solscan.io/token/0xC3B1A6229D9017376cF9a5Ba7a60782BD8dB4444 https://dexscreener.com/bsc/0x3357047F963d6459FB8C4e43c78392e09734e53C #FROGS#BSC#TESLACALLS

Tesla Calls Official

@teslacallsofficial · Post #9960 · 07.03.2026 г., 14:14

Another day, another planet… we’ll send a picture from there soon 🤭🚀 The $WHITEHOUSE narrative is gaining attention momentum continues to build as the community grows stronger. CA: 7oXNE1dbpHUp6dn1JF8pRgCtzfCy4P2FuBneWjZHpump #WHITEHOUSE#SOLANA#TSLA#TESLACALLS🌍🚀

ПретходнаСтраница 1 од 4Следна