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

Резултати

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

Пребарај: #pepe

当前筛选 #pepe清除筛选
Coin Sonar

@CoinSonar · Post #243657 · 17.04.2026 г., 13:12

#PEPE | Volume spike (USDT PAIR) 9 times the average volume 2.85M USDT traded in 15 min └Buying vol: 1.79M USDT 🟢 Boost score: 3/10 24h Vol: 28.14M USDT (Binance) Price: 0.00000401 (-4.4% in 24h)

Hashtags

CryptoBull_360™

@cryptobull_360 · Post #49673 · 05.05.2026 г., 14:02

#PEPE is getting ready for massive rally from the breakout zone, Volume rising as good momentum, keep an eye on!! Join Toobit: Get a 30,000 USDT in bonuses using this link https://toobit.pro/t/Cryptobull360 https://x.com/CryptoBull_360/status/2051663832175792393?s=20

Hashtags

CryptoBull_360™

@cryptobull_360 · Post #49556 · 29.04.2026 г., 10:19

🐳#PEPE OG whale Deltacorpse.eth spent $100.2K to buy 21.2M $BULL and locked it. This purchase follows their earlier investment in $PEPE at a $2M market cap.

Hashtags

Crypto Headlines

@market_headlines · Post #28293 · 08.04.2026 г., 21:35

🔥#PEPE Компания Canary Capital подала заявку в SEC на запуск PEPE ETF– документ Crypto Headlines

Hashtags

American Crypto©

@americancryptotrading · Post #27562 · 19.03.2026 г., 09:33

🇺🇸#PEPE/USDT is attempting to rebound from the lowerborder of the fallingwedge pattern on the 3D chart👨‍💻 Bullish case🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27420 · 27.10.2025 г., 08:48

🇺🇸#PEPE/USDT is testing the supportzone on the 2D timeframe👀 Strong upside potential on a bounce📈 American Crypto©

Hashtags

Coin Signals

@coin_signals · Post #16524 · 15.04.2025 г., 09:23

#PEPE/USDT has printed a double bottom and is trying to flip the 50 EMA Target: 200 EMA. 0.00750 -> 0.001100

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #9196 · 11.04.2026 г., 18:56

#PEPE https://www.binance.com/en/trade/PEPE_USDT Buying Zone 350-370 Sell 🤑 400-420 🤑 420-460 🤑 460-500 🤑 500-550 🚀 550 -600 & above Currently facing R if broken x2 we can expect Bullish above 330🔼 Death zone below 330🔽

Hashtags

123•••89
ПретходнаСтраница 1 од 9Следна