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

Резултати

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

Пребарај: #dccomics

当前筛选 #dccomics清除筛选

🩸🩸🩸🩸🫵🩸🩸 🎬The Penguin series based on the latest Batman has received 91% on Rotten Romatoes. Critics are delighted with Colin Farrell's transformation and call his character the Tony Soprano of the DC Comics world. JoBlo gave the series 10/10, and one critic even called Penguin the best series of the year. The season will have 8 episodes. The first episode of the series will be released on streaming on September 19, and the last one - on November 10. It seems that we have a contender for the main comic book series of 2024 🚬 #Penguin#Batman#DCComics MARKHEMIST

📺 AnimeAction++

@animeactioz · Post #2571 · 03.05.2023 г., 19:53

DC Legion of Super Heroes Season 2 📅Año Septiembre 2007 - Mayo 2008 🎥Dirección Ben Jones, Tim Maltby, Lauren Montgomery, Scott Jeralds, James Tucker, Brandon Vietti 📄Guion Tim Cahill, Julie McNally Cahill. J.M. DeMatteis, Matt Wayne. Michael Jelenic, Rob Hoegee, Scott Sonneborn, Amy Wolfram, Stan Berkowitz, Steven Melching, John Esposito, Keith Damron, Eddie Guzelian, Rob Hummel, Marty Isenberg, Joseph Kuhr, David Slack, Greg Weisman 🎼Música Kristopher Carter, Michael McCuistion, Lolita Ritmanis 🎬Productora Warner Bros. Animation Género#SeriedeTV#Animación#Acción#Comedia#Superhéroes#Cómic#DCComics Reparto / Trailer / Premios ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 2 Episodio01 / 02 / 03 / 04 / 05 / 06 / 07 / 08 / 09 / 10 / 11 / 12 / 13 Season1

📺 AnimeAction++

@animeactioz · Post #2540 · 03.05.2023 г., 02:10

DC Legion of Super Heroes Season 1 📅Año Septiembre 2006 - Mayo 2007 🎥Dirección Ben Jones, Tim Maltby, Lauren Montgomery, Scott Jeralds, James Tucker, Brandon Vietti 📄Guion Tim Cahill, Julie McNally Cahill. J.M. DeMatteis, Matt Wayne. Michael Jelenic, Rob Hoegee, Scott Sonneborn, Amy Wolfram, Stan Berkowitz, Steven Melching, John Esposito, Keith Damron, Eddie Guzelian, Rob Hummel, Marty Isenberg, Joseph Kuhr, David Slack, Greg Weisman 🎼Música Kristopher Carter, Michael McCuistion, Lolita Ritmanis 🎬Productora Warner Bros. Animation Género#SeriedeTV#Animación#Acción#Comedia#Superhéroes#Cómic#DCComics Reparto / Intro / Sinopsis / Premios ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Latino Season 1 Episodio01 / 02 / 03 / 04 / 05 / 06 / 07 / 08 / 09 / 10 / 11 / 12 / 13 Season2

📺 AnimeAction++

@animeactioz · Post #4110 · 23.08.2024 г., 11:46

DC Gen¹³ aka Gen 13 🗓Año 1999 ⏱Duración 73min. 🎥Dirección#KevinAltieri 📄Guion Kevin Altieri. 📚Cómic Jim Lee, Brandon Choi, J. Scott Campbell 🎼Música Amotz Plessner 🎬Productora Aegis Entertainment Género#Animación#Acción#Cienciaficción#Cómic#DCComics Reparto | Trailer | Sinopsis Ver Aquí AnexoDC Comics | Animación | SciFi | Comic

Chollazo Exprés 🔥 Ofertas y Descuentos

@ChollazoExpres · Post #5135 · 22.12.2025 г., 20:00

💥Muñeco Flash de DC Comics 30 CM Lleva la velocidad a casa esta Navidad ✅OFERTA: 7.5€ ❌ Antes: 15.99€ 💰Ahorras un 53%🔥 Figura articulada coleccionable de alta calidad 👉 Hazte con él ahora y sorprende #juguetes#coleccionables#superheroes#regalos#ninos#navidad#figuraflash#dccomics 🛰️Oferta publicada en Cultura y Ocio

📺 AnimeAction++

@animeactioz · Post #3428 · 06.09.2023 г., 20:20

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3418 · 02.09.2023 г., 02:59

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3415 · 22.08.2023 г., 20:40

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3393 · 14.08.2023 г., 06:31

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3383 · 07.08.2023 г., 20:40

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3356 · 30.07.2023 г., 04:56

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

📺 AnimeAction++

@animeactioz · Post #3327 · 25.07.2023 г., 04:18

My Adventures with SupermanSeason 1 📅Año 2023 🎥Dirección#JakeWyatt (Creador) 🎬Productora Warner Bros. Animation, DC Entertainment. 🚚Distribuidora Adult Swim, HBO Max, Max Género#SeriedeTV#Animación#Aventuras#Acción#Fantástico#Superhéroes#DCComics#Cómic Reparto | Trailer | Sinopsis ⏱Duración 22min. 🖥Resolución 720x400 🗣Idioma Inglés Subtítulos Latino Season 1 Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - ?? Suscripción a esta Serie 👉🏻Aquí Índice de Animaciones 👉🏻Aquí

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