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

Резултати

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

Пребарај: #chz

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

@CoinSonar · Post #244117 · 18.04.2026 г., 10:18

#CHZ | Volume spike (USDT PAIR) 11 times the average volume 191.34K USDT traded in 15 min └Selling vol: 120.04K USDT 🔴 Boost score: 1/10 24h Vol: 1.59M USDT (Binance) Price: 0.04102 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #244067 · 18.04.2026 г., 08:18

#CHZ | Volume spike (USDT PAIR) 9 times the average volume 162.81K USDT traded in 15 min └Selling vol: 120.86K USDT 🔴 Boost score: 1/10 24h Vol: 1.59M USDT (Binance) Price: 0.04166 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243975 · 18.04.2026 г., 05:11

#CHZ | Volume spike (USDT PAIR) 12 times the average volume 201.91K USDT traded in 15 min └Selling vol: 116.59K USDT 🔴 Boost score: 1/10 24h Vol: 1.59M USDT (Binance) Price: 0.04240 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243879 · 17.04.2026 г., 23:47

#CHZ | Volume spike (USDT PAIR) 125 times the average volume 138.41K USDT traded in 1 min └Buying vol: 104.98K USDT 🟢 Boost score: 6/10 24h Vol: 1.59M USDT (Binance) Price: 0.04164 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243671 · 17.04.2026 г., 13:24

#CHZ | Volume spike (USDT PAIR) 9 times the average volume 162.70K USDT traded in 15 min └Buying vol: 84.01K USDT 🟢 Boost score: 3/10 24h Vol: 1.59M USDT (Binance) Price: 0.04200 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243484 · 17.04.2026 г., 06:43

#CHZ | Volume spike (USDT PAIR) 10 times the average volume 176.92K USDT traded in 15 min └Selling vol: 118.25K USDT 🔴 Boost score: 1/10 24h Vol: 1.59M USDT (Binance) Price: 0.04026 (-1.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243440 · 17.04.2026 г., 04:07

#CHZ | Volume spike (USDT PAIR) 9 times the average volume 160.91K USDT traded in 15 min └Selling vol: 92.38K USDT 🔴 Boost score: 1/10 24h Vol: 1.59M USDT (Binance) Price: 0.04136 (-1.7% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28528 · 10.03.2025 г., 13:11

#CHZ/USDT analysis : #CHZ is currently in a downtrend and making new lows. Look for a price retracement to test the resistance zone for a short entry opportunity. Lower levels will be the target level. TF : 2H Entry : $0.04862 Target : $0.04200 SL : $0.05193

Hashtags

Pro Analysis

@proanalysistrader · Post #27931 · 14.09.2024 г., 01:39

#CHZ/USDT analysis : #CHZ is in an uptrend, trading above the 200 EMA. After the breakout of the previous swing high, the price is sustaining above it. The price is anticipated to continue its bullish momentum and rise higher. Wait for a pullback to the support zone for a long entry. TF : 2H Entry : $0.0535 Target : $0.0560 SL : $0.0519

Hashtags

American Crypto©

@americancryptotrading · Post #27616 · 11.05.2026 г., 09:28

🇺🇸#CHZ/USDT is about to break out from the descendingchannel on the 2W chart🧐 Breakout is knocking on the door🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27566 · 23.03.2026 г., 10:41

🇺🇸#CHZ/USDT is currently consolidating within the fallingwedge formation on the weekly chart👨‍💻 Looking for a move up if we break out🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27481 · 26.12.2025 г., 10:25

🇺🇸#CHZ/USDT is consolidating within the falling wedge formation on the 2W chart👨‍💻 A bullish trend is unfolding✈️ American Crypto©

Hashtags

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