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

Резултати

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

Пребарај: #gtc

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

@CoinSonar · Post #244021 · 18.04.2026 г., 07:04

#GTC | Volume spike (USDT PAIR) 130 times the average volume 142.91K USDT traded in 15 min └Selling vol: 77.96K USDT 🔴 Boost score: 1/10 24h Vol: 104.82K USDT (Binance) Price: 0.100 (+1.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243969 · 18.04.2026 г., 04:49

#GTC | Volume spike (USDT PAIR) 296 times the average volume 107.93K USDT traded in 5 min └Buying vol: 61.28K USDT 🟢 Boost score: 4/10 24h Vol: 104.82K USDT (Binance) Price: 0.101 (+1.2% in 24h)

Hashtags

Coin Sonar

@CoinSonar · Post #243612 · 17.04.2026 г., 11:25

#GTC | Volume spike (USDT PAIR) 118 times the average volume 129.07K USDT traded in 15 min └Buying vol: 74.15K USDT 🟢 Boost score: 4/10 24h Vol: 104.82K USDT (Binance) Price: 0.099 (+1.2% in 24h)

Hashtags

Pro Analysis

@proanalysistrader · Post #28458 · 08.02.2025 г., 15:30

#GTC/USDT analysis : #GTC is currently retracing towards the 200 EMA, creating a potential long opportunity on lower time frames (LTF). The price has bounced back from the support zone and is anticipated to test higher levels. TF : 2h Entry : $0.418 Target : $0.469 SL : $0.385

Hashtags

Pro Analysis

@proanalysistrader · Post #28399 · 18.01.2025 г., 18:25

#GTC/USDT analysis : #GTC is currently in a downtrend, marked by a series of lower lows (LLs) and lower highs (LHs). The price is trading within a resistance zone, encountering significant resistance. Consequently, a continuation of the decline is anticipated from this level, with the price likely to test lower levels in the near future. TF : 4H Entry : $0.658 Target : $0.560 SL : $0.722

Hashtags

Pro Analysis

@proanalysistrader · Post #28075 · 27.10.2024 г., 12:23

#GTC/USDT analysis : #GTC has broken below support levels. The price is expected to continue falling and test lower levels, as the higher time frame (HTF) is bearish. Wait for the price to retest the zone before entering a short position. TF : 4h Entry : $0.644 Target : $0.596 SL : $0.678

Hashtags

Mexc Crypto Signals Pumps Trading Kucoin

@mexc_signals_pumps_trading · Post #1029 · 09.05.2024 г., 21:20

#GTC/USDT UPDATE: #GTC is now trading around 1.27$. #GTC has broken out a Inverse Head and shoulder pattern on hourly time frame. So the Possible scenario is According to the pattern, we can see short term bullish momentum in it and we can see the price pump 15-20%. Stay tuned with us for further updates✔️

Hashtags

Alex Kowalski | Trade

@kowalskitrade · Post #648 · 22.08.2024 г., 18:08

#GTC The coin looks very good, there is buying, there is reaction from the zones, waiting for further markup of the asset to cover the upper weekly imbalance 📈Sign up on Bybit to trade with me

Hashtags

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