Вторая по частоте future-функция, которую я использовал, это абсолютный импорт
from __future__ import absolute_import
Что она делает?
Изменения, которые вносит эта инъекция описаны в PEP328
Покажу простой пример.
Допустим, есть такой пакет:
/my_package
/__init__.py
/main.py
/string.py
Смотрим код в my_package/main.py
# main.py
import string
Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта:
1. модуль в моём пакете my_package.string
2. стандартный модуль string
И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string.
Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать.
from my_package import string
или относительный импорт, но с указанием пути относительно текущего модуля main
from . import string
Еще одной неоднозначностью меньше 😎
Подробней про импорты здесь:
https://docs.python.org/3/tutorial/modules.html
#2to3#pep#basic
#Sudan: Il Segretario di Stato Marco Rubio ha annunciato con un post su X che la branca sudanese di Fratellanza Musulmana è stata designata come "organizzazione terroristica estera" e "organizzazione terroristica particolarmente designata" dal Dipartimento di Stato americano, in quanto supportata ed addestrata dalle IRGC iraniane.
— 🇸🇩: Last week the UAE backed RSF militia kidnapped a girl from the Nahda neighbourhood of Nyala and forcibly detained her for five days.
During this time, the victim was subjected to the most horrific forms of torture and gang rape, before being thrown onto a public road in a critical physical and psychological state.
#Sudan
@NewsfromSudan
🇸🇩#Sudan: Two families (reportedly nine people) were killed after an artillery shell fired by the Rapid Support Forces (RSF) struck a residential neighborhood in the city of Dilling, South Kordofan State, yesterday.
On March 28th, a partial blockade was reported in the area due to renewed clashes between the Sudanese Armed Forces and the RSF. The army was reportedly successful in repelling an attempted RSF advance. The rebels are attempting to re-establish control in the Kordofan area after the army broke an almost two-year-long siege in early January.
(via @SudanTribune_EN on X)
🇸🇩#Sudan: Three aid workers were killed and four others were injured in a drone strike by the Rapid Support Forces (RSF) on an aid convoy in South Kordofan yesterday.
The convoy, which was carrying food and other supplies, was hit while passing through the Kartala area.
This would be the second strike on an aid convoy this month by the RSF.
(via Al Jazeera)
🇸🇩#Sudan: Sudanese Armed Forces have launched an offensive against Rapid Support Forces toward the Al-Rahad - Um Ruwaba axis in North Kordofan, capturing the Al-Uba area from RSF militants.
Meanwhile, several drone strikes against RSF positions were also reported in Zalingei, western Sudan.
(📹 via @Sudan_tweet on X)
🇸🇩#Sudan: Aerial footage shows a drone operated by the Sudanese Armed Forces (SAF) dropping an explosive payload next to two trucks carrying Rapid Support Forces (RSF) militants.
(via @war_noir)
🇸🇩#Sudan: Sudanese Armed Forces (SAF) have shot down three RSF kamikaze drones which were allegedly attempting to target civilian infrastructure in the city of Al-Ubayyid, North Kordofan State.
🇸🇩#Sudan: Intense clashes continue between the Sudanese Armed Forces (SAF) and remnants of the Rapid Support Forces (RSF). Footage shows SAF Special Mission Forces (SMF) charging toward remaining RSF militants on the outskirts of South Kordofan, following weeks of heavy fighting in Dilling, where the RSF was recently pushed out.
(📹 via @Sudanis0 on X)
🇸🇩#Sudan: The Sudanese Armed Forces have reportedly broken through RSF lines and lifted the siege on the city of Dilling in South Kordofan after nearly two and a half years of blockade.
The army says it reopened the Dilling road following intense clashes with RSF militants, claiming heavy losses were inflicted on the militia in both personnel and equipment.
The RSF group has maintained a siege on Dilling since January 2024.
(via @AfriMEOSINT & @Sudan_tweet on X)
🇸🇩#Sudan: Rapid Support Forces (RSF) have recently shot down a SAF (Sudanese Armed Forces) drone.
The drone was a Baykar Bayraktar TB2, which is supplied by Turkey.
(via @war_noir)
🇸🇩#Sudan: Videos show Rapid Support Forces (RSF) militants inside the Heglig oil fields and the SAF's 90th Brigade headquarters after taking full control of the area in West Kordofan, including the town and its oil infrastructure.
Before the Sudanese Armed Forces pulled out, an official report states that operators in the area had already shut down their facilities and evacuated personnel to Unity State in South Sudan.
Meanwhile, the oil field had been inactive since August, when a drone strike prompted authorities to suspend all work at the site.
(via Al Jazeera; 📹 via @AFRIMEOSINT on X)
🇸🇩#Sudan: Sudanese Armed Forces have shelled multiple Rapid Support Forces (RSF) positions across several axes in Kordofan.
Reports also indicate Sudanese drone strikes earlier today in Al-Fula and Geneina in West Kordofan. In the footage, a reconnaissance drone can be seen coming down near the soldiers.
(Via @Sudan_tweet on X)