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

Резултати

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

Пребарај: #giancarlobodoni

当前筛选 #giancarlobodoni清除筛选
bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1798 · 05.04.2025 г., 23:22

🔥NEW RELEASE🔥 😁Forging The Guard: Mastering Foundation's Of The Clamp By Giancarlo Bodoni😁 ➡️Unlock the secret to dominating your opponent with Giancarlo Bodoni’s "Forging the Guard: Mastering Foundations of the Clamp". As a 2x ADCC champion, training partner of Gordon Ryan, and student of John Danaher, Giancarlo brings you an exclusive BJJ instructional that dives deep into the world of the Clamp Guard ➡️In this series, Giancarlo breaks down the foundational elements of the Clamp Guard, a unique guard that allows for seamless sweeps, submissions, and positional control. ➡️Whether you're a beginner or an experienced practitioner, this instructional will elevate your guard game by showing you how to lock your opponent down, maintain dominant control, and transition fluidly into devastating attacks. $197😍$19.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#BJJFanatics#NewWave#NoGi 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1914 · 09.02.2026 г., 16:39

😁See the Back Take The Back: Guard Passes To Back Takes by Giancarlo Bodoni😁 ➡️See the Back, Take the Back: Guard Passes to Back Takes by Giancarlo Bodoni is the definitive blueprint for turning pressure passing into relentless back-taking offense. ➡️As a 2× ADCC champion, CJI standout, and one of the most technically disciplined athletes to emerge from the legendary Danaher system, Giancarlo has built his game around one thing: getting to the back and finishing—against everyone. $197😍$14.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#Transitions#NoGi#NewWave 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1913 · 09.02.2026 г., 16:39

😁Submission Mastery: Omoplata by Giancarlo Bodoni😁 ➡️Giancarlo Bodoni — 2x ADCC champion, CJI standout, and elite New Wave athlete under the legendary John Danaher and Gordon Ryan — unveils his groundbreaking system for mastering one of grappling’s most underutilized weapons: the omoplata. ➡️This is not just a submission tutorial. This is a total redefinition of the omoplata for the modern no-gi game — built on elite-level mechanics, control, and finishing options that go far beyond what you thought possible. $197😍$14.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#Submission#NoGi#NewWave 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1786 · 25.03.2025 г., 18:25

😁Forging The Guard: Reverse De La Riva By Giancarlo Bodoni😁 ➡️Unlock the full potential of your guard game with Forging The Guard: Reverse De La Riva by Giancarlo Bodoni, a two-time ADCC champion and one of the most successful no-gi athletes on the planet. ➡️This comprehensive instructional series takes you deep into the intricacies of the Reverse De La Riva Guard, a position renowned for its versatility, control, and offensive potential ➡️Giancarlo breaks down each detail with clear, concise direction that will help you build a nearly impenetrable guard while simultaneously making you a constant threat from this powerful position. $197😍$16.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#NoGi#ReverseDeLaRiva 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1785 · 25.03.2025 г., 18:23

😁Forging The Guard: De La Riva By Giancarlo Bodoni😁 ➡️Unlock the full potential of your guard game with Forging The Guard: De La Riva by Giancarlo Bodoni, a two-time ADCC champion and one of the most successful no-gi athletes on the planet. ➡️This comprehensive instructional series dives deep into the classic De La Riva Guard, a position known for its incredible control, sweeping power, and submission potential. ➡️Giancarlo provides clear and concise direction that will help you elevate your guard to a nearly impassable level while making you a constant offensive threat. $197😍$16.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#NoGi#DeLaRiva 💁‍♀️Buy 💁‍♀️

bjjfanaticsinstructionals

@bjjfanaticsinstructionals · Post #1847 · 20.07.2025 г., 19:26

🔥NEW RELEASE🔥 😁Forging the Guard: Wrestle Ups by Giancarlo Bodoni😁 ➡️Giancarlo Bodoni, one of the most dominant grapplers on the planet and a top student of the legendary John Danaher, brings you a game-changing instructional designed to reframe how you think about reversals from the bottom. ➡️In Forging the Guard: Wrestle Ups, Giancarlo reveals how to seamlessly blend traditional BJJ guard positions with low-effort, high-reward wrestle ups—turning common situations into powerful sweeps and takedowns. ̶$̶1̶9̶7̶😍$14.99😍 ❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️ 📱Payment: 📱📱📱 💰Submeta FOR FREE 🌈UFC Picks 👑MasterClass ✈️@bjjfanaticsinstructionals #GiancarloBodoni#WrestleUp#NoGi#NewWave 💁‍♀️Buy 💁‍♀️