Kaynağa Gözat

Clean up unused imports

Vassilis Panos 6 yıl önce
ebeveyn
işleme
2e51a3ebda

+ 2 - 2
custom_components/smartir/__init__.py

@@ -108,7 +108,7 @@ async def _update(hass, branch, do_update=False, notify_if_latest=True):
                             dest = os.path.join(COMPONENT_ABS_DIR, file)
                             os.makedirs(os.path.dirname(dest), exist_ok=True)
                             await Helper.downloader(source, dest)
-                        except:
+                        except Exception:
                             has_errors = True
                             _LOGGER.error("Error updating %s. Please update the file manually.", file)
 
@@ -120,7 +120,7 @@ async def _update(hass, branch, do_update=False, notify_if_latest=True):
                         hass.components.persistent_notification.async_create(
                             "Successfully updated to {}. Please restart Home Assistant."
                             .format(last_version), title='SmartIR')
-    except:
+    except Exception:
        _LOGGER.error("An error occurred while checking for updates.")
 
 class Helper():

+ 2 - 2
custom_components/smartir/climate.py

@@ -69,7 +69,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
                             "codes/climate/{}.json")
 
             await Helper.downloader(codes_source.format(device_code), device_json_path)
-        except:
+        except Exception:
             _LOGGER.error("There was an error while downloading the device Json file. " \
                           "Please check your internet connection or if the device code " \
                           "exists on GitHub. If the problem still exists please " \
@@ -79,7 +79,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     with open(device_json_path) as j:
         try:
             device_data = json.load(j)
-        except:
+        except Exception:
             _LOGGER.error("The device Json file is invalid")
             return
 

+ 0 - 2
custom_components/smartir/controller.py

@@ -1,11 +1,9 @@
-import asyncio
 from base64 import b64encode
 import binascii
 import requests
 import logging
 
 from homeassistant.const import ATTR_ENTITY_ID
-from homeassistant.core import split_entity_id
 from . import Helper
 
 _LOGGER = logging.getLogger(__name__)

+ 2 - 2
custom_components/smartir/fan.py

@@ -58,7 +58,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
                             "codes/fan/{}.json")
 
             await Helper.downloader(codes_source.format(device_code), device_json_path)
-        except:
+        except Exception:
             _LOGGER.error("There was an error while downloading the device Json file. " \
                           "Please check your internet connection or if the device code " \
                           "exists on GitHub. If the problem still exists please " \
@@ -68,7 +68,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     with open(device_json_path) as j:
         try:
             device_data = json.load(j)
-        except:
+        except Exception:
             _LOGGER.error("The device JSON file is invalid")
             return
 

+ 2 - 3
custom_components/smartir/media_player.py

@@ -13,7 +13,6 @@ from homeassistant.components.media_player.const import (
     SUPPORT_SELECT_SOURCE, MEDIA_TYPE_CHANNEL)
 from homeassistant.const import (
     CONF_NAME, STATE_OFF, STATE_ON, STATE_UNKNOWN)
-from homeassistant.core import callback
 import homeassistant.helpers.config_validation as cv
 from homeassistant.helpers.restore_state import RestoreEntity
 from . import COMPONENT_ABS_DIR, Helper
@@ -63,7 +62,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
                             "codes/media_player/{}.json")
 
             await Helper.downloader(codes_source.format(device_code), device_json_path)
-        except:
+        except Exception:
             _LOGGER.error("There was an error while downloading the device Json file. " \
                           "Please check your internet connection or if the device code " \
                           "exists on GitHub. If the problem still exists please " \
@@ -73,7 +72,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     with open(device_json_path) as j:
         try:
             device_data = json.load(j)
-        except:
+        except Exception:
             _LOGGER.error("The device JSON file is invalid")
             return