diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a954af4a..0de82cf2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/ambv/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black args: diff --git a/esphome/components/b_parasite/sensor.py b/esphome/components/b_parasite/sensor.py index 201685adc..1b65bf7f1 100644 --- a/esphome/components/b_parasite/sensor.py +++ b/esphome/components/b_parasite/sensor.py @@ -80,7 +80,7 @@ async def to_code(config): cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) - for (config_key, setter) in [ + for config_key, setter in [ (CONF_TEMPERATURE, var.set_temperature), (CONF_HUMIDITY, var.set_humidity), (CONF_BATTERY_VOLTAGE, var.set_battery_voltage), diff --git a/esphome/components/esp8266/__init__.py b/esphome/components/esp8266/__init__.py index 8715a3b4e..59a1f2cd8 100644 --- a/esphome/components/esp8266/__init__.py +++ b/esphome/components/esp8266/__init__.py @@ -240,7 +240,6 @@ async def to_code(config): # Called by writer.py def copy_files(): - dir = os.path.dirname(__file__) post_build_file = os.path.join(dir, "post_build.py.script") copy_file_if_changed( diff --git a/esphome/components/honeywellabp/sensor.py b/esphome/components/honeywellabp/sensor.py index 720a96b93..ed8bff6e9 100644 --- a/esphome/components/honeywellabp/sensor.py +++ b/esphome/components/honeywellabp/sensor.py @@ -52,7 +52,6 @@ CONFIG_SCHEMA = ( async def to_code(config): - var = cg.new_Pvariable(config[CONF_ID]) await cg.register_component(var, config) await spi.register_spi_device(var, config) diff --git a/esphome/components/nextion/base_component.py b/esphome/components/nextion/base_component.py index 06216e9ce..b2a857c88 100644 --- a/esphome/components/nextion/base_component.py +++ b/esphome/components/nextion/base_component.py @@ -92,7 +92,6 @@ CONFIG_SWITCH_COMPONENT_SCHEMA = CONFIG_SENSOR_COMPONENT_SCHEMA.extend( async def setup_component_core_(var, config, arg): - if CONF_VARIABLE_NAME in config: cg.add(var.set_variable_name(config[CONF_VARIABLE_NAME])) elif CONF_COMPONENT_NAME in config: diff --git a/esphome/components/nextion/sensor/__init__.py b/esphome/components/nextion/sensor/__init__.py index b022007dd..eefbe34d5 100644 --- a/esphome/components/nextion/sensor/__init__.py +++ b/esphome/components/nextion/sensor/__init__.py @@ -69,7 +69,6 @@ CONFIG_SCHEMA = cv.All( async def to_code(config): - hub = await cg.get_variable(config[CONF_NEXTION_ID]) var = cg.new_Pvariable(config[CONF_ID], hub) await cg.register_component(var, config) diff --git a/esphome/components/pmsa003i/sensor.py b/esphome/components/pmsa003i/sensor.py index ceca791cd..ef620614a 100644 --- a/esphome/components/pmsa003i/sensor.py +++ b/esphome/components/pmsa003i/sensor.py @@ -122,7 +122,6 @@ async def to_code(config): cg.add(var.set_standard_units(config[CONF_STANDARD_UNITS])) for key, funcName in TYPES.items(): - if key in config: sens = await sensor.new_sensor(config[key]) cg.add(getattr(var, funcName)(sens)) diff --git a/esphome/components/script/__init__.py b/esphome/components/script/__init__.py index 907d7bf0e..6337d89bc 100644 --- a/esphome/components/script/__init__.py +++ b/esphome/components/script/__init__.py @@ -62,7 +62,6 @@ def assign_declare_id(value): def parameters_to_template(args): - template_args = [] func_args = [] script_arg_names = [] diff --git a/esphome/components/sht4x/sensor.py b/esphome/components/sht4x/sensor.py index 9fb8fc969..e195bb9ac 100644 --- a/esphome/components/sht4x/sensor.py +++ b/esphome/components/sht4x/sensor.py @@ -98,7 +98,6 @@ async def to_code(config): cg.add(var.set_heater_duty_value(config[CONF_HEATER_MAX_DUTY])) for key, funcName in TYPES.items(): - if key in config: sens = await sensor.new_sensor(config[key]) cg.add(getattr(var, funcName)(sens)) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index 0ff536267..6c7188a4a 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -977,7 +977,6 @@ class LogoutHandler(BaseHandler): class SecretKeysRequestHandler(BaseHandler): @authenticated def get(self): - filename = None for secret_filename in const.SECRETS_FILES: diff --git a/requirements_test.txt b/requirements_test.txt index 6f03f005d..a1c084508 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,6 +1,6 @@ pylint==2.15.10 flake8==6.0.0 # also change in .pre-commit-config.yaml when updating -black==22.12.0 # also change in .pre-commit-config.yaml when updating +black==23.1.0 # also change in .pre-commit-config.yaml when updating pyupgrade==3.3.1 # also change in .pre-commit-config.yaml when updating pre-commit