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

Резултати

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

Пребарај: #mina

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

@CoinSonar · Post #243985 · 18.04.2026 г., 05:37

#MINA | Volume spike (USDT PAIR) 179 times the average volume 95.80K USDT traded in 1 min └Selling vol: 74.32K USDT 🔴 Boost score: 1/10 24h Vol: 768.66K USDT (Binance) Price: 0.0608 (-1.4% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28567 · 21.03.2025 г., 15:57

#MINA/USDT analysis : #MINA is currently in a downtrend, trading below the 200 EMA. The price is currently testing the resistance zone and showing bearish sentiments. It is anticipated to decline from there and test the swing low levels. TF : 2h Entry : $0.2585 Target : $0.2425 / $0.2253 SL : $0.2782

Hashtags

Pro Analysis

@proanalysistrader · Post #27983 · 04.10.2024 г., 11:39

#MINA/USDT analysis : #MINA has recently broken support levels. The price is likely to retest the zone and continue its bearish momentum. Previous lows will be tested. TF : 4H Entry : $0.5301 Target : $0.4415 SL : $0.5905

Hashtags

American Crypto©

@americancryptotrading · Post #27622 · 16.05.2026 г., 09:30

🇺🇸#MINA/USDT is rebounding from the lowerboundary of the descendingchannel on the weekly timeframe👨‍💻 Looking for a bounce📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27558 · 15.03.2026 г., 10:18

🇺🇸#MINA/USDT is attempting to bounce from the lowerborder of the descendingchannel pattern on the weekly timeframe💁‍♂️ Pressure is building🚀 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27502 · 14.01.2026 г., 11:05

🇺🇸#MINA/USDT is bouncing from the lowerborder of the descendingchannel formation on the weekly timeframe🔍 Full send🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27428 · 04.11.2025 г., 09:58

🇺🇸#MINA/USDT is currently shaping the descending channel on the weekly chart💁‍♂️ Looks bullish📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27241 · 07.05.2025 г., 10:31

🇺🇸#MINA/USDT is facing the lowerboundary of the fallingwedge on the weekly timeframe💁‍♂️ Looks good for the mid-term🐃 American Crypto©

Hashtags

Free Crypto Signals (Profitable Zone)

@btctradingclub · Post #26274 · 06.11.2025 г., 18:40

✅✅ 61% Profit on #MINA/USDT for our Premium Members on Binance Futures/Bybit/OKX & KuCoin 🔥🔥 All target completed 👁‍🗨Contact @primemod to enter the Premium Binance Futures/Bybit/Kucoin/OKX & SPOT Group for daily gains

Hashtags

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