From ae6f651c7df2239cb00650c4cc16b2eeca6a276b Mon Sep 17 00:00:00 2001 From: Tom Duijf Date: Wed, 7 Oct 2015 23:22:29 +0000 Subject: [PATCH] styling and version for requirement --- .coveragerc | 1 + homeassistant/components/device_tracker/snmp.py | 8 +++++--- requirements_all.txt | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.coveragerc b/.coveragerc index 433a43bea10..d9b4a29a1b5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -40,6 +40,7 @@ omit = homeassistant/components/device_tracker/tomato.py homeassistant/components/device_tracker/tplink.py homeassistant/components/device_tracker/snmp.py + homeassistant/components/discovery.py homeassistant/components/downloader.py homeassistant/components/keyboard.py diff --git a/homeassistant/components/device_tracker/snmp.py b/homeassistant/components/device_tracker/snmp.py index 0ec0663b7c5..9113a1ab98d 100644 --- a/homeassistant/components/device_tracker/snmp.py +++ b/homeassistant/components/device_tracker/snmp.py @@ -47,7 +47,7 @@ from homeassistant.components.device_tracker import DOMAIN MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['pysnmp'] +REQUIREMENTS = ['pysnmp<=4.2.5'] # pylint: disable=unused-argument @@ -124,10 +124,12 @@ class SnmpScanner(object): _LOGGER.exception("SNMPLIB error: {}".format(errIndication)) return if errStatus: - _LOGGER.exception("SNMP error: {} at {}".format(errStatus.prettyPrint(), errIndex and varBindTable[-1][int(errIndex)-1] or '?')) + _LOGGER.exception("SNMP error: {} at {}".format( + errStatus.prettyPrint(), + errIndex and varBindTable[-1][int(errIndex)-1] or '?')) return for varBindTableRow in varBindTable: - for _,val in varBindTableRow: + for _, val in varBindTableRow: mac = binascii.hexlify(val.asOctets()).decode('utf-8') mac = ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)]) devices.append({'mac': mac}) diff --git a/requirements_all.txt b/requirements_all.txt index 14ba1985c7e..1c59b62fabd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -139,5 +139,5 @@ SoCo==0.11.1 https://github.com/adrienbrault/python-plexapi/archive/df2d0847e801d6d5cda920326d693cf75f304f1a.zip#python-plexapi==1.0.2 # python-pysnmp (device_tracker.snmp) -pysnmp +pysnmp>=4.2.5