[Git][NTPsec/ntpsec][master] 2 commits: pep8 nits
Gary E. Miller
gitlab at mg.gitlab.com
Tue Feb 7 02:01:37 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
b08bdb43 by Gary E. Miller at 2017-02-06T17:59:04-08:00
pep8 nits
- - - - -
f85949c3 by Gary E. Miller at 2017-02-06T18:00:03-08:00
makeheat: pep8 nit
- - - - -
3 changed files:
- contrib/makeheat
- ntpclients/ntpkeygen
- pylib/util.py
Changes:
=====================================
contrib/makeheat
=====================================
--- a/contrib/makeheat
+++ b/contrib/makeheat
@@ -47,7 +47,7 @@ temp_gate = args.target_temp[0]
while True:
# on a RasPi 3, 200,000 of the m.update() can be one second
- delta = temp_gate - temp
+ delta = temp_gate - temp
if 0 < delta:
# heat it up
m.update("Nobody inspects the spammish repetition")
=====================================
ntpclients/ntpkeygen
=====================================
--- a/ntpclients/ntpkeygen
+++ b/ntpclients/ntpkeygen
@@ -88,7 +88,7 @@ if __name__ == '__main__':
print("usage: ntpkeygen [-M]")
raise SystemExit(0)
- # The seed is ignored by random.SystemRandom,
+ # The seed is ignored by random.SystemRandom,
# even though the docs do not say so.
randomizer = random.SystemRandom()
gen_md5("md5", socket.gethostname())
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -63,50 +63,55 @@ def portsplit(hostname):
hostname = hostname[1:-1] # Strip brackets
return (hostname, portsuffix)
+
def f8dot4(f):
"Scaled floating point formatting to fit in 8 characters"
if f >= 0:
- if f < 1000.0:
- return "%8.4f" % f # xxx.xxxx normal case
- elif f < 10000.0:
- return "%8.3f" % f # xxxx.xxx
- elif f < 100000.0:
- return "%8.2f" % f # xxxxx.xx
- elif f < 1000000.0:
- return "%8.1f" % f # xxxxxx.x
- return "%8d" % f # xxxxxxxx
+ if f < 1000.0:
+ return "%8.4f" % f # xxx.xxxx normal case
+ elif f < 10000.0:
+ return "%8.3f" % f # xxxx.xxx
+ elif f < 100000.0:
+ return "%8.2f" % f # xxxxx.xx
+ elif f < 1000000.0:
+ return "%8.1f" % f # xxxxxx.x
+ return "%8d" % f # xxxxxxxx
+
if f > -100.0:
- return "%8.4f" % f # -xx.xxxx normal case
+ return "%8.4f" % f # -xx.xxxx normal case
elif f > -1000.0:
- return "%8.3f" % f # -xxx.xxx
+ return "%8.3f" % f # -xxx.xxx
elif f > -10000.0:
- return "%8.2f" % f # -xxxx.xx
+ return "%8.2f" % f # -xxxx.xx
elif f > -100000.0:
- return "%8.1f" % f # -xxxxx.x
- return "%8d" % f # -xxxxxxx
+ return "%8.1f" % f # -xxxxx.x
+ return "%8d" % f # -xxxxxxx
+
def f8dot3(f):
"Scaled floating point formatting to fit in 8 characters"
if f >= 0:
- if f < 10000.0:
- return "%8.3f" % f # xxxx.xxx normal case
- elif f < 100000.0:
- return "%8.2f" % f # xxxxx.xx
- elif f < 1000000.0:
- return "%8.1f" % f # xxxxxx.x
- return "%8d" % f # xxxxxxxx
+ if f < 10000.0:
+ return "%8.3f" % f # xxxx.xxx normal case
+ elif f < 100000.0:
+ return "%8.2f" % f # xxxxx.xx
+ elif f < 1000000.0:
+ return "%8.1f" % f # xxxxxx.x
+ return "%8d" % f # xxxxxxxx
+
if f > -1000.0:
- return "%8.3f" % f # -xxx.xxx normal case
+ return "%8.3f" % f # -xxx.xxx normal case
elif f > -10000.0:
- return "%8.2f" % f # -xxxx.xx
+ return "%8.2f" % f # -xxxx.xx
elif f > -100000.0:
- return "%8.1f" % f # -xxxxx.x
- return "%8d" % f # -xxxxxxx
+ return "%8.1f" % f # -xxxxx.x
+ return "%8d" % f # -xxxxxxx
# A hack to avoid repeatedly hammering on DNS when ntpmon runs.
canonicalization_cache = {}
+
def canonicalize_dns(inhost, family=socket.AF_UNSPEC):
"Canonicalize a hostname or numeric IP address."
if inhost in canonicalization_cache:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b9104b2f8b04c94c9f8b08218cd24a13533b5643...f85949c3a0266c7945aa9a8f9b6193a53288cbad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170207/7fd3a9b9/attachment.html>
More information about the vc
mailing list