[Git][NTPsec/ntpsec][master] pep8/pyflakes cleanup.
Ian Bruene
gitlab at mg.gitlab.com
Wed Feb 28 19:03:31 UTC 2018
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
fbbead74 by Ian Bruene at 2018-02-28T13:03:03-06:00
pep8/pyflakes cleanup.
- - - - -
2 changed files:
- ntpclients/ntpsnmpd.py
- pylib/agentx.py
Changes:
=====================================
ntpclients/ntpsnmpd.py
=====================================
--- a/ntpclients/ntpsnmpd.py
+++ b/ntpclients/ntpsnmpd.py
@@ -8,7 +8,6 @@ import os
import getopt
import time
import socket
-import select
import subprocess
import shlex
@@ -138,10 +137,7 @@ class DataSource(ntp.agentx.MIBControl):
# ntpEntStatPktSent Counter32
2: {},
# ntpEntStatPktRecived Counter32
- 3: {}}
- }}
- }}
- },
+ 3: {}}}}}}},
# ntpAssociation
3: {"subids":
# ntpAssociationTable
@@ -173,9 +169,7 @@ class DataSource(ntp.agentx.MIBControl):
9: {"subids": self.sub_assocDelay},
# ntpAssocStatusDispersion
# DisplayString
- 10: {"subids": self.sub_assocDispersion}}
- }}
- },
+ 10: {"subids": self.sub_assocDispersion}}}}},
# ntpAssociationStatisticsTable
# SEQUENCE of ntpAssociationStatisticsEntry
2: {"subids":
@@ -188,10 +182,8 @@ class DataSource(ntp.agentx.MIBControl):
2: {"subids": self.sub_assocStatOutPkts},
# ntpAssocStatProtocolError
# Counter32
- 3: {"subids": self.sub_assocStatProtoErr}}
- }}
- }}
- },
+ 3: {"subids":
+ self.sub_assocStatProtoErr}}}}}}},
# ntpEntControl
4: {"subids":
# ntpEntHeartbeatInterval unit32
@@ -199,14 +191,11 @@ class DataSource(ntp.agentx.MIBControl):
"writer": self.cbw_entHeartbeatInterval},
# ntpEntNotifBits BITS {...}
2: {"reader": self.cbr_entNotifBits,
- "writer": self.cbw_entNotifBits,}}
- },
+ "writer": self.cbw_entNotifBits}}},
# ntpEntNotifObjects
5: {"subids":
# ntpEntNotifMessage utf8str
- {1: {"reader": self.cbr_entNotifMessage}}
- }}
- },
+ {1: {"reader": self.cbr_entNotifMessage}}}}},
# ntpEntConformance
2: {"subids":
# ntpEntCompliances
@@ -214,8 +203,7 @@ class DataSource(ntp.agentx.MIBControl):
# ntpEntNTPCompliance
{1: {},
# ntpEntSNTPCompliance
- 2: {}}
- },
+ 2: {}}},
# ntpEntGroups
2: {"subids":
# ntpEntObjectsGroup1 OBJECTS {...}
@@ -223,10 +211,7 @@ class DataSource(ntp.agentx.MIBControl):
# ntpEntObjectsGroup2 OBJECTS {...}
2: {},
# ntpEntNotifGroup NOTIFICATIONS {...}
- 3: {}}
- }}
- }
- }
+ 3: {}}}}}}
ntp.agentx.MIBControl.__init__(self, oidTree, mibRoot=ntpRootOID)
self.session = ntp.packet.ControlSession()
self.hostname = hostname if hostname else DEFHOST
@@ -465,7 +450,7 @@ class DataSource(ntp.agentx.MIBControl):
def cbr_entNotifBits(self, oid):
# BITS
- data = ax.bools2Bits((False, # notUsed(0)
+ data = ax.bools2Bits((False, # notUsed(0)
self.notifyModeChange,
self.notifyStratumChange,
self.notifySyspeerChange,
@@ -706,6 +691,7 @@ class DataSource(ntp.agentx.MIBControl):
if (currentTime - self.lastNotifyCheck) < self.notifySpinTime:
return
self.lastNotifyCheck = currentTime
+
if self.notifyModeChange is True:
self.doNotifyModeChange(control)
@@ -898,6 +884,7 @@ class DataSource(ntp.agentx.MIBControl):
def misc_loadDynamicSettings(self):
if self.settingsFilename is None:
return
+
def boolify(d, k):
return True if d[k] == "True" else False
optionList = ("notify-mode-change", "notify-stratum-change",
@@ -1023,6 +1010,7 @@ class DataSource(ntp.agentx.MIBControl):
def dynamicCallbackPeerdata(self, variable, raw, valueType):
rawindex = 1 if raw is True else 0
+
def handler(oid, associd):
pdata = self.misc_getPeerData()
if pdata is None:
=====================================
pylib/agentx.py
=====================================
--- a/pylib/agentx.py
+++ b/pylib/agentx.py
@@ -5,6 +5,7 @@ from __future__ import print_function, division
import select
import time
+import sys
try:
import ntp.util
@@ -124,7 +125,7 @@ class MIBControl:
class PacketControl:
def __init__(self, sock, dbase, spinGap=0.001, timeout=defaultTimeout,
logfp=None, debug=10000):
- self.log = (lambda txt, dbg : ntp.util.dolog(logfp, txt, debug, dbg))
+ self.log = (lambda txt, dbg: ntp.util.dolog(logfp, txt, debug, dbg))
# take a pre-made socket instead of making our own so that
# PacketControl doesn't have to know or care about implementation
self.socket = sock
@@ -277,6 +278,7 @@ class PacketControl:
tid = self.highestTransactionID + 5 # +5 to avoid collisions
self.highestTransactionID = tid
pkt = ax.PingPDU(True, self.sessionID, tid, 1)
+
def callback(resp, orig):
if resp is None: # Timed out. Need to restart the session.
# Er, problem: Can't handle reconnect from inside PacketControl
@@ -289,6 +291,7 @@ class PacketControl:
tid = self.highestTransactionID + 5 # +5 to avoid collisions
self.highestTransactionID = tid
pkt = ax.NotifyPDU(True, self.sessionID, tid, 1, varbinds, context)
+
def resendNotify(pkt, orig):
if pkt is None:
self.sendPacket(orig, True, callback=resendNotify)
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fbbead74c7415adec4c40050f9ea67fb15e329d2
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fbbead74c7415adec4c40050f9ea67fb15e329d2
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180228/953f5063/attachment.html>
More information about the vc
mailing list