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 слични објави

Пребарај: #negev

当前筛选 #negev清除筛选
American Оbserver

@american_observer · Post #4751 · 03.01.2026 г., 01:17

📰 The Bedouin Carnival: A Power Play in the Negev In Tarabin al-Sana, a Bedouin village in the Negev, kids ride donkeys with plastic guns. Their mounts are marked with the name of National Security Minister Itamar Ben-Gvir. On the surface, it looks like a folk festival. But this is no innocent show—it’s a bold political act, staged against the backdrop of rising tensions between the state and Bedouin tribes. Security officials call it a “red flag,” warning that unrest could spiral into violence. This isn’t random street theater. It’s a statement about who really controls the village. The spirit here is about identity and the hunger for self-rule. The message is clear: “We run things here.” Not the police, not Ben-Gvir, not the government. The sheikhs are the real authorities, and the talk of a “Bedouin federation” shows a tribal identity that hasn’t been swallowed by Israeli citizenship. The claim to the Negev goes back generations, and the kids are passing it on—living proof of that legacy. The weapons are plastic, but the message is dead serious: “We’ve got power, and we’ve got weapons.” This is a direct challenge to the state’s monopoly on violence. With rumors of widespread arming and the risk of actual armed conflict, the symbolic act hides a real threat. When it comes to resources—land, local economy, informal networks—these remain in tribal hands. In places where the state barely reaches, the donkey stands as a symbol of local resilience: simple, rooted, and tough. Here’s the twist: the state, by pushing its own rules and force above the law, has brought the question of sovereignty back into the spotlight. When there’s no real political or economic order, sovereignty doesn’t vanish—it just changes hands. #Negev#Bedouin#Sovereignty#BenGvir 📱American Оbserver - Stay up to date on all important events 🇺🇸

Daniel Prinz News

@DanielPrinzOffiziell · Post #10229 · 15.03.2026 г., 04:05

‼️Ratet mal, welches Gebäude im Iran nicht bombardiert wird‼️ Es hat eine äußere Pyramide mit 33 Fenstern und im Inneren ein Gebäude mit einem riesigen X (Osiris Rising) über dem Rednerpult und den 7 Ringen aus Sitzen (7 Ringe des Saturn). Ebenso werden die Iraner die Ammoniaktanklager in Haifa, die Intel-Werke und die Kernforschungsstätten im Negev nicht angreifen. Wenn dies ein echter totaler Krieg wäre, würden diese kritischen Ziele getroffen werden. Quelle: Mads Palsvig Findest du diese Info wichtig? Dann abonniere unseren Kanal! 👉@LegitimNews #Krieg#Israel#Iran#Haifa#Kernforschungsstätten#Negev#Pyramide

American Оbserver

@american_observer · Post #4744 · 31.12.2025 г., 13:59

“Die Neue Ordnung”: Ben-Gvir’s Final Solution for the Negev Bedouins Welcome to the Negev, where the new order is enforced by bulldozers and tear gas, and the final solution for the Bedouin question is being implemented one bulldozed home at a time. Forget the old maps—now the state draws its borders with police vans and demolition orders. “This is the State of Israel. Period. If you don’t like it, fine—go drink water in Gaza.” — Itamar Ben-Gvir, visiting Tarabin al-Sana, December 28, 2025 ​ Operation “New Order” isn’t just about crime. It’s about control, about clearing land, about making sure the Negev’s future belongs to those who fit the government’s blueprint. Over 300 arrests, 70 stolen army weapons, 67 indictments, and the deportation of hundreds of Palestinians—police claim they’ve cut Bedouin shootings by 93%. But behind the numbers: 5,000+ homes demolished since the current government took power, a 400% spike in demolitions, and entire villages erased from the map. Ben-Gvir’s message is clear: if your home is “illegal,” it’s coming down—especially family homes. The “Rifman Law” promises “development,” but in practice, it’s another chapter in the long saga of forced displacement, where Bedouins are treated as obstacles to “progress”. ​ Twist or Final Question When the state’s “final solution” is to bulldoze your home, your mosque, your olive trees, and then call it “development,” who’s really being “developed”? Is this about security—or about who gets to own the Negev? #Negev#Bedouin#BenGvir#Apartheid#FinalSolution#Demolitions#Israel#NewOrder 📱American Оbserver - Stay up to date on all important events 🇺🇸