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

Резултати

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

Пребарај: #axs

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

@CoinSonar · Post #244244 · 18.04.2026 г., 15:22

#AXS | Volume spike (USDT PAIR) 12 times the average volume 166.56K USDT traded in 15 min └Buying vol: 123.61K USDT 🟢 Boost score: 3/10 24h Vol: 1.28M USDT (Binance) Price: 1.154 (-2.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #244048 · 18.04.2026 г., 07:50

#AXS | Volume spike (USDT PAIR) 182 times the average volume 162.93K USDT traded in 1 min └Selling vol: 126.26K USDT 🔴 Boost score: 1/10 24h Vol: 1.28M USDT (Binance) Price: 1.217 (-2.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243675 · 17.04.2026 г., 13:27

#AXS | Volume spike (USDT PAIR) 9 times the average volume 130.07K USDT traded in 15 min └Buying vol: 71.08K USDT 🟢 Boost score: 5/10 24h Vol: 1.28M USDT (Binance) Price: 1.207 (-2.2% in 24h)

Hashtags

🚀🚀 Another massive profit made in Premium Group and this time it is#AXS/USDT which crossed All the Profit Targets for an humongous gain of 99% 🗨Contact @futurechief to enter the Binance Futures/Bybit/Kucoin/OKX Premium Signal Group & Receive daily high quality signals by being in the Premium Group

Hashtags

Pro Analysis

@proanalysistrader · Post #28467 · 12.02.2025 г., 17:04

#AXS/USDT analysis : #AXS is retracing towards the 200 EMA and is expected to retest this level before continuing its bearish momentum. The current level presents a favorable opportunity for a long entry, with the swing high resistance level identified as the target. TF : 4H Entry : $4.444 Target : $4.990 SL : $4.160

Hashtags

American Crypto©

@americancryptotrading · Post #27228 · 24.04.2025 г., 10:51

🇺🇸#AXS/USDT is currently heading towards the descendingresistance line on the daily timeframe💁‍♂️ A strong upward impulse is likely🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27039 · 04.11.2024 г., 18:14

🇺🇸#AXS/USDT is forming the descendingtriangle on weekly timeframe🧐 Bullish case🚀 American Crypto©

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26804 · 19.01.2026 г., 22:11

🚀🚀 315% Profit on #AXS/USDT for our Premium Members on Binance Futures/Bybit/OKXX/Kucoin/Bitget ✅✅ All target completed 👁‍🗨Contact @primemod to enter the Premium Group for high quality SPOT & FUTURES Signals

Hashtags

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