Organise imports

This commit is contained in:
Jesse Hills 2024-08-06 20:31:35 +12:00
parent 47935655c6
commit d3386a3e38
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
7 changed files with 38 additions and 41 deletions

View file

@ -1,20 +1,19 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import display, font, color
from esphome.const import (
CONF_ID,
CONF_DISPLAY,
CONF_TRIGGER_ID,
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR,
)
from esphome import automation, core from esphome import automation, core
import esphome.codegen as cg
from esphome.components import color, display, font
from esphome.components.display_menu_base import ( from esphome.components.display_menu_base import (
DISPLAY_MENU_BASE_SCHEMA, DISPLAY_MENU_BASE_SCHEMA,
DisplayMenuComponent, DisplayMenuComponent,
display_menu_to_code, display_menu_to_code,
) )
import esphome.config_validation as cv
from esphome.const import (
CONF_BACKGROUND_COLOR,
CONF_DISPLAY,
CONF_FOREGROUND_COLOR,
CONF_ID,
CONF_TRIGGER_ID,
)
CONF_FONT = "font" CONF_FONT = "font"
CONF_MENU_ITEM_VALUE = "menu_item_value" CONF_MENU_ITEM_VALUE = "menu_item_value"

View file

@ -1,13 +1,16 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.const import CONF_ID, CONF_TYPE, CONF_BORDER
from esphome.components import color from esphome.components import color
from . import horizontal_stack import esphome.config_validation as cv
from . import vertical_stack from esphome.const import CONF_BORDER, CONF_ID, CONF_TYPE
from . import text_panel
from . import display_rendering_panel from . import (
from . import fixed_dimension_panel display_rendering_panel,
from . import text_run_panel fixed_dimension_panel,
horizontal_stack,
text_panel,
text_run_panel,
vertical_stack,
)
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
RootLayoutComponent = graphical_layout_ns.class_("RootLayoutComponent", cg.Component) RootLayoutComponent = graphical_layout_ns.class_("RootLayoutComponent", cg.Component)

View file

@ -1,7 +1,7 @@
import esphome.codegen as cg import esphome.codegen as cg
from esphome.components.display import DisplayRef, display_ns
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import CONF_WIDTH, CONF_HEIGHT, CONF_LAMBDA from esphome.const import CONF_HEIGHT, CONF_LAMBDA, CONF_WIDTH
from esphome.components.display import display_ns, DisplayRef
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
Rect = display_ns.class_("Rect") Rect = display_ns.class_("Rect")

View file

@ -1,6 +1,6 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import CONF_TYPE, CONF_WIDTH, CONF_HEIGHT from esphome.const import CONF_HEIGHT, CONF_TYPE, CONF_WIDTH
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
FixedDimensionPanel = graphical_layout_ns.class_("FixedDimensionPanel") FixedDimensionPanel = graphical_layout_ns.class_("FixedDimensionPanel")

View file

@ -1,15 +1,14 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv from esphome.components import color, font, sensor, text_sensor, time
from esphome.components import font, color, sensor, text_sensor, time
from esphome.components.display import display_ns from esphome.components.display import display_ns
import esphome.config_validation as cv
from esphome.const import ( from esphome.const import (
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR, CONF_BACKGROUND_COLOR,
CONF_FOREGROUND_COLOR,
CONF_SENSOR, CONF_SENSOR,
CONF_TIME_ID, CONF_TIME_ID,
) )
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
TextPanel = graphical_layout_ns.class_("TextPanel") TextPanel = graphical_layout_ns.class_("TextPanel")
TextAlign = display_ns.enum("TextAlign", is_class=True) TextAlign = display_ns.enum("TextAlign", is_class=True)

View file

@ -1,17 +1,16 @@
import esphome.codegen as cg import esphome.codegen as cg
from esphome.cpp_generator import CallExpression, MockObjClass, MockObj from esphome.components import color, font, sensor, text_sensor, time
from esphome.core import ID
import esphome.config_validation as cv
from esphome.components import font, color, sensor, text_sensor, time
from esphome.components.display import display_ns from esphome.components.display import display_ns
import esphome.config_validation as cv
from esphome.const import ( from esphome.const import (
CONF_ID,
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR, CONF_BACKGROUND_COLOR,
CONF_FOREGROUND_COLOR,
CONF_ID,
CONF_SENSOR, CONF_SENSOR,
CONF_TIME_ID, CONF_TIME_ID,
) )
from esphome.core import ID
from esphome.cpp_generator import CallExpression, MockObj, MockObjClass
SharedPtr = cg.std_ns.class_("shared_ptr") SharedPtr = cg.std_ns.class_("shared_ptr")
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")

View file

@ -1,14 +1,11 @@
from string import ascii_letters, digits from string import ascii_letters, digits
import esphome.config_validation as cv
import esphome.codegen as cg import esphome.codegen as cg
from esphome.components import color from esphome.components import color
from esphome.const import ( import esphome.config_validation as cv
CONF_VISIBLE, from esphome.const import CONF_BACKGROUND_COLOR, CONF_FOREGROUND_COLOR, CONF_VISIBLE
CONF_FOREGROUND_COLOR,
CONF_BACKGROUND_COLOR, from . import CONF_NEXTION_ID, Nextion
)
from . import CONF_NEXTION_ID
from . import Nextion
CONF_VARIABLE_NAME = "variable_name" CONF_VARIABLE_NAME = "variable_name"
CONF_COMPONENT_NAME = "component_name" CONF_COMPONENT_NAME = "component_name"