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

Резултати

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

Пребарај: #dash

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

@CoinSonar · Post #244150 · 18.04.2026 г., 11:39

#DASH | Volume spike (USDT PAIR) 63 times the average volume 131.74K USDT traded in 1 min └Selling vol: 89.64K USDT 🔴 Boost score: 1/10 24h Vol: 3.01M USDT (Binance) Price: 35.21 (-2.6% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #244090 · 18.04.2026 г., 09:09

#DASH | Volume spike (USDT PAIR) 10 times the average volume 313.67K USDT traded in 15 min └Selling vol: 246.49K USDT 🔴 Boost score: 1/10 24h Vol: 3.01M USDT (Binance) Price: 36.32 (-2.6% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243804 · 17.04.2026 г., 18:09

#DASH | Volume spike (USDT PAIR) 72 times the average volume 152.34K USDT traded in 1 min └Selling vol: 138.78K USDT 🔴 Boost score: 1/10 24h Vol: 3.01M USDT (Binance) Price: 36.98 (-2.6% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243665 · 17.04.2026 г., 13:17

#DASH | Volume spike (USDT PAIR) 9 times the average volume 303.11K USDT traded in 15 min └Buying vol: 190.56K USDT 🟢 Boost score: 6/10 24h Vol: 3.01M USDT (Binance) Price: 37.42 (-2.6% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243403 · 17.04.2026 г., 01:38

#DASH | Volume spike (USDT PAIR) 69 times the average volume 145.21K USDT traded in 1 min └Buying vol: 144.12K USDT 🟢 Boost score: 8/10 24h Vol: 3.01M USDT (Binance) Price: 37.07 (-2.6% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243283 · 16.04.2026 г., 19:05

#DASH | Volume spike (USDT PAIR) 10 times the average volume 314.96K USDT traded in 15 min └Selling vol: 185.85K USDT 🔴 Boost score: 1/10 24h Vol: 3.01M USDT (Binance) Price: 37.65 (-2.6% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28435 · 30.01.2025 г., 15:49

#DASH/USDT analysis : #DASH has successfully broken out and retested the previously respected resistance zone. The price is expected to rebound from the current level and aim for previous swing highs. For a long entry, it is advisable to wait for a breakout above the $36.13 level. TF : 1D Entry : $36.13 Target : $65.69 SL : $29.25

Hashtags

Pro Analysis

@proanalysistrader · Post #28338 · 13.12.2024 г., 13:36

#DASH/USDT analysis : #DASH has broken out of the trendline following a bounce back from the 200 EMA. The price is anticipated to resume its bullish momentum and test previous highs. TF : 4H Entry : $48.5 Target : $71 SL : $39.8

Hashtags

American Crypto©

@americancryptotrading · Post #27521 · 01.02.2026 г., 11:13

🇺🇸#DASH/USDT is stabilizing near the broken fallingwedge formation on the weekly chart🔥 Time to rise🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27478 · 23.12.2025 г., 09:34

🇺🇸#DASH/USDT is retesting the broken s/rzone on the weekly timeframe👨‍💻 Bullish case if we bounce📈 American Crypto©

Hashtags

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