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

Резултати

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

Пребарај: #digitalwarfare

当前筛选 #digitalwarfare清除筛选
Moscow Photographer

@moscowphotog · Post #2359 · 20.11.2025 г., 00:02

#RussiaUpClose#Censorship#DigitalWarfare In this episode of I’ll Tell You What, Eddie Gonzales — former Texas law enforcement officer and co-host of Russia Up Close — exposes the new censorship machine: the Information-Industrial Complex. The truth is simple: If they can censor anyone… they can censor you. Russia Up Close is a show that brings Russians and Westerners into direct, honest conversation. Its goal is to break stereotypes, building a two way bridge between Russia and the West, and offer a grounded, human look at life inside Russia through real voices and real stories. ____ Please Follow Us on Our Platforms: ➡️X: https://x.com/russiaupclose ➡️YouTube: https://www.youtube.com/@ruclose ➡️Telegram: https://t.me/RussiaUpClose ➡️VK: https://vk.com/russiaupclose ➡️RuTube: https://rutube.ru/u/russiaupclose ➡️Yandex: https://dzen.ru/russiaupclose ➡️MAX: https://max.ru/join/fp1u2YfMAlbbS65bgK87EvVKEgD9Z4pjmi71tthNv9o ➡️Our Website: https://www.RussiaUpClose.ru For Advertising Inquiries: [email protected] ____ The Hosts Jozef A. Schutzman - IT Executive and Father of 8 children who moved to Russia from the United States to build a new life for his family and suddenly found himself in the epicenter of a challenging information struggle. He lives in Moscow with his family. He brings a unique cross-cultural perspective, making complex topics accessible to Western audiences. Eddie Gonzales - A Law Enforcement Officer from Texas, also known as the Moscow Photographer, is a respected visual storyteller with deep personal insight into Russian culture. His grounded, straight-talk perspective brings clarity to global political conversations. He believes real understanding comes from honest, unfiltered dialogue between people who rarely get to hear each other directly. ____ Our audience includes Western viewers seeking an honest look at Russia, Russians curious about how their country is seen abroad, and anyone interested in cross-cultural understanding. We invite viewers to join the conversation, challenge assumptions, and become part of a community that values direct dialogue over media filters. ____ Russia Up Close aims to expand into a major media community featuring long-form interviews, weekly segments, field reporting, and community-driven storytelling. Our long-term vision is to become the premier space where Russians and Westerners meet, speak openly, and rebuild understanding. https://youtu.be/h1Re55NRDww

​NO Kings ​🚫👑

@No_king_No_King · Post #166 · 12.04.2026 г., 09:40

WHY IRAN IS USING LEGO VIDEOS... 00 And what the media is saying about it. This isn't random. It's not just "funny animation." It's strategy. Why LEGO-style? Simple visuals = easier to understand globally No language barrier = reaches millions instantly Looks harmless... but carries serious messaging Perfect for Tik Tok, Reels, and viral sharing In short: It turns geopolitics into something people will actually WATCH. This is what analysts call: modern information warfare Where memes, music, and animation = influence. What outlets like CNN are pointing out: Coverage highlights how these videos are part of a larger digital propaganda ecosystem - using Al visuals and storytelling to shape narratives online. They're not targeting just one country... They're targeting global audiences scrolling on their phones. And that's why it works: You're not watching "news" You're watching a story And stories spread faster than facts. Real question: Is this just creative content... or a new kind of influence campaign? Drop your take If you see what's happening Share before everyone catches on #Iran#aiart #digitalwarfare #geopolitics #viralvideo ✈️t.me/No_king_No_King