Мой собственный класс ServiceInfo (добавлен один дополнительный параметр zc):
Код: Выделить всё
class MdnsAsyncServiceInfo(ServiceInfo):
def __init__(self, zc:'Zeroconf', *args, **kwargs):
super().__init__(*args, **kwargs)
self._zc = zc
оригинал: from .._cache import DNSCache vs clone: from Zeroconf._cache import DNSCache и т. д.
Как импортируется класс клона
Код: Выделить всё
from mdns_discovery.service_info_base import ServiceInfo
Но когда я импортирую напрямую из библиотеки Zeroconf (а именно это и происходит), Пытаюсь добиться)
Код: Выделить всё
from zeroconf import ServiceInfo
Код: Выделить всё
AttributeError: 'MdnsAsyncServiceInfo' object has no attribute '_get_initial_delay'
Код: Выделить всё
out/py
Код: Выделить всё
/home/ubuntu24/myproject/out/py/lib/python3.12/site-packages/zeroconf/_services/info.py
Подробнее здесь: https://stackoverflow.com/questions/791 ... nherited-i