Skip to content

Commit 5f5575f

Browse files
committed
Code formatting fixes
1 parent a6f837e commit 5f5575f

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

examples/simple_agent.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
(options, args) = parser.parse_args()
6868

6969
# Get terminal width for usage with pprint
70-
rows,columns = os.popen("stty size", "r").read().split()
70+
rows, columns = os.popen("stty size", "r").read().split()
7171

7272
# First, create an instance of the netsnmpAgent class. We specify the
7373
# fully-qualified path to SIMPLE-MIB.txt ourselves here, so that you
@@ -86,59 +86,59 @@
8686

8787
# Then we create all SNMP scalar variables we're willing to serve.
8888
simpleInteger = agent.Integer32(
89-
oidstr = "SIMPLE-MIB::simpleInteger"
89+
oidstr = "SIMPLE-MIB::simpleInteger"
9090
)
9191
simpleIntegerContext1 = agent.Integer32(
92-
oidstr = "SIMPLE-MIB::simpleInteger",
93-
context = "context1",
94-
initval = 200,
92+
oidstr = "SIMPLE-MIB::simpleInteger",
93+
context = "context1",
94+
initval = 200,
9595
)
9696
simpleIntegerRO = agent.Integer32(
9797
oidstr = "SIMPLE-MIB::simpleIntegerRO",
9898
writable = False
9999
)
100100
simpleUnsigned = agent.Unsigned32(
101-
oidstr = "SIMPLE-MIB::simpleUnsigned"
101+
oidstr = "SIMPLE-MIB::simpleUnsigned"
102102
)
103103
simpleUnsignedRO = agent.Unsigned32(
104104
oidstr = "SIMPLE-MIB::simpleUnsignedRO",
105105
writable = False
106106
)
107107
simpleCounter32 = agent.Counter32(
108-
oidstr = "SIMPLE-MIB::simpleCounter32"
108+
oidstr = "SIMPLE-MIB::simpleCounter32"
109109
)
110110
simpleCounter32Context2 = agent.Counter32(
111-
oidstr = "SIMPLE-MIB::simpleCounter32",
112-
context = "context2",
113-
initval = pow(2,32) - 10, # To rule out endianness bugs
111+
oidstr = "SIMPLE-MIB::simpleCounter32",
112+
context = "context2",
113+
initval = pow(2,32) - 10, # To rule out endianness bugs
114114
)
115115
simpleCounter64 = agent.Counter64(
116-
oidstr = "SIMPLE-MIB::simpleCounter64"
116+
oidstr = "SIMPLE-MIB::simpleCounter64"
117117
)
118118
simpleCounter64Context2 = agent.Counter64(
119-
oidstr = "SIMPLE-MIB::simpleCounter64",
120-
context = "context2",
121-
initval = pow(2,64) - 10, # To rule out endianness bugs
119+
oidstr = "SIMPLE-MIB::simpleCounter64",
120+
context = "context2",
121+
initval = pow(2,64) - 10, # To rule out endianness bugs
122122
)
123123
simpleTimeTicks = agent.TimeTicks(
124-
oidstr = "SIMPLE-MIB::simpleTimeTicks"
124+
oidstr = "SIMPLE-MIB::simpleTimeTicks"
125125
)
126126
simpleIpAddress = agent.IpAddress(
127-
oidstr = "SIMPLE-MIB::simpleIpAddress",
128-
initval="127.0.0.1"
127+
oidstr = "SIMPLE-MIB::simpleIpAddress",
128+
initval = "127.0.0.1"
129129
)
130130
simpleOctetString = agent.OctetString(
131-
oidstr = "SIMPLE-MIB::simpleOctetString",
132-
initval = "Hello World"
131+
oidstr = "SIMPLE-MIB::simpleOctetString",
132+
initval = "Hello World"
133133
)
134134
simpleDisplayString = agent.DisplayString(
135-
oidstr = "SIMPLE-MIB::simpleDisplayString",
136-
initval = "Nice to meet you"
135+
oidstr = "SIMPLE-MIB::simpleDisplayString",
136+
initval = "Nice to meet you"
137137
)
138138

139139
# Create the first table
140140
firstTable = agent.Table(
141-
oidstr = "SIMPLE-MIB::firstTable",
141+
oidstr = "SIMPLE-MIB::firstTable",
142142
indexes = [
143143
agent.DisplayString()
144144
],
@@ -167,7 +167,7 @@
167167

168168
# Create the second table
169169
secondTable = agent.Table(
170-
oidstr = "SIMPLE-MIB::secondTable",
170+
oidstr = "SIMPLE-MIB::secondTable",
171171
indexes = [
172172
agent.Integer32()
173173
],
@@ -192,11 +192,11 @@
192192

193193
# Create the third table
194194
thirdTable = agent.Table(
195-
oidstr = "SIMPLE-MIB::thirdTable",
196-
indexes = [
195+
oidstr = "SIMPLE-MIB::thirdTable",
196+
indexes = [
197197
agent.IpAddress()
198198
],
199-
columns = [
199+
columns = [
200200
(2, agent.DisplayString("Broadcast")),
201201
(3, agent.IpAddress("192.168.0.255"))
202202
],

netsnmpagent.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ def IpAddress(self, initval = "0.0.0.0", oidstr = None, writable = True, context
584584

585585
class IpAddress(object):
586586
def __init__(self):
587-
self._flags = WATCHER_FIXED_SIZE
588-
self._asntype = ASN_IPADDRESS
589-
self._cvar = ctypes.c_uint(0)
587+
self._flags = WATCHER_FIXED_SIZE
588+
self._asntype = ASN_IPADDRESS
589+
self._cvar = ctypes.c_uint(0)
590590
self._data_size = ctypes.sizeof(self._cvar)
591591
self._max_size = self._data_size
592592
self.update(initval)
@@ -628,7 +628,7 @@ def cref(self, **kwargs):
628628
# https://sourceforge.net/p/net-snmp/bugs/2136/) we have
629629
# to convert the value to host byte order if it shall be
630630
# used as table index.
631-
if kwargs.get('is_table_index', False) == False:
631+
if kwargs.get("is_table_index", False) == False:
632632
return ctypes.byref(self._cvar)
633633
else:
634634
_cidx = ctypes.c_uint(0)
@@ -825,7 +825,7 @@ def value(self):
825825

826826
# Registered OID
827827
rootoidlen = self._handler_reginfo.contents.rootoid_len
828-
for i in range(0,rootoidlen):
828+
for i in range(0, rootoidlen):
829829
fulloid[i] = self._handler_reginfo.contents.rootoid[i]
830830

831831
# Entry
@@ -835,12 +835,12 @@ def value(self):
835835
# table_data_set handlers, we do not have one here. No
836836
# biggie, using a fixed value will do for our purposes as
837837
# we'll do away with anything left of the last dot below.
838-
fulloid[rootoidlen+1] = 2
838+
fulloid[rootoidlen + 1] = 2
839839

840840
# Index data
841841
indexoidlen = row.contents.index_oid_len
842-
for i in range(0,indexoidlen):
843-
fulloid[rootoidlen+2+i] = row.contents.index_oid[i]
842+
for i in range(0, indexoidlen):
843+
fulloid[rootoidlen + 2 + i] = row.contents.index_oid[i]
844844

845845
# Convert the full oid to its string representation
846846
oidcstr = ctypes.create_string_buffer(MAX_OID_LEN)

0 commit comments

Comments
 (0)