Skip to content

Commit 4c69a2a

Browse files
committed
made list check more pythonic
1 parent 4ea9405 commit 4c69a2a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

netsnmpagent.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def num_queued_traps(self):
934934

935935
def queue_trap(self, *args, **kwargs):
936936
'''This method queues a trap to be sent from the main thread loop.
937-
In SNMP v5.7.3 (and likely other version), many traps sent from threads
937+
In SNMP v5.7.3 (and likely other versions), many traps sent from threads
938938
in agentx sub-agents are duplicated. This method and send_queued_traps()
939939
support queueing traps in non-main threads and actually sending them from
940940
the main thread in the "check_and_process loop."
@@ -946,13 +946,14 @@ def send_queued_traps(self):
946946
'''This method must be called from the main thread loop and dequeues and
947947
send all queued traps.
948948
'''
949-
if not len(self.queued_traps):
949+
if not self.queued_traps:
950950
return
951951
with self.trap_lock:
952952
for arg_tuple in self.queued_traps:
953953
(args, kwargs) = arg_tuple
954954
self.send_trap(*args, **kwargs)
955-
self.queued_traps.clear()
955+
self.queued_traps.clear() # Python 3.3+
956+
# self.queued_traps *= 0
956957

957958
def send_trap(self, *args, **kwargs):
958959
'''Send SNMP traps

0 commit comments

Comments
 (0)