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

Резултати

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

Пребарај: #lrc

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

@proanalysistrader · Post #28420 · 26.01.2025 г., 10:58

#LRC/USDT analysis : #LRC has retraced to the previous resistance zone, which is now acting as support for the price. From this level, bullish momentum is expected, with the previous swing high serving as the target level for upward movement. TF : 1D Entry : $0.1700 Target : $0.3338 SL : $0.1300

Hashtags

Pro Analysis

@proanalysistrader · Post #27721 · 02.07.2024 г., 05:30

#LRC/USDT analysis - #LRC is currently experiencing a downtrend and is trading below the 200-day Exponential Moving Average (EMA). The price is undergoing a pullback and is anticipated to test the resistance zone close to the 200 EMA shortly before potentially declining further to retest the previous lows. TF : 4h Entry : $0.1890 Target : $0.1601 SL : $0.1994

Hashtags

American Crypto©

@americancryptotrading · Post #27612 · 07.05.2026 г., 08:28

🇺🇸#LRC/USDT is consolidating near the lowerborder of the descendingchannel on the weekly timeframe🧐 A pump is expected if we bounce📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27584 · 10.04.2026 г., 09:22

🇺🇸#LRC/USDT has found support at the lowerborder of the descendingchannel formation on the weekly timeframe🔍 Further upside possible after bounce🐃 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27156 · 16.02.2025 г., 17:21

🇺🇸#LRC/USDT is bouncing from the lowerborder of the fallingwedge on the weekly timeframe🔍 Send it📈 American Crypto©

Hashtags

American Crypto©

@americancryptotrading · Post #27110 · 05.01.2025 г., 17:51

🇺🇸#LRC/USDT has formed the descendingresistance line on the weekly chart👨‍💻 Looks good for the mid-term📈 American Crypto©

Hashtags

Binance crypto champions

@binancecryptochampions · Post #2942 · 11.12.2025 г., 07:06

✴️Free signal-Futures ✴️ ⚡️⚡️#LRC/USDT⚡️⚡️ Signal Type: Regular (Long) Leverage: Cross (20x) Margin: 2.0% Entry Targets: 1) 0.05500 2) 0.05900 Take-Profit Targets: 1) 0.06200 2) 0.06300 3) 0.06500 Stop Targets: 1) 0.05300 🍁 Published by: @Trading_exp🍁 Join_vip: @Crypto_Futures_Spot_Payment_bot

Hashtags

Crypto

@signal_bitcoins · Post #2813 · 15.02.2024 г., 08:55

#LRC has a symmetrical triangle pattern on Daily time frame,in the case of breakup we will see another huge pump again 🚀 ❄️@signals_bitcoin_crypto❄️ ❄️@Shadow_support0o❄️

Hashtags

Crypto

@signal_bitcoins · Post #2136 · 02.01.2024 г., 10:34

#LRC bounced back from the Demand zone also touched the curve on Weekly time frame,we need a bullish momentum to breakup this pattern 🚀 ❄️@signals_bitcoin_crypto❄️ ❄️@Shadow_support0o❄️

Hashtags

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