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

Резултати

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

Пребарај: #giftcards

当前筛选 #giftcards清除筛选
Crypto M - Crypto News

@CryptoM · Post #65070 · 10.04.2026 г., 18:40

🚀 OwlTing Group Integrates Visa Direct for USDC Funding OwlTing Group has announced the integration of Visa Direct into its OwlPay platform, allowing eligible U.S. debit cardholders to fund USDC without needing a separate exchange account. According to NS3.AI, the company holds licenses or equivalents in 41 U.S. states. This feature is currently available in OwlPay Harbor and OwlPay Wallet Pro, with plans to extend it to OwlPay Cash in a later phase. Users will be able to spend USDC via gift cards, transfer assets to third-party platforms, or send funds through Visa cards, bank accounts, and MoneyGram cash pickup. #OwlTingGroup#VisaDirect#USDC#OwlPay#NS3AI#debitcards#fintech#cryptocurrency#giftcards#MoneyGram#assettransfer

BiA Cerámica Fría

@biaceramicafria · Post #4206 · 06.10.2023 г., 20:46

🤩😮😎🆒🥳🔥😜⚡️🥺🙏🧑‍💻 Hoy es el día mundial de la ⚠️🔠🔠🔠🔠🔠🔠🅰️⚠️ 🙂El 6 de agosto se celebra el día mundial de la sonrisa 😀 Celebra jugando Smile for me (10/10) en Steam: Smile For Me es un juego de aventuras poco convencional de apuntar y hacer clic que te sitúa en el centro de un mundo abstracto,la gente es extraña, los rompecabezas son locos y el mundo esconde un secreto siniestro... ➖➖➖➖➖➖➖➖➖➖➖ Una sonrisa es un pasaporte que abre todas las fronteras ➖➖➖➖➖➖➖➖➖➖➖ Contáctanos para cargar saldo en tus plataformas👇 ✈️@jcslimcuba 🔓https://wa.me/5353717679 ☎️ +5353717679 #saldodesteam#steamwallet#cuba#psn#battlenet#steam#apple#steamgiftcard#jcslimcuba#giftcards#appleitunes#tarjetasderegalo#steamcuba#fortnite#Amazon#amazonmusic#amazonprime#primevideo#promo

BiA Cerámica Fría

@biaceramicafria · Post #4091 · 12.06.2023 г., 23:14

💳💳💳💳💳💳💳💳💳💳💳 ⚠️👾👾👾👾👾 ⚠️ 🔡🅰️🔡🔡🔡🔡🅰️ ✍️✍️✍️✍️✍️✍️✍️✍️ ✍️✍️✍️✍️✍️✍️✍️✍️✍️✍️ Adquiera una tarjeta digital prepagada VISA Vanilla y hágase con un método de pago versátil y sencillo de utilizar en cualquier plataforma donde se acepte Visa 💳 Precios en USD ✏️ ✏️➡️💲3️⃣3️⃣ ✏️ ✏️➡️💲6️⃣5️⃣ ✏️ ✏️ ✏️➡️💲1️⃣2️⃣6️⃣ ‼️🇨🇺 SERVICIO PARA TODA #CUBA🇨🇺‼️ Con nosotros podrá tener acceso a esas opciones de pago online que siempre quiso pero no tenía ni idea de que podía hacerlo desde Cuba Acceso a características Premium en aplicaciones de Diseño y Edición, suscripciones a almacenamiento en la nube, números extranjeros de teléfono virtuales, VPN en cualquier ubicación del mundo, software de producción de audio e imagen, desarrollo web, coding, etc ¡Libros, televisión y música online, videojuegos! Podemos hacerle llegar suscripciones, códigos y tarjetas digitales de saldo a sus cuentas en... 🛒#Amazon#Prime 📱#Apple#iTunes 🎮#Battlenet (#Blizzard's World of Warcraft #WoW) ℹ#Dota2 🎮#Garena 🕹#LeagueofLegends 📺#Netflix 🎮#Nintendo 🎮#Origin 🎮#PlayStation Network #PSN 🎮#Riot 🎵#Spotify 🎮#STEAM 💬#Telegram#Premium 📺#Twitch 🎮#Xbox Live 🇨🇺#Remesas#Pagos 📱 Tenemos alternativas para los pagos dentro de la Google Play Store con acceso a Google One y al Play Pass 📱 Contáctenos por #Telegram, por #Google, #Facebook, #Instagram, #Twitter y por #WhatsApp 💬@jcslimcuba 💬https://wa.me/5353717679 🌐https://m.me/jcslimcuba.fb ☎️ +5353717679 🖥https://linktr.ee/jcslimcuba #saldodesteam#steamwallet#cuba#psn#battlenet#steam#apple#steamgiftcard#jcslimcuba#giftcards#appleitunes#tarjetasderegalo#steamcuba#fortnite#Amazon#amazonmusic#amazonprime#primevideo#promo#visa#vanilla