Вторая по частоте 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
⚡️🇷🇺🇺🇦⚡️ Two Majors #Summary for the Morning of 14 March 2025; 07:00 (GMT+3)⚡️
🛡 The Enemy attacked an oil complex in #Tuapse using drones overnight. One of the fuel storage tanks caught fire, with the blaze covering an area of over 1,000 square metres. Emergency services are on-site. Additionally, drones were shot down over the #Saratov and #Voronezh regions.
🔹 In #Kursk Region, the 'Group of Troops North' liberated #Zaoleshenka and the settlement of #Goncharovka, clearing the outskirts of #Sudzha from all sides. The enemy continues to strike the liberated areas, trying to inflict maximum damage on our forces. Footage of destroyed enemy equipment is emerging, showing that the AFU suffered heavy losses while attempting to withdraw from the region.🎬👆Fighting continues in the Kuriklovka area. More evidence is surfacing from the liberated territories, documenting atrocities committed by nationalists against civilians. Battles are also ongoing near Basovka in the Sumy region.
🔹 In #Liman Section, north of #Terny, reports indicate fighting in the area of #Novolyubovka.
🔹 In #Seversk Sector, the enemy reported Russian activity near 'Sakkо and Vanzetti', a section of the front that has not been mentioned in recent reports.
🔹 In #Toretsk, battles with enemy units continue in different parts of the city. The enemy is still deploying groups into the urban area.
🔹 In #Pokrovsk Direction, fighting continues near #Uspenovka, #Udachnoye, #Kotlino, #Peschanoye, and #Shevchenko. Despite the high intensity of combat, the front line remains largely unchanged.
💥 In #Belgorod Region, in the Volokonovsky district, a private residence in the village of #Konovalovo was damaged by a drone attack. In the hamlet of #Gayevka, a drone strike damaged a piece of specialised machinery. In the Valuysky district, an FPV drone attacked a cargo vehicle in #Kaznacheyevka, while another drone struck a private house. In the village of #Grafovka, Krasnoyaruzhsky district, two drones detonated. In the settlement of #Oktyabrsky, Belgorod district, an FPV drone strike injured two men. Another drone detonated in the settlement of #Dalny, Valuysky district, injuring a woman. In #Shebekino, two FPV drones struck an industrial facility. In the Volokonovsky district, in the village of #Borisovka, a Nazi drone attacked a private residence.
💬Welcome to Military Chat;
🇬🇧Battle Maps
📱 Join GLOBAL DEPTH to boost your TG Feed
GLOBAL DEPTH from #HK
This channel aims to unite interested individuals from around the world in an attempt to connect the dots. Subscriber participation is always welcome here and in the channel's Chat Group.
⚡️🇷🇺🇺🇦⚡️ Two Majors #Summary for the Morning of 10 March 2025; 06:39 (GMT+3)⚡️
🔹 In #Kursk Region, in two full days of large-scale Russian Army offensive operations, significant gains have been achieved.🗺🎬👆Liberated settlements include #MalayaLoknya, #Loknya, #Nikolsky, #Lebedevka, #Kositsa, #Pravda, #Martynovka, #Kubatkin, #Viktorovka, #StarayaSorochina, and #CherkasskoyePorechnoye. This morning, reports confirmed the capture of #Makhnovka near #Sudzha, where retreating enemy forces are regrouping. Fighting is ongoing on the outskirts of #Sudzha. Several settlements were seized thanks to a 'pipeline manoeuvre - Russian assault units advanced over 15 km in a narrow space, emerging behind enemy lines and engaging in battle, causing panic. Until reinforcements arrived, assault groups fought encircled, awaiting a breakthrough. #Novenkoye in the #Sumy region has also been captured, roads are under fire control, and bridges have been destroyed to prevent enemy retreat. The objective is not to push AFU forces back but to annihilate them. This decisive push, combined with prolonged preparation and intense combat, has yielded significant results, marking the beginning of an operation that will go down in history.
🛡 Several UAVs were destroyed or suppressed in two districts of the Voronezh region overnight. Explosions were reported in #Novokuybyshevsk, #Samara region. Russian forces targeted a gas distribution station near #Lucerna (north of #Zaporozhye) with Geran drones. Additional explosions were reported in the #Kiev and #Dnepropetrovsk regions.
🔹 North and South of #Kupyansk, on the western bank of the Oskol River, AFU is urgently reinforcing positions westward in response to Russian foothold expansion.
🔹 In #Toretsk, the enemy continues sending personnel and equipment through gaps in Russian defences, only to end up surrounded and facing superior Russian forces.
🔹 Near #Pokrovsk, Russian troops are engaged in combat with counterattacking AFU units near #Peschanoye and #Shevchenko, with villages frequently changing hands.
🔹 West of #Kurakhovo, #Konstantinopol has been captured, confirmed by multiple videos showing Russian troops raising flags in different parts of the settlement.
🔹 On the #Zaporozhye Front, Russian forces continue fierce battles for #Pyatikhatki and advance towards #Shcherbaki. Air support is assisting infantry by striking enemy positions. Reports also indicate progress towards #Danilovka, north of #Rabotino.
💥 In #Belgorod Region, Ukrainian forces continue attacks on civilians. In the #Balka hamlet, two UAVs destroyed a private house by fire. In #Zhelobok, a drone struck a parked civilian vehicle. In the Valuysky district, a drone strike set a car ablaze in the settlement of #Dalny. In the village of #Borki, an FPV drone detonated within a private residence. In Grayvoron district, a drone targeted a commercial facility in #Golovchino. In #Shebekino, a man was injured by a detonated 'Kolokolchik' mine nearby.
💬Welcome to Military Chat;
🇬🇧Battle Maps
📱 Join GLOBAL DEPTH to boost your TG Feed
GLOBAL DEPTH from #HK
This channel aims to unite interested individuals from around the world in an attempt to connect the dots. Subscriber participation is always welcome here and in the channel's Chat Group.