Вторая по частоте 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
@JPG2PDFBot
Qué puede hacer este bot?
Envíame fotos JPG o BMP como medios de Telegram.
Cuando hayas terminado,
use /done e intentaré generar un archivo PDF usando las imágenes enviadas en ese orden.
Idioma: Inglés
(visto en @BotsGram_cu)
#pdf, #convert, #photo
@HearForYou_Bot
Qué puede hacer este bot?
Este bot puede Convertir mensajes de audio de Telegram y WhatsApp a texto
Idioma: Inglés
(visto en @BotsGram_cu)
#whatsapp, #telegram, #speachtotext, #convert, #audio
@textUtilsBot
Qué puede hacer este bot?
Bot en línea para transformaciones de texto. Puede ayudarlo a traducir texto del lenguaje humano a código binario o hexadecimal, cadena base64 y viceversa.
Idioma: Inglés
(visto en @BotsGram_cu)
#inline, #utility, #base64, #binary, #hexadecimal, #convert
@NewStickerOptimizerBot
Qué puede hacer este bot?
Simplemente envíeme una imagen o pegatina, y la convertiré en un archivo png y la optimizaré para que su tamaño sea más pequeño o igual a 350Kb, para que pueda agregarlo a un paquete de pegatinas usando el bot @stickers.
Idioma: Inglés
(visto en @BotsGram_cu)
#sticker, #png, #image, #picture, #optimize, #pack, #create, #tool, #convert
#typescript#bun#conversion#convert#converter#document_conversion#elysia#file_conversion#file_converter#hacktoberfest#pdf_converter#self_hosted#tailwindcss#typescript
ConvertX is a self-hosted online file converter that supports over a thousand file formats, including images, videos, documents, e-books, and 3D assets. It lets you convert multiple files at once, offers password protection, and supports multiple user accounts for privacy. You can run it easily using Docker, making it simple to set up on your own server. This means your files stay private since conversions happen locally without sending data to external servers. It uses powerful open-source tools like FFmpeg and ImageMagick, giving you a versatile and secure way to handle all your file conversion needs in one place[1][2].
https://github.com/C4illin/ConvertX
@TelescopyBot
Qué puede hacer este bot?
Con este bot puedes convertir videos cuadrados a videos redondos
Idioma: Inglés, Ruso
(visto en @BotsGram.cu)
#telescope, #video_\message, #convert, #mp4, #gif, #media, #questions, #command, #round, #message, #video