* Add black

Update pre commit

Update pre commit

add empty line

* Format with black
This commit is contained in:
Guillermo Ruffino
2021-03-07 16:03:16 -03:00
committed by GitHub
parent 2b60b0f1fa
commit 69879920eb
398 changed files with 21624 additions and 12644 deletions
+1 -1
View File
@@ -1 +1 @@
CODEOWNERS = ['@OttoWinter']
CODEOWNERS = ["@OttoWinter"]
+36 -21
View File
@@ -2,30 +2,45 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import sensor
from esphome.const import CONF_ECHO_PIN, CONF_ID, CONF_TRIGGER_PIN, \
CONF_TIMEOUT, DEVICE_CLASS_EMPTY, UNIT_METER, ICON_ARROW_EXPAND_VERTICAL
from esphome.const import (
CONF_ECHO_PIN,
CONF_ID,
CONF_TRIGGER_PIN,
CONF_TIMEOUT,
DEVICE_CLASS_EMPTY,
UNIT_METER,
ICON_ARROW_EXPAND_VERTICAL,
)
CONF_PULSE_TIME = 'pulse_time'
CONF_PULSE_TIME = "pulse_time"
ultrasonic_ns = cg.esphome_ns.namespace('ultrasonic')
UltrasonicSensorComponent = ultrasonic_ns.class_('UltrasonicSensorComponent',
sensor.Sensor, cg.PollingComponent)
ultrasonic_ns = cg.esphome_ns.namespace("ultrasonic")
UltrasonicSensorComponent = ultrasonic_ns.class_(
"UltrasonicSensorComponent", sensor.Sensor, cg.PollingComponent
)
CONFIG_SCHEMA = sensor.sensor_schema(
UNIT_METER, ICON_ARROW_EXPAND_VERTICAL, 2, DEVICE_CLASS_EMPTY
).extend({
cv.GenerateID(): cv.declare_id(UltrasonicSensorComponent),
cv.Required(CONF_TRIGGER_PIN): pins.gpio_output_pin_schema,
cv.Required(CONF_ECHO_PIN): pins.internal_gpio_input_pin_schema,
cv.Optional(CONF_TIMEOUT, default='2m'): cv.distance,
cv.Optional(CONF_PULSE_TIME, default='10us'): cv.positive_time_period_microseconds,
cv.Optional('timeout_meter'): cv.invalid("The timeout_meter option has been renamed "
"to 'timeout' in 1.12."),
cv.Optional('timeout_time'): cv.invalid("The timeout_time option has been removed. Please "
"use 'timeout' in 1.12."),
}).extend(cv.polling_component_schema('60s'))
CONFIG_SCHEMA = (
sensor.sensor_schema(UNIT_METER, ICON_ARROW_EXPAND_VERTICAL, 2, DEVICE_CLASS_EMPTY)
.extend(
{
cv.GenerateID(): cv.declare_id(UltrasonicSensorComponent),
cv.Required(CONF_TRIGGER_PIN): pins.gpio_output_pin_schema,
cv.Required(CONF_ECHO_PIN): pins.internal_gpio_input_pin_schema,
cv.Optional(CONF_TIMEOUT, default="2m"): cv.distance,
cv.Optional(
CONF_PULSE_TIME, default="10us"
): cv.positive_time_period_microseconds,
cv.Optional("timeout_meter"): cv.invalid(
"The timeout_meter option has been renamed " "to 'timeout' in 1.12."
),
cv.Optional("timeout_time"): cv.invalid(
"The timeout_time option has been removed. Please "
"use 'timeout' in 1.12."
),
}
)
.extend(cv.polling_component_schema("60s"))
)
def to_code(config):