@premiumrosesignal · Post #5363 · 17.07.2025 г., 19:32
#SOPH Buy Setup Buying more now
Hashtags
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
Пребарај: #soph
@premiumrosesignal · Post #5363 · 17.07.2025 г., 19:32
#SOPH Buy Setup Buying more now
Hashtags
@premiumrosesignal · Post #5352 · 16.07.2025 г., 17:39
#SOPH Buy Setup
Hashtags
@pumpleaks · Post #1291 · 28.07.2025 г., 11:58
LONGING #SOPH NOW Exchange: Binance Futures Fully bottomed, easiest 2x of the alt season. Filling our bags at current💰 https://www.binance.com/en/futures/SOPHUSDT
Hashtags
@wallstreetgems · Post #1193 · 28.07.2025 г., 11:58
LONGING #SOPH NOW Exchange: Binance Futures Fully bottomed, easiest 2x of the alt season. Filling our bags at current💰 https://www.binance.com/en/futures/SOPHUSDT
Hashtags
@pepe_pumps_signals · Post #701 · 31.07.2025 г., 10:44
#SOPH Update (Binance Futures) Reached : $0.0458✅ Profit: 132% on just 5x lev🚀 Taking some more profits and moving stops to entries, another amazing move!🔥🔥
Hashtags
@bitcoin_ethereum_ripple · Post #698 · 31.07.2025 г., 10:44
#SOPH Update (Binance Futures) Reached : $0.0458✅ Profit: 132% on just 5x lev🚀 Taking some more profits and moving stops to entries, another amazing move!🔥🔥
Hashtags
@pepe_pumps_signals · Post #697 · 28.07.2025 г., 11:58
LONGING #SOPH NOW Exchange: Binance Futures Fully bottomed, easiest 2x of the alt season. Filling our bags at current💰 https://www.binance.com/en/futures/SOPHUSDT
Hashtags
@bitcoin_ethereum_ripple · Post #694 · 28.07.2025 г., 11:58
LONGING #SOPH NOW Exchange: Binance Futures Fully bottomed, easiest 2x of the alt season. Filling our bags at current💰 https://www.binance.com/en/futures/SOPHUSDT
Hashtags
@free_crypto_signals_pumps · Post #670 · 31.07.2025 г., 10:44
#SOPH Update (Binance Futures) Reached : $0.0458✅ Profit: 132% on just 5x lev🚀 Taking some more profits and moving stops to entries, another amazing move!🔥🔥
Hashtags
@free_crypto_signals_pumps · Post #666 · 28.07.2025 г., 11:58
LONGING #SOPH NOW Exchange: Binance Futures Fully bottomed, easiest 2x of the alt season. Filling our bags at current💰 https://www.binance.com/en/futures/SOPHUSDT
Hashtags
@cryptoarsenal · Post #62347 · 06.04.2026 г., 15:54
🎰#SOPH buying 🔫 108K USDT in 4 min (51%) on Binance P: 0,00893 ⬆️ (4,57%) Vol 24h: 316K USDT Last 8 d ago #CEXTrack
@tradeandinvest_ann · Post #602 · 18.07.2023 г., 15:26
🎙 SophiaVerse MOON SHEET announcement *INVEST REPORT project rating 10/10* ⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️ *INVEST REPORT investment rating 9/10* ⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️ *INVEST REPORT product rating 8/10* ⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️ SophiaVerse is a project that aims to bring artificial general intelligence (AGI) to the Web3 metaverse. It is a partnership between Hanson Robotics and the SingularityNet Foundation, and it uses the renowned Sophia Robot as its testbed. SophiaVerse have upcoming 2 IDO like SEEDIFY and singularitydao. Singularitydao Round 1 just started and will finish at 20TH JULY 2023 23.59 UTC. ✅About SophiaVerse Finance token metric - Token name: #SOPH - IDO price: 0,03$ - Initial price: 0,03$ - Total Supply: 1,000,000,000 $SOPH - IDO: ACTIVE ON SINGULARITYDAO ✅ Follow Project Media 1️⃣Website 2️⃣Twitter 3️⃣Discord 4️⃣Telegram #SOFH#IDO#Fundraising
Hashtags