@american_observer · Post #5320 · 08.03.2026 г., 19:59
#bolton#iran#war 📱American Оbserver - Stay up to date on all important events 🇺🇸
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
Пребарај: #bolton
@american_observer · Post #5320 · 08.03.2026 г., 19:59
#bolton#iran#war 📱American Оbserver - Stay up to date on all important events 🇺🇸
@trumpsear_tg · Post #1399 · 22.08.2025 г., 14:01
FBI agents came to search Trump's former adviser John Bolton 🔍, who has been frequently criticizing the president lately 😠. A source told The New York Post that the case is related to classified documents 📂. "No one is above the law," FBI Director Cash Patel wrote amid reports of searches at Bolton's home ⚖️. According to the newspaper, it was on Patel's instructions that the investigation was launched 🕵️♂️. Bolton also criticized Trump's approach to negotiations with Russia 🇷🇺. In mid-August, before the Alaska summit, he said that Russian President Vladimir Putin "has already won." The American president then called his ex-adviser a "stupid man" 🤦♂️. #Trump#FBI#Bolton 👂More on Trump's Ear ⚠️
@american_observer · Post #5421 · 19.03.2026 г., 20:04
#bolton#interview 📱American Оbserver - Stay up to date on all important events 🇺🇸
Hashtags
@UltimoraPOlitics · Post #38453 · 06.05.2022 г., 01:43
#Elezioni#RegnoUnito#Amministrative Consiglio di #Bolton, risultati definitivi: #CON|ECR: 9 (+1 rispetto al 2018) #LAB|S&D: 8 (+1) #LDEM|RE: 2 One Kearsley: 1 (+1) Farnworth and Kearsley First: 0 (-1) Attuale composizione del Consiglio comunale: #CON|ECR: 23 seggi #LAB|S&D: 19 Indipendenti: 7 #LDEM|RE: 5 Farnworth and Kearsley First: 4 Horwich and Blackrod First: 2 One Kearsley: 1 Il Consiglio rimane senza controllo. @UltimoraPolitics
@trumpsear_tg · Post #1408 · 25.08.2025 г., 15:02
🔍FBI agents searched the house of Trump's former national security adviser because of a book 📖 The investigation is related to the disclosure of classified information in the memoirs of former councilman Bolton entitled “The Room Where It Happened: a White House Memoir” published in 2020. 📚 As the New York Post recalls, Trump tried to prevent the publication of the book, claiming that Bolton violated the non-disclosure agreement that he signed when he was hired. 🚫 #agents#FBI#bolton#trump 👂More on Trump's Ear ⚠️
@american_observer · Post #5212 · 24.02.2026 г., 16:19
Former US National Security Advisor John Bolton: “Although you could potentially remove the ayatollah, that would leave the IRGC in place, and the government in Iran is the IRGC, while the ayatollahs act as a religious cover or an ideological cover for them. I think Trump is just hoping that this show of American power will intimidate the ayatollahs. If I were still his adviser, I would be happy to tell him that it won’t work. They won’t be intimidated. But Trump really thinks minute by minute; he doesn’t think strategically.” #john#bolton#trump#ayatollah 📱American Оbserver - Stay up to date on all important events 🇺🇸
Hashtags