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

Резултати

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

Пребарај: #tru

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

@CoinSonar · Post #243929 · 18.04.2026 г., 02:37

#TRU | Volume spike (USDT PAIR) 413 times the average volume 131.75K USDT traded in 5 min └Selling vol: 82.82K USDT 🔴 Boost score: 1/10 24h Vol: 91.78K USDT (Binance) Price: 0.0052 (-4.0% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243743 · 17.04.2026 г., 15:33

#TRU | Volume spike (USDT PAIR) 1565 times the average volume 99.76K USDT traded in 1 min └Selling vol: 94.10K USDT 🔴 Boost score: 1/10 24h Vol: 91.78K USDT (Binance) Price: 0.0053 (-4.0% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243554 · 17.04.2026 г., 09:00

#TRU | Volume spike (USDT PAIR) 2109 times the average volume 134.45K USDT traded in 1 min └Selling vol: 117.50K USDT 🔴 Boost score: 1/10 24h Vol: 91.78K USDT (Binance) Price: 0.0066 (-4.0% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28464 · 11.02.2025 г., 13:03

#TRU/USDT analysis : #TRU is retracing towards the 200 EMA, indicating a potential retest before continuing its bearish momentum. This level offers a good opportunity for a long entry. TF : 2h Entry : $0.0460 Target : $0.0520 SL : $0.0420

Hashtags

Pro Analysis

@proanalysistrader · Post #28409 · 22.01.2025 г., 14:12

#TRU/USDT analysis : #TRU is currently in a downtrend and is expected to maintain its bearish momentum, potentially testing lower price levels. TF : 1H Entry : $0.0713 Target : $0.0606 SL : $0.0782

Hashtags

American Crypto©

@americancryptotrading · Post #27195 · 24.03.2025 г., 14:08

🇺🇸#TRU/USDT is maintaining position above the supportzone on the 3D timeframe👀 Looking for a leg upwards🐃 American Crypto©

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26645 · 27.12.2025 г., 12:57

✅✅ 55% Profit on #TRU/USDT for our Premium Members on On Binance Futures, Bitget Futures, ByBit USDT, KuCoin Futures, OKX Futures 👆🏻All Profit Targets Successfully Completed 👁‍🗨Contact @primemod to enter the most powerful premium group & make daily gains

Hashtags

Crypto Angels

@cryptoangelsusa · Post #22174 · 28.12.2025 г., 08:16

Binance Futures, BingX Futures, Bitget Futures, BloFin Futures #TRU/USDT All take-profit targets achieved 😎 Profit: 200.7463% 📈 Period: 14 Hours 15 Minutes ⏰

Hashtags

Coinlegs Cryptocurrency Signals

@coinlegs · Post #10148 · 29.03.2024 г., 17:59

#TRU +143% 🤑💸💰 CoinLegs' unique algorithms give you invaluable insights into the market. Alerts, AI, Algotrade, Algorithms and much more at CoinLegs platform. Now is the time to earn! www.coinlegs.com

Hashtags

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