Change in python/osmo-python-tests[master]: ctrl2cgi: update comments

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Fri Dec 21 17:44:22 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/12423


Change subject: ctrl2cgi: update comments
......................................................................

ctrl2cgi: update comments

* remove obsolete comments
* add missing function comments

Change-Id: I5ace594adbccf7ce7eda2c19aa639a4f46285c25
---
M scripts/ctrl2cgi.py
1 file changed, 7 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/23/12423/1

diff --git a/scripts/ctrl2cgi.py b/scripts/ctrl2cgi.py
index 3226c1d..2cf386c 100755
--- a/scripts/ctrl2cgi.py
+++ b/scripts/ctrl2cgi.py
@@ -29,7 +29,7 @@
 import json
 import configparser
 from functools import partial
-from distutils.version import StrictVersion as V # FIXME: use NormalizedVersion from PEP-386 when available
+from distutils.version import StrictVersion as V
 from twisted.internet import defer, reactor
 from treq import post, collect
 from osmopy.trap_helper import debug_init, get_type, get_r, p_h, make_params, comm_proc
@@ -58,6 +58,9 @@
     comm_proc(decoded.get('commands'), bid, f, log)
 
 def gen_hash(params, skey):
+    """
+    Make mandatory parameter for http request
+    """
     inp = ''
     for key in ['time_stamp', 'position_validity', 'admin_status', 'policy_status']:
         inp += str(params.get(key))
@@ -67,10 +70,12 @@
     m = hashlib.md5()
     m.update(inp.encode('utf-8'))
     res = m.hexdigest()
-    #print('HASH: \nparams="%r"\ninput="%s" \nres="%s"' %(params, input, res))
     return res
 
 def make_async_req(ts, dst, par, f_write, f_log, tout):
+    """
+    Assemble deferred request parameters and partially instantiate response handler
+    """
     d = post(dst, par, timeout=tout)
     d.addCallback(collect, partial(handle_reply, ts, datetime.datetime.now(), par['bsc_id'], f_write, f_log))
     d.addErrback(lambda e: f_log.critical("HTTP POST error %s while trying to register BSC %s on %s (timeout %d)" % (repr(e), par['bsc_id'], dst, tout))) # handle HTTP errors

-- 
To view, visit https://gerrit.osmocom.org/12423
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ace594adbccf7ce7eda2c19aa639a4f46285c25
Gerrit-Change-Number: 12423
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181221/9ef96134/attachment.htm>


More information about the gerrit-log mailing list