Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake8 35 #11972

Merged
merged 3 commits into from Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions homeassistant/components/feedreader.py
Expand Up @@ -153,8 +153,7 @@ def _fetch_data(self):
with self._lock, open(self._data_file, 'rb') as myfile:
self._data = pickle.load(myfile) or {}
self._cache_outdated = False
# pylint: disable=bare-except
except:
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.error("Error loading data from pickled file %s",
self._data_file)

Expand All @@ -172,8 +171,7 @@ def put_timestamp(self, url, timestamp):
url, self._data_file)
try:
pickle.dump(self._data, myfile)
# pylint: disable=bare-except
except:
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.error(
"Error saving pickled data to %s", self._data_file)
self._cache_outdated = True
6 changes: 3 additions & 3 deletions homeassistant/components/media_player/bluesound.py
Expand Up @@ -165,7 +165,7 @@ def _internal_update_sync_status(
try:
resp = yield from self.send_bluesound_command(
'SyncStatus', raise_timeout, raise_timeout)
except:
except Exception:
raise

if not resp:
Expand Down Expand Up @@ -202,7 +202,7 @@ def _start_poll_command(self):

except CancelledError:
_LOGGER.debug("Stopping the polling of node %s", self._name)
except:
except Exception:
_LOGGER.exception("Unexpected error in %s", self._name)
raise

Expand All @@ -229,7 +229,7 @@ def async_init(self):
_LOGGER.info("Node %s is offline, retrying later", self.host)
self._retry_remove = async_track_time_interval(
self._hass, self.async_init, NODE_RETRY_INITIATION)
except:
except Exception:
_LOGGER.exception("Unexpected when initiating error in %s",
self.host)
raise
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/clementine.py
Expand Up @@ -97,7 +97,7 @@ def update(self):
self._track_artist = client.current_track['track_artist']
self._track_album_name = client.current_track['track_album']

except:
except Exception:
self._state = STATE_OFF
raise

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/sensor/fritzbox_callmonitor.py
Expand Up @@ -70,8 +70,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
phonebook = FritzBoxPhonebook(
host=host, port=port, username=username, password=password,
phonebook_id=phonebook_id, prefixes=prefixes)
# pylint: disable=bare-except
except:
except: # noqa: E722 # pylint: disable=bare-except
phonebook = None
_LOGGER.warning("Phonebook with ID %s not found on Fritz!Box",
phonebook_id)
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/sensor/qnap.py
Expand Up @@ -197,7 +197,6 @@ def __init__(self, config):

self.data = {}

# pylint: disable=bare-except
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Update API information and store locally."""
Expand All @@ -207,7 +206,7 @@ def update(self):
self.data["smart_drive_health"] = self._api.get_smart_disk_health()
self.data["volumes"] = self._api.get_volumes()
self.data["bandwidth"] = self._api.get_bandwidth()
except:
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.exception("Failed to fetch QNAP stats from the NAS")


Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/sensor/synologydsm.py
Expand Up @@ -136,15 +136,14 @@ def run_setup(event):
class SynoApi(object):
"""Class to interface with Synology DSM API."""

# pylint: disable=bare-except
def __init__(self, host, port, username, password, temp_unit):
"""Initialize the API wrapper class."""
from SynologyDSM import SynologyDSM
self.temp_unit = temp_unit

try:
self._api = SynologyDSM(host, port, username, password)
except:
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.error("Error setting up Synology DSM")

# Will be updated when update() gets called.
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/spc.py
Expand Up @@ -151,7 +151,7 @@ def _ws_process_message(message, async_callback, *args):
"Unsuccessful websocket message delivered, ignoring: %s", message)
try:
yield from async_callback(message['data']['sia'], *args)
except: # pylint: disable=bare-except
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.exception("Exception in callback, ignoring")


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/monkey_patch.py
Expand Up @@ -37,7 +37,7 @@ def add(self, other):
asyncio.tasks.Task._all_tasks = IgnoreCalls()
try:
del asyncio.tasks.Task.__del__
except:
except: # noqa: E722
pass


Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
@@ -1,7 +1,7 @@
# linters such as flake8 and pylint should be pinned, as new releases
# make new things fail. Manually update these pins when pulling in a
# new version
flake8==3.3
flake8==3.5
pylint==1.6.5
mypy==0.560
pydocstyle==1.1.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -2,7 +2,7 @@
# linters such as flake8 and pylint should be pinned, as new releases
# make new things fail. Manually update these pins when pulling in a
# new version
flake8==3.3
flake8==3.5
pylint==1.6.5
mypy==0.560
pydocstyle==1.1.1
Expand Down
3 changes: 1 addition & 2 deletions tests/components/emulated_hue/test_upnp.py
Expand Up @@ -87,10 +87,9 @@ def test_description_xml(self):
self.assertTrue('text/xml' in result.headers['content-type'])

# Make sure the XML is parsable
# pylint: disable=bare-except
try:
ET.fromstring(result.text)
except:
except: # noqa: E722 # pylint: disable=bare-except
self.fail('description.xml is not valid XML!')

def test_create_username(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/components/test_system_log.py
Expand Up @@ -34,7 +34,7 @@ def get_error_log(hass, test_client, expected_count):
def _generate_and_log_exception(exception, log):
try:
raise Exception(exception)
except: # pylint: disable=bare-except
except: # noqa: E722 # pylint: disable=bare-except
_LOGGER.exception(log)


Expand Down