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

Резултати

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

Пребарај: #lighter

当前筛选 #lighter清除筛选
Home decor

@dzdigital3 · Post #18755 · 02.08.2025 г., 17:58

ZORRO Retro Kerosene #Lighter Oil Gasoline Wood Metal Lighter Grinding Wheel Brass Core Cigarette Lighter Gadget Collection Gift Price 8€ Place your order https://s.click.aliexpress.com/e/_EQLGVTn A new application. Write any text that comes to your mind and it will turn it into a wonderful video. Use it to invade social media sites. Get for free 👇 https://bit.ly/4icsgMi

Hashtags

Coin Signals

@coin_signals · Post #17288 · 15.01.2026 г., 17:55

🥇 Gold on Lighter closely mirrors Gold Spot/FX, making #Lighter one of the best places to trade gold. Plus Zero Trading Fees : https://app.lighter.xyz/?referral=ONLYDEX

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4994 · 13.01.2026 г., 05:30

Despite $LIT continuing to drop, a whale has deposited $10M $USDC into #Lighter and is hedging on it. The whale opened a $LIT short position with 5x leverage and spent $2.2M to buy 1.059M $LIT at $2.08 on spot and still holds $2.788M $USDC and is likely to buy more. https://app.lighter.xyz/explorer/accounts/0x2261207edc313bBFe96ddb98618b87919b9F1AeF https://x.com/OnchainLens/status/2010947308557660544 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4926 · 07.01.2026 г., 06:31

A 7-day-old wallet deposited $2M $USDC into #Lighter to increase its LIT size. In the past 7 days, the whale deposited $4M $USDC and bought 1,285,010 $LIT for $3.8M at a price of $2.96 and still has $193,717 $USDC left to buy more. https://app.lighter.xyz/explorer/accounts/0x0b4a2c0757cDfDF88039baa6bE9A4677560105B1 https://x.com/OnchainLens/status/2008788217492107762 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4901 · 05.01.2026 г., 16:22

A whale sold 52.1 $WBTC ($4.86M), deposited $3.36M $USDC into #Lighter, and bought 1,119,001 $LIT at a price of $3. https://app.lighter.xyz/explorer/accounts/0x793918C6f668E5C4283a0FD64d57046588a10b5a https://x.com/OnchainLens/status/2008212416006680740 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4899 · 05.01.2026 г., 15:45

A newly created wallet deposited $2.89M $USDC into #Lighter and bought 991,458 $LIT at a price of $2.92. Address: 0x51bec3e10335c687eedf2db7d532c2d9769df201 https://x.com/OnchainLens/status/2008203056740225183 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4866 · 03.01.2026 г., 08:38

Jez (@izebel_eth) deposited $908,412 $USDC into #Lighter to buy more $LIT. Currently, Jez holds 1,109,196 $LIT, valued at $2.8M, in 2 of the wallets. https://app.lighter.xyz/explorer/accounts/0xf78310Ed6641e6c4E221E9d676440aC8645d3afE https://app.lighter.xyz/explorer/accounts/0xaa7577a7A27aa7FcF6d0eC481B87Df3aD0F6a88E https://x.com/OnchainLens/status/2007370788966674808 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4852 · 02.01.2026 г., 00:54

A whale deposited $4.03M $USDC into #Lighter and spent $3.8M to buy 1.63M $LIT at a price of $2.33. The wallet still holds 227,099 $USDC, likely to buy more. https://app.lighter.xyz/explorer/accounts/0xFb94D3404c1d3D9D6F08f79e58041d5EA95AccfA https://x…

Hashtags

Onchain Lens Channel

@OnchainLens · Post #4841 · 31.12.2025 г., 01:59

A whale deposited $4.03M $USDC into #Lighter and spent $3.8M to buy 1.63M $LIT at a price of $2.33. The wallet still holds 227,099 $USDC, likely to buy more. https://app.lighter.xyz/explorer/accounts/0xFb94D3404c1d3D9D6F08f79e58041d5EA95AccfA https://x.com/OnchainLens/status/2006183303637000315 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #6151 · 07.04.2026 г., 02:39

Since Telegram announced #Lighter integration in its app, a #Hyperliquid whale didn’t wait. He dumped 12.2K $HYPE ($449.1K), placed another 10.4K $HYPE ($386K) as a sell order, and withdrew $1.26M $USDC today. Notably, he had already closed his multi-million dollar $HYPE longs right after the April 3 announcement. Lifetime PnL: $1.72M+ Does he know something we don’t, or is this just another wrong FOMO trade? https://app.coinmarketman.com/hypertracker/wallet/0x89abe626dc7f010138bc08e0100f1e4e13c30d32 https://x.com/OnchainLens/status/2041344975301190049 Follow @onchainlens for more onchain updates

Onchain Lens Channel

@OnchainLens · Post #5196 · 28.01.2026 г., 04:20

A whale named "Einstein" on Debank withdrew $3M $USDC from #Lighter, deposited it into #HyperLiquid, and bought 90,780 $HYPE at $33.05. https://app.coinmarketman.com/hypertracker/wallet/0xc7Bfd896cc6A8BF1D09486Dd08f590691b20C2Ff https://x.com/OnchainLens/status/2016365523882356870 Follow @onchainlens for more onchain updates

Onchain Lens Channel

@OnchainLens · Post #4801 · 28.12.2025 г., 23:56

A whale deposited $1.8M $USDC into #HyperLiquid and opened a $LIT long position with 3x leverage. The whale also holds a $BTC short position on #Lighter, with 50x leverage valued at over $17M. https://app.coinmarketman.com/hypertracker/wallet/0xA71d664F7899Dbe4aC768C1b162c4c5610e978AA https://x.com/OnchainLens/status/2005427685103931676 Follow @onchainlens for more onchain updates.

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