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

Резултати

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

Пребарај: #xvg

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

@CoinSonar · Post #244049 · 18.04.2026 г., 07:51

#XVG | Volume spike (USDT PAIR) 33 times the average volume 142.43K USDT traded in 15 min └Buying vol: 76.33K USDT 🟢 Boost score: 3/10 24h Vol: 413.88K USDT (Binance) Price: 0.003619 (-1.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243525 · 17.04.2026 г., 08:04

#XVG | Volume spike (USDT PAIR) 53 times the average volume 230.22K USDT traded in 15 min └Buying vol: 121.61K USDT 🟢 Boost score: 2/10 24h Vol: 413.88K USDT (Binance) Price: 0.003663 (-1.9% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243470 · 17.04.2026 г., 06:03

#XVG | Volume spike (USDT PAIR) 75 times the average volume 108.01K USDT traded in 5 min └Buying vol: 73.65K USDT 🟢 Boost score: 4/10 24h Vol: 413.88K USDT (Binance) Price: 0.004461 (-1.9% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28510 · 02.03.2025 г., 11:59

#XVG/USDT analysis : #XVG is currently consolidating sideways. The price has tested and held support. A rebound from this support level is anticipated, with the target being the resistance level. TF : 4h Entry : $0.005600 Target : $0.007415 SL : $0.004360

Hashtags

American Crypto©

@americancryptotrading · Post #27592 · 18.04.2026 г., 09:42

🇺🇸#XVG/USDT is attempting to rebound from the supportzone on the 3D chart🔍 Recovery is on the way🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27425 · 01.11.2025 г., 09:59

🇺🇸#XVG/USDT has shaped the symmetricaltriangle on the weekly chart👨‍💻 A pump is expected if we break out🐃 American Crypto©

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26670 · 31.12.2025 г., 21:23

✅✅ 27% Profit on #XVG/USDT for our Premium Members on Binance Futures, ByBit USDT, KuCoin Futures, OKX Futures 👁‍🗨Contact @primemod to enter the Premium Group & make daily profit on SPOT & FUTURES Signals

Hashtags

Binance crypto champions

@binancecryptochampions · Post #2865 · 10.11.2025 г., 10:43

✴️Free signal-Futures ✴️ ⚡️⚡️#XVG/USDT⚡️⚡️ Signal Type: Regular (Long) Leverage: Cross (20x) Margin: 2.0% Entry Targets: 1) 6870 2) 7540 Take-Profit Targets: 1) 7900 2) 8100 3) 8500 Stop Targets: 1) 6530 🍁 Published by: @Trading_exp🍁 Join_vip: @Crypto_Futures_Spot_Payment_bot

Hashtags

Crypto

@signal_bitcoins · Post #2838 · 16.02.2024 г., 12:32

#XVG bounced back from the bottom of the trading range on 2D Time frame,now we are waiting for breakout 🚀 ❄️@signal_bitcoins❄️ ❄️@Shadow_support0o❄️

Hashtags

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