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

Резултати

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

Пребарај: #bybit

当前筛选 #bybit清除筛选
Gong Jiao Wei 巩娇玮

@gongjiaoweiy · Post #68898 · 26.02.2026 г., 02:47

15 hours ago, Antalpha (@AntalphaGlobal) sent 1,000 $XAUT (~$5.16M) into #Bybit, likely to sell. https://intel.arkm.com/explorer/entity/antalpha https://x.com/OnchainLens/status/2026838079651328216 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5712 · 04.03.2026 г., 13:25

A newly created wallet withdrew 500 $XAUT worth $2.57M from #Bybit. Address: 0xbe9De876a5Cf802F574899A2763aE6a5D5D93CBa https://x.com/OnchainLens/status/2029186288763715651 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5634 · 26.02.2026 г., 01:54

15 hours ago, Antalpha (@AntalphaGlobal) sent 1,000 $XAUT (~$5.16M) into #Bybit, likely to sell. https://intel.arkm.com/explorer/entity/antalpha https://x.com/OnchainLens/status/2026838079651328216 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5563 · 21.02.2026 г., 01:32

13 hours ago, Antalpha (@AntalphaGlobal) sent 1,000 $XAUT (~$5M) into #Bybit, likely to sell. They still hold 59,033 $XAUT (~$300.69M). https://intel.arkm.com/explorer/entity/antalpha https://x.com/OnchainLens/status/2025020760608440597 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5283 · 02.02.2026 г., 04:49

A whale withdrew 593.98 $XAUT worth ($2.78M) from #Bybit in the past 3 days after being dormant for 8 months. Address - 0x57655B342B7bf1a1134B572e43eB62BBE56BF7CF Data - @nansen_ai https://x.com/OnchainLens/status/2018184847295218173 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5215 · 29.01.2026 г., 06:17

The newly created wallet "0x0E4" further withdrew 450 $XAUT worth ($2.51M)from #Bybit. Now the whale holds 1.25K $XAUT worth $6.98M Address - 0x0E4F3ed5B2A3dB2A2940c638418530e9f5c4927E Data - @nansen_ai https://x.com/OnchainLens/status/2016757455565574543 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5165 · 26.01.2026 г., 06:53

The whale "0x0a5" bought 602.49 $XAUT, worth $3.05M, from #Bybit. Over the past 4 days, the whale has bought 1,469.29 $XAUT, worth $7.33M, from #Bybit. https://intel.arkm.com/explorer/address/0x0a5e3968f95d5aD4Fac72E1420A2BFFeedb7cbEB https://x.com/OnchainLens/status/2015679418803552716 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5151 · 25.01.2026 г., 10:58

A wallet linked to the Pendle Team (@pendle_fi) deposited 1.8M $PENDLE, worth $3.61M, into #Bybit after holding it for 3-4 years. The wallet received these $PENDLE for $266K from the Pendle Vesting Wallet. Address: 0xf82e1E9381A1d92B5897eBe2F9B61160222f1aeb https://x.com/OnchainLens/status/2015378723818942854 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5145 · 23.01.2026 г., 12:15

A whale bought 566.80 $XAUT worth ($2.79M) from #Bybit in the past 2 days. The whale still hold $11.36M $USDT and likely to buy more. Address - 0x0a5e3968f95d5aD4Fac72E1420A2BFFeedb7cbEB Data - @nansen_ai https://x.com/OnchainLens/status/2014673139159240920 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5137 · 23.01.2026 г., 05:33

A whale deposited 665,035 $HYPE, worth $14.54M into #Bybit, making a profit of $7.04M. The whale initially bought 651,895 $HYPE for $7.5M at a price of $11.5, between Dec 3, 2024, and Dec 8, 2024, and sent it for staking. https://hyperbot.network/trader/0xffe664491482ae9db6ba9e55c2ed1ea55c700a52 https://hyperevmscan.io/address/0xffe664491482ae9db6ba9e55c2ed1ea55c700a52 https://x.com/OnchainLens/status/2014571958009250155 Follow @onchainlens for more onchain updates

Hashtags

Onchain Lens Channel

@OnchainLens · Post #5136 · 23.01.2026 г., 01:44

A wallet linked to the Pendle Team (@pendle_fi) deposited 1.8M $PENDLE, worth $3.84M, into #Bybit after holding it for 3 years. The wallet received these $PENDLE for $266K from the Pendle Vesting Wallet. Address: 0x6b4166974fcf730d7933656d26d52922ee285cf0 https://x.com/OnchainLens/status/2014514593566248989 Follow @onchainlens for more onchain updates

Hashtags

123•••10•••1920
ПретходнаСтраница 1 од 20Следна