Merge pull request #38 from WebF0x/fix_pep8

Fix PEP8
This commit is contained in:
Félix Bouliane 2016-11-09 17:17:20 -05:00 committed by GitHub
commit cda240b7c9
6 changed files with 20 additions and 12 deletions

View File

@ -2,9 +2,14 @@ sudo: required
dist: trusty
language: python
python:
- "2.7"
- "3.4"
matrix:
include:
- python: "2.7"
env: TOX_ENV=py27
- python: "3.5"
env: TOX_ENV=py35
- python: "3.5"
env: TOX_ENV=pep8
before_install:
- sudo apt-get -qq update
@ -13,7 +18,7 @@ before_install:
install:
- pip install tox-travis
script: tox
script: tox -e $TOX_ENV
deploy:
provider: pypi

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.0
envlist = py34,py27,pep8
envlist = py35,py27,pep8
skipsdist = True
[testenv]

View File

@ -121,7 +121,7 @@ class TraversableOidMapping(dict):
set_oid.add(to)
sorted_oids = sorted(set_oid)
index = sorted_oids.index(to)
return sorted_oids[index+1]
return sorted_oids[index + 1]
class PDU(object):

View File

@ -100,11 +100,12 @@ class APCRackPDUOutletConfigIndex(PDUOutletFeature):
class APCRackPDU(PDU):
outlet_count = 8
outlet_index_start = 1
outlet_features = [APCRackPDUOutletControl, APCRackPDUOutletName, APCRackPDUOutletConfigIndex,
APCRackPDUOutletState]
outlet_features = [APCRackPDUOutletControl, APCRackPDUOutletName,
APCRackPDUOutletConfigIndex, APCRackPDUOutletState]
general_features = [
static_info(sysDescr, univ.OctetString("APC Rack PDU (virtualpdu)")),
static_info(sysObjectID, univ.ObjectIdentifier(rPDU_sysObjectID)),
static_info(rPDU_load_status_load, univ.Integer(amp_10)),
static_info(rPDU_load_status_load_state, univ.Integer(phase_load_normal))
static_info(rPDU_load_status_load_state,
univ.Integer(phase_load_normal))
]

View File

@ -13,6 +13,7 @@
# limitations under the License.
from pyasn1.type import univ
from virtualpdu import core
from virtualpdu.pdu import BasePDUOutletStates
from virtualpdu.pdu import PDU

View File

@ -74,12 +74,13 @@ class SNMPPDUHandler(object):
for oid, val in protocol.apiPDU.getVarBinds(request_pdus):
error_index += 1
try:
oid = TraversableOidMapping(self.pdu.oid_mapping).next(to=oid)
oid = TraversableOidMapping(self.pdu.oid_mapping)\
.next(to=oid)
val = self.pdu.oid_mapping[oid].value
except (KeyError, IndexError):
pending_errors.append(
(protocol.apiPDU.setNoSuchInstanceError,
error_index)
(protocol.apiPDU.setNoSuchInstanceError,
error_index)
)
var_binds.append((oid, val))
elif request_pdus.isSameTypeWith(protocol.SetRequestPDU()):