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

Резултати

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

Пребарај: #dusk

当前筛选 #dusk清除筛选
Pro Analysis

@proanalysistrader · Post #28530 · 10.03.2025 г., 16:34

#DUSK/USDT analysis : #Dusk is currently in a downtrend and making new lows. The price has broken below support and is anticipated to resume bearish momentum and test lower levels. Wait for a retest of the broken support for a short entry opportunity. TF : 1D Entry : $0.1062 Target : $0.0730 SL : $0.1280

Hashtags

Pro Analysis

@proanalysistrader · Post #28133 · 07.11.2024 г., 16:45

#DUSK/USDT analysis : #DUSK is currently attempting to break through the trendline and rise higher to test the previous swing high. The price has formed a double bottom pattern within the support zone, which further indicates the potential for upcoming bullish momentum. It is advisable to wait for the price to break the trendline before considering a long entry. TF : 1D Entry : $0.1910 Target : $0.2520 SL : $0.1508

Hashtags

Crypto Headlines

@market_headlines · Post #27923 · 24.03.2026 г., 10:34

😳#DUSK +60% за 3 дня! Dusk — Layer-1 блокчейн с Zero-Knowledge proofs (ZK-SNARKs) для полной приватности транзакций и смарт-контрактов. Поддерживает конфиденциальную токенизацию реальных активов (RWA), DeFi и торговлю с встроенной регуляторной совместимостью (MiFID II, MiCA). Токен доступен: MEXC Crypto Headlines

Hashtags

Pro Analysis

@proanalysistrader · Post #27895 · 01.09.2024 г., 11:11

#DUSK/USDT analysis : #DUSK is currently consolidating within a channel. The broader trend on larger timeframes suggests a bearish outlook, indicating a possible breakout from the channel to further descend towards lower price levels. It is recommended to await a breakout from the channel and a drop below the $0.1932 level before considering entering a short position. TF : 4H Entry : $0.1932 Target : $0.1508 SL : $0.2195

Hashtags

American Crypto©

@americancryptotrading · Post #27070 · 02.12.2024 г., 16:46

🇺🇸#DUSK/USDT showing descending resistance breakout on 3-day timeframe🧐 Bullish case✈️ American Crypto©

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26771 · 14.01.2026 г., 12:43

🚀🚀 20% Profit on #DUSK/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

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26285 · 08.11.2025 г., 09:58

🚀🚀 525%+ Huge Profit on #DUSK/USDT as it has hit all the profit target with great easiness - The trade has been closed today 👁‍🗨Contact @primemod to enter the premium group & make daily gains

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26282 · 07.11.2025 г., 15:08

🚀🚀 590%+ Huge Profit on #DUSK/USDT as it has hit all the profit target with great easiness - The trade has been closed today 👁‍🗨Contact @primemod to enter the premium group & make daily gains

Hashtags

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