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

Резултати

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

Пребарај: #glmr

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

@CoinSonar · Post #243980 · 18.04.2026 г., 05:29

#GLMR | Volume spike (USDT PAIR) 1111 times the average volume 110.59K USDT traded in 1 min └Selling vol: 76.35K USDT 🔴 Boost score: 1/10 24h Vol: 143.27K USDT (Binance) Price: 0.0152 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243931 · 18.04.2026 г., 02:39

#GLMR | Volume spike (USDT PAIR) 90 times the average volume 134.84K USDT traded in 15 min └Buying vol: 71.39K USDT 🟢 Boost score: 4/10 24h Vol: 143.27K USDT (Binance) Price: 0.0168 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243800 · 17.04.2026 г., 18:00

#GLMR | Volume spike (USDT PAIR) 86 times the average volume 128.45K USDT traded in 15 min └Buying vol: 84.37K USDT 🟢 Boost score: 4/10 24h Vol: 143.27K USDT (Binance) Price: 0.0188 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243697 · 17.04.2026 г., 13:45

#GLMR | Volume spike (USDT PAIR) 86 times the average volume 128.61K USDT traded in 15 min └Buying vol: 66.91K USDT 🟢 Boost score: 5/10 24h Vol: 143.27K USDT (Binance) Price: 0.0193 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243618 · 17.04.2026 г., 11:34

#GLMR | Volume spike (USDT PAIR) 88 times the average volume 132.56K USDT traded in 15 min └Buying vol: 66.84K USDT 🟢 Boost score: 3/10 24h Vol: 143.27K USDT (Binance) Price: 0.0186 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243574 · 17.04.2026 г., 09:34

#GLMR | Volume spike (USDT PAIR) 343 times the average volume 171.02K USDT traded in 5 min └Selling vol: 86.60K USDT 🔴 Boost score: 1/10 24h Vol: 143.27K USDT (Binance) Price: 0.0216 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243505 · 17.04.2026 г., 07:34

#GLMR | Volume spike (USDT PAIR) 504 times the average volume 251.15K USDT traded in 5 min └Selling vol: 143.39K USDT 🔴 Boost score: 1/10 24h Vol: 143.27K USDT (Binance) Price: 0.0181 (-0.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243459 · 17.04.2026 г., 05:34

#GLMR | Volume spike (USDT PAIR) 220 times the average volume 109.66K USDT traded in 5 min └Buying vol: 82.90K USDT 🟢 Boost score: 6/10 24h Vol: 143.27K USDT (Binance) Price: 0.0127 (-0.9% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28498 · 25.02.2025 г., 15:02

#GLMR/USDT analysis : #GLMR is in downtrend trading below 200ema. Price has broken down below support zone it is expected to continue declining. For short entry wait for the price to test the resistance zone. TF : 2h Entry : $0.1186 Target : $0.0940 SL : $0.1332

Hashtags

Pro Analysis

@proanalysistrader · Post #27905 · 05.09.2024 г., 12:58

#GLMR/USDT analysis : #GLMR has broken below the 200 EMA and is currently consolidating sideways near the 200 EMA. The price is expected to reverse from there and continue its bearish momentum to test the previous swing low. TF : 1h Entry : $0.1547 Target : $0.1415 SL : $0.1635

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #8947 · 26.12.2023 г., 00:31

#GLMR👈 Call given here Hit 1474 All Target done ✅ 142% safe profit in spot If you invested 1 btc it's now 2.42 btc now 🤑🤑 Signal before pump @ low level Always trade with us for max profit 😊🤑💃Chk pinned to join👀 We are best pump tracker 🤑

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #8909 · 05.11.2023 г., 01:16

#GLMR👈 https://www.binance.com/en/trade/GLMR_BTC Buying Zone 610-630 Coin on the brink of 🚀 Buy in parts 👈strictly follow for max profits as its 🚀 Sell 🤑 660-700 🤑 700-750 🤑 750-800 🚀 800- 750 & above Bullish above -600

Hashtags

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