mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix circular import of scapy in dhcp (#56040)
* Fix circular import of scapy in dhcp * Tweak import, add comment * Tweak import, add comment * pylint
This commit is contained in:
parent
970a7f9662
commit
ff1b39cda6
@ -279,6 +279,17 @@ class DHCPWatcher(WatcherBase):
|
|||||||
"""Start watching for dhcp packets."""
|
"""Start watching for dhcp packets."""
|
||||||
# Local import because importing from scapy has side effects such as opening
|
# Local import because importing from scapy has side effects such as opening
|
||||||
# sockets
|
# sockets
|
||||||
|
from scapy import ( # pylint: disable=import-outside-toplevel,unused-import # noqa: F401
|
||||||
|
arch,
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Importing scapy.sendrecv will cause a scapy resync which will
|
||||||
|
# import scapy.arch.read_routes which will import scapy.sendrecv
|
||||||
|
#
|
||||||
|
# We avoid this circular import by importing arch above to ensure
|
||||||
|
# the module is loaded and avoid the problem
|
||||||
|
#
|
||||||
from scapy.sendrecv import ( # pylint: disable=import-outside-toplevel
|
from scapy.sendrecv import ( # pylint: disable=import-outside-toplevel
|
||||||
AsyncSniffer,
|
AsyncSniffer,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user