mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
[code-quality] Organise wifi related imports (#7153)
This commit is contained in:
parent
acf690c87d
commit
20c2246533
4 changed files with 26 additions and 26 deletions
|
@ -1,15 +1,19 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
import esphome.final_validate as fv
|
||||
from esphome import automation
|
||||
from esphome.automation import Condition
|
||||
import esphome.codegen as cg
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant
|
||||
from esphome.components.network import IPAddress
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_AP,
|
||||
CONF_BSSID,
|
||||
CONF_CERTIFICATE,
|
||||
CONF_CERTIFICATE_AUTHORITY,
|
||||
CONF_CHANNEL,
|
||||
CONF_DNS1,
|
||||
CONF_DNS2,
|
||||
CONF_DOMAIN,
|
||||
CONF_EAP,
|
||||
CONF_ENABLE_BTM,
|
||||
CONF_ENABLE_ON_BOOT,
|
||||
CONF_ENABLE_RRM,
|
||||
|
@ -17,29 +21,26 @@ from esphome.const import (
|
|||
CONF_GATEWAY,
|
||||
CONF_HIDDEN,
|
||||
CONF_ID,
|
||||
CONF_IDENTITY,
|
||||
CONF_KEY,
|
||||
CONF_MANUAL_IP,
|
||||
CONF_NETWORKS,
|
||||
CONF_ON_CONNECT,
|
||||
CONF_ON_DISCONNECT,
|
||||
CONF_PASSWORD,
|
||||
CONF_POWER_SAVE_MODE,
|
||||
CONF_PRIORITY,
|
||||
CONF_REBOOT_TIMEOUT,
|
||||
CONF_SSID,
|
||||
CONF_STATIC_IP,
|
||||
CONF_SUBNET,
|
||||
CONF_USE_ADDRESS,
|
||||
CONF_PRIORITY,
|
||||
CONF_IDENTITY,
|
||||
CONF_CERTIFICATE_AUTHORITY,
|
||||
CONF_CERTIFICATE,
|
||||
CONF_KEY,
|
||||
CONF_USERNAME,
|
||||
CONF_EAP,
|
||||
CONF_TTLS_PHASE_2,
|
||||
CONF_ON_CONNECT,
|
||||
CONF_ON_DISCONNECT,
|
||||
CONF_USE_ADDRESS,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from esphome.core import CORE, HexInt, coroutine_with_priority
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const
|
||||
from esphome.components.network import IPAddress
|
||||
import esphome.final_validate as fv
|
||||
|
||||
from . import wpa2_eap
|
||||
|
||||
AUTO_LOAD = ["network"]
|
||||
|
|
|
@ -7,16 +7,15 @@ so that it doesn't crash if it's not installed.
|
|||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from esphome.core import CORE
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_USERNAME,
|
||||
CONF_IDENTITY,
|
||||
CONF_PASSWORD,
|
||||
CONF_CERTIFICATE,
|
||||
CONF_IDENTITY,
|
||||
CONF_KEY,
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
|
||||
from esphome.core import CORE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -49,8 +48,8 @@ def wrapped_load_pem_x509_certificate(value):
|
|||
def wrapped_load_pem_private_key(value, password):
|
||||
validate_cryptography_installed()
|
||||
|
||||
from cryptography.hazmat.primitives.serialization import load_pem_private_key
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives.serialization import load_pem_private_key
|
||||
|
||||
if password:
|
||||
password = password.encode("UTF-8")
|
||||
|
@ -91,7 +90,7 @@ def _validate_load_private_key(key, cert_pw):
|
|||
|
||||
|
||||
def _check_private_key_cert_match(key, cert):
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa, ec
|
||||
from cryptography.hazmat.primitives.asymmetric import ec, rsa
|
||||
|
||||
def check_match_a():
|
||||
return key.public_key().public_numbers() == cert.public_key().public_numbers()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import text_sensor
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_BSSID,
|
||||
CONF_DNS_ADDRESS,
|
||||
CONF_IP_ADDRESS,
|
||||
CONF_MAC_ADDRESS,
|
||||
CONF_SCAN_RESULTS,
|
||||
CONF_SSID,
|
||||
CONF_MAC_ADDRESS,
|
||||
CONF_DNS_ADDRESS,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.components import sensor
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
|
|
Loading…
Reference in a new issue