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 слични објави

Пребарај: #lunc

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

@CoinSonar · Post #244153 · 18.04.2026 г., 11:43

#LUNC | Volume spike (USDT PAIR) 11 times the average volume 129.28K USDT traded in 15 min └Selling vol: 73.28K USDT 🔴 Boost score: 1/10 24h Vol: 1.11M USDT (Binance) Price: 0.00004490 (-2.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243490 · 17.04.2026 г., 06:58

#LUNC | Volume spike (USDT PAIR) 11 times the average volume 128.29K USDT traded in 15 min └Buying vol: 78.27K USDT 🟢 Boost score: 2/10 24h Vol: 1.11M USDT (Binance) Price: 0.00004701 (-2.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243425 · 17.04.2026 г., 02:57

#LUNC | Volume spike (USDT PAIR) 11 times the average volume 134.15K USDT traded in 15 min └Buying vol: 91.78K USDT 🟢 Boost score: 4/10 24h Vol: 1.11M USDT (Binance) Price: 0.00004822 (-2.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243375 · 17.04.2026 г., 00:27

#LUNC | Volume spike (USDT PAIR) 11 times the average volume 128.76K USDT traded in 15 min └Buying vol: 74.52K USDT 🟢 Boost score: 5/10 24h Vol: 1.11M USDT (Binance) Price: 0.00004581 (-2.7% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243326 · 16.04.2026 г., 21:21

#LUNC | Volume spike (USDT PAIR) 11 times the average volume 129.32K USDT traded in 15 min └Selling vol: 68.96K USDT 🔴 Boost score: 1/10 24h Vol: 1.11M USDT (Binance) Price: 0.00004451 (-2.7% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28119 · 04.11.2024 г., 14:23

#LUNC/USDT analysis : #LUNC is currently in a downtrend, forming lower lows (LLs) and lower highs (LHs) below the 200 EMA. The price has retraced to the 200 EMA and the resistance zone. It is anticipated that the price will continue its bearish momentum and test lower levels. TF : 1D Entry : $0.00008532 Target : $0.00006396 SL : $0.00011356

Hashtags

Pro Analysis

@proanalysistrader · Post #27917 · 08.09.2024 г., 15:02

#LUNC/USDT analysis : #LUNC is presently in a downtrend, trading below the 200 EMA. The price is facing resistance in the current zone, suggesting a possible reversal point. It is expected that the price will reverse from this resistance area and continue its bearish path, potentially revisiting previous low levels. TF : 2h Entry : $0.0000765 Target : $0.0000713 SL : $0.0000788

Hashtags

Pro Analysis

@proanalysistrader · Post #27904 · 05.09.2024 г., 05:26

#LUNC/USDT analysis : #LUNC is currently experiencing a downtrend, trading below the 200 Exponential Moving Average (EMA). The price is encountering resistance in the current zone, indicating a potential reversal point. It is anticipated that the price will reverse from this resistance area and persist in its bearish trajectory, likely retesting prior low levels. TF : 30min Entry : $0.0000764 Target : $0.0000716 SL : $0.0000793

Hashtags

Pro Analysis

@proanalysistrader · Post #27883 · 29.08.2024 г., 04:17

#LUNC/USDT analysis : #LUNC has experienced a breakout followed by a retest of the resistance zone, which has now transformed into a support zone. It is anticipated that the price will receive support at this level, leading to a potential upward movement to sustain its bullish trend and challenge the previous peak. TF : 4h Entry : $0.0000835 Target : $0.0000948 SL : $0.0000785

Hashtags

Crypto

@signal_bitcoins · Post #2661 · 05.02.2024 г., 10:45

💰#LUNC reached -Order block zone on Daily Time frame,we need breakup from this area to continue the pump and reach the target price zone (0.0005) otherwise will have a correction until the + order block (the Green zone)✅ ❄️@signals_bitcoin_crypto❄️ ❄️@Shadow_support0o❄️

Hashtags

Crypto

@signal_bitcoins · Post #2329 · 14.01.2024 г., 12:30

💰#LUNC broken up the falling wedge pattern on 12H Time frame,also pullback confirmed,we can buy some lunc here🐋 ❄️@signals_bitcoin_crypto❄️ ❄️@Shadow_support0o❄️

Hashtags

Crypto

@signal_bitcoins · Post #1899 · 18.12.2023 г., 07:44

💰#LUNC rejected from the Trendline on 4H Time frame,we are waiting to see the price reaction to the Support zone..⏳ ❄️@signals_bitcoin_crypto❄️ ❄️@Shadow_support0o❄️

Hashtags

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