Просмотр исходного кода

fix(migration): import errno.ENOENT before use

Jason Rumney 19 часов назад
Родитель
Сommit
636336ff10
1 измененных файлов с 23 добавлено и 22 удалено
  1. 23 22
      custom_components/tuya_local/__init__.py

+ 23 - 22
custom_components/tuya_local/__init__.py

@@ -7,6 +7,7 @@ investigation into Goldair's tuyapi statuses
 https://github.com/codetheweb/tuyapi/issues/31.
 """
 
+from errno import ENOENT
 import logging
 
 from homeassistant.config_entries import ConfigEntry
@@ -189,7 +190,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id(entity_entry):
@@ -272,7 +273,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id12(entity_entry):
@@ -315,7 +316,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13(entity_entry):
@@ -371,7 +372,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_2(entity_entry):
@@ -415,7 +416,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_3(entity_entry):
@@ -478,7 +479,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_5(entity_entry):
@@ -504,7 +505,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_6(entity_entry):
@@ -541,7 +542,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_7(entity_entry):
@@ -564,7 +565,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_8(entity_entry):
@@ -611,7 +612,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_9(entity_entry):
@@ -634,7 +635,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_10(entity_entry):
@@ -691,7 +692,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_13(entity_entry):
@@ -718,7 +719,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_15(entity_entry):
@@ -760,7 +761,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_16(entity_entry):
@@ -787,7 +788,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_17(entity_entry):
@@ -817,7 +818,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_18(entity_entry):
@@ -841,7 +842,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_19(entity_entry):
@@ -871,7 +872,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_20(entity_entry):
@@ -899,7 +900,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_21(entity_entry):
@@ -955,7 +956,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_23(entity_entry):
@@ -984,7 +985,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_24(entity_entry):
@@ -1010,7 +1011,7 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
             entry.data[CONF_TYPE],
         )
         if conf_file is None:
-            raise FileNotFoundError(errno.ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
+            raise FileNotFoundError(ENOENT, NOT_FOUND, entry.data[CONF_TYPE])
 
         @callback
         def update_unique_id13_25(entity_entry):