From 622beba6ab38151148c8701e8e32f14c2cc9988b Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Wed, 16 Mar 2022 14:28:40 +0100
Subject: [PATCH] de-camelcased some var names

---
 inventory_provider/snmp.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/inventory_provider/snmp.py b/inventory_provider/snmp.py
index 6e974f28..d53eb626 100644
--- a/inventory_provider/snmp.py
+++ b/inventory_provider/snmp.py
@@ -72,13 +72,13 @@ def walk(agent_hostname, community, base_oid):  # pragma: no cover
     :return:
     """
 
-    mibBuilder = builder.MibBuilder()
+    mib_builder = builder.MibBuilder()
     # mibViewController = view.MibViewController(mibBuilder)
     compiler.addMibCompiler(
-        mibBuilder,
+        mib_builder,
         sources=['http://mibs.snmplabs.com/asn1/@mib@'])
     # Pre-load MIB modules we expect to work with
-    mibBuilder.loadModules(
+    mib_builder.loadModules(
         'SNMPv2-MIB',
         'SNMP-COMMUNITY-MIB',
         'RFC1213-MIB')
@@ -86,10 +86,10 @@ def walk(agent_hostname, community, base_oid):  # pragma: no cover
     logger.debug("walking %s: %s" % (agent_hostname, base_oid))
 
     try:
-        for (engineErrorIndication,
-             pduErrorIndication,
-             errorIndex,
-             varBinds) in nextCmd(
+        for (engine_error_indication,
+             pdu_error_indication,
+             error_index,
+             var_binds) in nextCmd(
                 SnmpEngine(),
                 CommunityData(community),
                 UdpTransportTarget((agent_hostname, 161)),
@@ -101,17 +101,17 @@ def walk(agent_hostname, community, base_oid):  # pragma: no cover
 
             # cf. http://snmplabs.com/
             #       pysnmp/examples/hlapi/asyncore/sync/contents.html
-            if engineErrorIndication:
+            if engine_error_indication:
                 raise SNMPWalkError(
                     f'snmp response engine error indication: '
-                    f'{str(engineErrorIndication)} - {agent_hostname}')
-            if pduErrorIndication:
+                    f'{str(engine_error_indication)} - {agent_hostname}')
+            if pdu_error_indication:
                 raise SNMPWalkError(
                     'snmp response pdu error %r at %r' % (
-                        pduErrorIndication,
-                        errorIndex
-                        and varBinds[int(errorIndex) - 1][0] or '?'))
-            if errorIndex != 0:
+                        pdu_error_indication,
+                        error_index
+                        and var_binds[int(error_index) - 1][0] or '?'))
+            if error_index != 0:
                 raise SNMPWalkError(
                     'sanity failure: errorIndex != 0, '
                     'but no error indication')
@@ -120,7 +120,7 @@ def walk(agent_hostname, community, base_oid):  # pragma: no cover
             #     rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]),x[1])
             #         .resolveWithMib(mibViewController)
             #     for x in varBinds]
-            for oid, val in varBinds:
+            for oid, val in var_binds:
                 result = {
                     "oid": _canonify_oid(oid),
                     "value": _cast_snmp_value(val)
-- 
GitLab