Вторая по частоте 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
🌎 The black robin of New Zealand bounced back from just five birds left in the world in 1980—thanks to devoted conservation, their population is now stable. This comeback highlights how careful human intervention can save even the rarest species from extinction. ✨
#conservation⚡#wildlife⚡#recovery
👉subscribe Interesting Planet
OrangeFox Recovery Project - Official | Nothing Phone (2)
📝 Details:
- Version: R11.1_1
- Codename: #Pong
- Released: 08/02/24
⬇️ Download : Here
🏛 Support Threads : TG | XDA
⚙️Installation | Visual Tutorial
📸Screenshots
💰 Donate : UPI || PayPal
🏷 Tags: #OFOX#Recovery#Official
🗒 Notes:
Cmds to flash via fastboot:
fastboot flash recovery_a <recovery.img>
fastboot flash recovery_b <recovery.img>
Flashing to both slots is optional! Users can update by flashing the new build over the previous one by flashing the zip in magisk or manually extracting the recovery.img and flashing it via fastboot or supported flashing apps.
If you flash the OTA.zip (Nothing OS update packages), it's recommended to follow these steps for a smooth update process:
1. Flash the OTA.zip.
2. Immediately flash the OrangeFox.zip.
3. Reboot to recovery.
4. Flash the OTA.zip again.
5. Follow up with flashing the OrangeFox.zip.
✨Changelogs:
- Synced with latest sources
- fixes various bugs and problems
- Fixed flags
- Fixed flashing error via old orangefox via last build
- Improved compatibility with custom roms
🏆Credits:
- Nebrassy for his TWRP trees
👤 Maintainer : @phobosc_io
🔔 Updates : @NothingPhone2Updates
🐙 Chat : @NothingPhone2
OrangeFox Recovery Project - Official | Nothing Phone (2)
✍️ Details:
- Version: R11.1_6
- Codename: #Pong
- Released: 17/10/2024
🔽 Download : Here | Toolbox
⚙️ Installation: Here
🆘 Support Threads : TG | XDA
📸 Screenshot: Here
🎄 DT: Here
💵 Donate : UPI | PayPal
🔖 Tags: #OFOX#Recovery#Official#NothingPhone2
💫 Changelogs:
- Update to R11.1_6 version
- Updated prebuilt magisk to v28.0
- Now when flashing image you see all options at once
- Built with latest source
🏆Credits:
- Nebrassy for his TWRP trees
👤 Maintainer : @phobosc_io
🔔 Updates : @NothingPhone2Updates
🐙 Chat : @NothingPhone2