Skip to content

Commit fe4ce72

Browse files
committed
Refactoring
1 parent aca6677 commit fe4ce72

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

SNMP__pysnmp__examples/get_table__get_CPU.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ def get_iterator(host: str, port: int = 161, community: str = '') -> Iterator:
3232

3333
for i, (errorIndication, errorStatus, errorIndex, varBinds) in enumerate(items, 1):
3434
if errorIndication:
35-
print(errorIndication)
35+
print(f'Error indication: {errorIndication}')
3636

3737
elif errorStatus:
38-
print('%s at %s' % (errorStatus.prettyPrint(),
39-
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
38+
print(f'Error status {errorStatus.prettyPrint()!r} at {errorIndex and varBinds[int(errorIndex) - 1][0] or "?"}')
4039

4140
else:
4241
for varBind in varBinds:

SNMP__pysnmp__examples/hello_world.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
errorIndication, errorStatus, errorIndex, varBinds = next(iterator)
2525

2626
if errorIndication:
27-
print(errorIndication)
27+
print(f'Error indication: {errorIndication}')
2828

2929
elif errorStatus:
30-
print('%s at %s' % (errorStatus.prettyPrint(),
31-
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
30+
print(f'Error status {errorStatus.prettyPrint()!r} at {errorIndex and varBinds[int(errorIndex) - 1][0] or "?"}')
3231

3332
else:
3433
for varBind in varBinds:

SNMP__pysnmp__examples/hello_world__fix_imports.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
errorIndication, errorStatus, errorIndex, varBinds = next(iterator)
2525

2626
if errorIndication:
27-
print(errorIndication)
27+
print(f'Error indication: {errorIndication}')
2828

2929
elif errorStatus:
30-
print('%s at %s' % (errorStatus.prettyPrint(),
31-
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
30+
print(f'Error status {errorStatus.prettyPrint()!r} at {errorIndex and varBinds[int(errorIndex) - 1][0] or "?"}')
3231

3332
else:
3433
for varBind in varBinds:

0 commit comments

Comments
 (0)