[Git][NTPsec/ntpsec][master] Added comments and removed forgotten debugging statements
Ian Bruene
gitlab at mg.gitlab.com
Wed Aug 23 17:29:42 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
1cfb7151 by Ian Bruene at 2017-08-23T12:29:07-05:00
Added comments and removed forgotten debugging statements
- - - - -
1 changed file:
- pylib/packet.py
Changes:
=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -1277,38 +1277,36 @@ class ControlSession:
response += c
instring = not instring
elif (instring is False) and (c == ","):
+ # Separator between key=value pairs, done with this pair
kvpairs.append(response.strip())
response = ""
elif 0 < cord < 127:
+ # if it isn't a special case or garbage, add it
response += c
if len(response) > 0: # The last item won't be caught in the loop
kvpairs.append(response.strip())
items = []
- #print("__parse_value", repr(self.response), repr(kvpairs))
for pair in kvpairs:
- #print("pair:", repr(pair))
if "=" in pair:
key, value = ntp.util.slicedata(pair, pair.index("="))
value = value[1:] # Remove '='
else:
key, value = pair, ""
key, value = key.strip(), value.strip()
- #print("k, v:", repr(key), repr(value))
# Start trying to cast to non-string types
+ # I don't like this block, look for a less ugly method
try:
castedvalue = int(value, 0)
- #print("casted to int")
except ValueError:
try:
castedvalue = float(value)
if (key == "delay") and (raw is False):
+ # Hack for non-raw-mode to get precision
items.append(("delay-s", value))
- #print("casted to float")
except ValueError:
if (value[0] == '"') and (value[-1] == '"'):
value = value[1:-1]
castedvalue = value # for uniform tuples
- #print("stripped string quotes")
else: # fell through everything else, still need casted
castedvalue = value
if raw is True:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1cfb7151cf108209d95ef06c9bac25f35273e837
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1cfb7151cf108209d95ef06c9bac25f35273e837
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/20170823/1c907d52/attachment.html>
More information about the vc
mailing list