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

Резултати

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

Пребарај: #sys

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

@proanalysistrader · Post #28564 · 20.03.2025 г., 14:07

#SYS/USDT analysis : The #SYS is currently in a downtrend, trading below the 200EMA. The price is testing resistance at the current level, and it's expected to decline further from there, potentially testing lower price levels. TF : 2h Entry : $0.0487 Target : $0.0410 SL : $0.0522

Hashtags

Pro Analysis

@proanalysistrader · Post #28452 · 05.02.2025 г., 15:07

#SYS/USDT analysis : #SYS is currently in a correction phase, experiencing a retracement toward the 200 EMA. This presents a potential long trade opportunity on lower time frame. Look for price to retrace and test the support zone for a long entry. TF : 30min Entry : $0.0676 Target : $0.0735 SL : $0.0644

Hashtags

Pro Analysis

@proanalysistrader · Post #28091 · 30.10.2024 г., 05:25

#SYS/USDT analysis : #SYS is currently consolidating sideways within the support zone and is expected to rebound from this level, potentially testing previous highs. It is advisable to wait for a pullback to establish a long position. TF : 1D Entry : $0.0964 Target : $0.1257 SL : $0.0822

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #9176 · 16.01.2026 г., 17:01

#SYS👈 https://www.binance.com/en/trade/SYS_BTC Buying rate 21-23 👀sitting near bottom Sell 🤑 29 🤑 32 🤑 35 🚀 40 & above Bullish above 20 🔼 Death Zone below 19 🔽

Hashtags

Crypto Profit Coach™

@cryptoprofitcoach · Post #9151 · 08.07.2025 г., 17:45

#SYS👈 https://www.binance.com/en/trade/SYS_BTC Buying rate 31-33 👀sitting near bottom Sell 🤑 36 🤑 36-39 🤑 39-42 🚀 42-50 & above Bullish above 29 🔼 Death Zone below 29🔽 Powered by @cryptoProfitCoach

Hashtags

Fed. Russian Insiders ®

@FedRussianInsidersVip4Free · Post #6763 · 25.10.2025 г., 14:14

BUYING $SYS HERE Exchange: Binance / Binance Futures Leverage: 3-5x Breakout confirmed. Market conditions are perfect for an easy 100-200% move on #SYS Targets: OPEN SL: Below 0.0254

Hashtags

Fed. Russian Insiders ®

@FedRussianInsidersVip4Free · Post #6715 · 13.10.2025 г., 12:01

LONGING $SYS HERE Exchange: Binance / Binance Futures Leverage: 5x Breakout confirmed after bottoming out. #SYS is ready to reach new highs, easy 3-5x move🐋 Targets: 0.048 - 0.052 - 0.060 - 0.074 - 0.092 - 0.110 - 0.132 - 0.151 - OPEN SL: Below 0.031

Hashtags

Binance Big Pump Signals Future trade

@binancebigpumpsignalsfuture · Post #2080 · 26.02.2022 г., 19:17

#SYS result 2 nd target achieved in just 11 hours ✅✅ One more huge quick profit 17% +🤑💰🤑 👉 Still thinking? The more you wait more you lose profit ☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal

Hashtags

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