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

Резултати

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

Пребарај: #militarymodernization

当前筛选 #militarymodernization清除筛选
Red Nile

@rednile12 · Post #10879 · 25.01.2026 г., 19:21

🔺Continuation from above @rednile12 🔍 Why this confirmation matters The unveiling is corroborated by multiple defence-focused outlets with photos and videos from the expo, including: 🔗Defence Blog (breaking report): 🔗Defence Security Asia (in-depth analysis): ▪️ Additional confirmation came from UNITED24 Media and Ethiopia’s Institute of Foreign Affairs (IFA), reinforcing that this is consistent, cross-verified reporting, not media hype. ▪️Variants on display suggest ISR-focused configurations, while reporting confirms strike-capable Orion-E versions are part of the acquisition — aligning with the platform’s dual-role MALE design. ▪️While no formal press release has been issued by Addis Ababa or Rosoboronexport (standard practice for sensitive arms deals), the public exhibition itself functions as de facto confirmation. 🛩️ Aviation Expo 2026 — key context 📍Location: Bishoftu Air Force Headquarters 🎖️Occasion: 90th anniversary of the Ethiopian Air Force — the Black Lion 📅Dates: January 23–27, 2026 🌍Theme:“Flying Forward, Building a Shared Future” 🛰️ What Ethiopia is actually acquiring According to Defence Security Asia: ▪️The Orion-E is a medium-altitude, long-endurance (MALE) UAV capable of 24+ hours endurance ▪️Payload capacity of up to 250 kg, supporting electro-optical/infrared sensors and precision-guided munitions ▪️Operational altitude of roughly 7,500 meters, designed to remain above most MANPADS threats ▪️Optimised for persistent ISR and precision strike, particularly in large, rugged, infrastructure-poor environments like the Horn of Africa 💸 The deal is widely assessed to be worth USD 300–500 million, likely covering: ▪️Multiple airframes ▪️Ground control stations ▪️Training and operational support ▪️Weapons integration and sustainment 🌍 Strategic implications The Orion-E unveiling marks: A decisive leap in Ethiopian airpower modernisation ▪️ A clear shift toward sovereignty-centric, non-Western defence partnerships, especially after Western arms restrictions during the Tigray conflict ▪️Russia’s first real breakthrough in exporting MALE UAVs, validating long-stated claims by Rosoboronexport chief Alexander Mikheev that multiple Orion contracts had been signed 🔹 Regionally, Ethiopia’s drone modernisation directly affects: ▪️Horn of Africa security dynamics ▪️The Red Sea and Bab al-Mandab corridor ▪️Deterrence, escalation control, and power projection through persistent unmanned dominance 📌 Bottom line This is not speculation, not propaganda, and not unverified chatter. Ethiopia has now visibly entered the MALE-class drone club, becoming the first foreign operator of Russia’s Orion-E and a pace-setter in Africa’s next phase of aerial warfare. The skies over Africa are changing — and Ethiopia is choosing to shape that future, not react to it. — RedNile Media🌊🧭 📡@rednile12 Geopolitics | Multipolarity | Sovereignty | Strategic Reality #Ethiopia#OrionE#RussianDrones#AfricanAirpower#DroneWarfare#EthiopianAirForce#HornOfAfrica#RedSea#MilitaryModernization#Geopolitics