Max has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11975 )

Change subject: Improve code style
......................................................................

Improve code style

* reorder imports to make pylint3 happy
* drop unused imports
* use proper spacing for list constants
* don't use reserved names for internal variables

The check was run as follows:
pylint3 -d C0103,C0301,C0410,C0326,R0913,R0901 ...
to disable useless warnings.

Change-Id: I5b90ee790f73dc509081401776911f25e43f1801
---
M osmopy/trap_helper.py
M scripts/ctrl2cgi.py
M scripts/soap.py
3 files changed, 21 insertions(+), 23 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/osmopy/trap_helper.py b/osmopy/trap_helper.py
index d07ebd3..d4a3b75 100644
--- a/osmopy/trap_helper.py
+++ b/osmopy/trap_helper.py
@@ -25,8 +25,6 @@
 import sys, os, datetime, signal, logging, logging.handlers
 from functools import partial
 from osmopy.osmo_ipa import Ctrl
-from osmopy.twisted_ipa import CTRL
-from twisted.internet import defer

 # keys from OpenBSC openbsc/src/libbsc/bsc_rf_ctrl.c, values SOAP-specific
 oper = { 'inoperational' : 0, 'operational' : 1 }
diff --git a/scripts/ctrl2cgi.py b/scripts/ctrl2cgi.py
index 6818b2a..1d6813d 100755
--- a/scripts/ctrl2cgi.py
+++ b/scripts/ctrl2cgi.py
@@ -24,17 +24,17 @@

 __version__ = "0.0.4" # bump this on every non-trivial change

-from twisted.internet import defer, reactor
-from osmopy.twisted_ipa import CTRL, IPAFactory, __version__ as 
twisted_ipa_version
-from osmopy.osmo_ipa import Ctrl
-from treq import post, collect
-from functools import partial
-from osmopy.trap_helper import reloader, debug_init, get_type, get_r, p_h, 
make_params, comm_proc
-from distutils.version import StrictVersion as V # FIXME: use 
NormalizedVersion from PEP-386 when available
-import argparse, datetime, signal, sys, os, logging, logging.handlers
+import argparse, os, logging, logging.handlers
 import hashlib
 import json
 import configparser
+from functools import partial
+from distutils.version import StrictVersion as V # FIXME: use 
NormalizedVersion from PEP-386 when available
+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
+from osmopy.twisted_ipa import CTRL, IPAFactory, __version__ as 
twisted_ipa_version
+from osmopy.osmo_ipa import Ctrl

 # we don't support older versions of TwistedIPA module
 assert V(twisted_ipa_version) > V('0.4')
@@ -48,14 +48,14 @@
     comm_proc(decoded.get('commands'), f, log)

 def gen_hash(params, skey):
-    input = ''
-    for key in 
['time_stamp','position_validity','admin_status','policy_status']:
-        input += str(params.get(key))
-    input += skey
-    for key in ['bsc_id','lat','lon','position_validity']:
-        input += str(params.get(key))
+    inp = ''
+    for key in ['time_stamp', 'position_validity', 'admin_status', 
'policy_status']:
+        inp += str(params.get(key))
+    inp += skey
+    for key in ['bsc_id', 'lat', 'lon', 'position_validity']:
+        inp += str(params.get(key))
     m = hashlib.md5()
-    m.update(input.encode('utf-8'))
+    m.update(inp.encode('utf-8'))
     res = m.hexdigest()
     #print('HASH: \nparams="%r"\ninput="%s" \nres="%s"' %(params, input, res))
     return res
diff --git a/scripts/soap.py b/scripts/soap.py
index 6bf786c..267b4d8 100755
--- a/scripts/soap.py
+++ b/scripts/soap.py
@@ -24,15 +24,15 @@

 __version__ = "0.7.2" # bump this on every non-trivial change

+import argparse, os, logging
+from functools import partial
+from distutils.version import StrictVersion as V # FIXME: use 
NormalizedVersion from PEP-386 when available
 from twisted.internet import defer, reactor
+from suds.client import Client
+from treq import post, collect
+from osmopy.trap_helper import debug_init, get_type, get_r, p_h, make_params, 
comm_proc
 from osmopy.twisted_ipa import CTRL, IPAFactory, __version__ as 
twisted_ipa_version
 from osmopy.osmo_ipa import Ctrl
-from treq import post, collect
-from suds.client import Client
-from functools import partial
-from osmopy.trap_helper import reloader, debug_init, get_type, get_r, p_h, 
make_params, comm_proc
-from distutils.version import StrictVersion as V # FIXME: use 
NormalizedVersion from PEP-386 when available
-import argparse, datetime, signal, sys, os, logging, logging.handlers

 # we don't support older versions of TwistedIPA module
 assert V(twisted_ipa_version) > V('0.4')

--
To view, visit https://gerrit.osmocom.org/11975
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: merged
Gerrit-Change-Id: I5b90ee790f73dc509081401776911f25e43f1801
Gerrit-Change-Number: 11975
Gerrit-PatchSet: 2
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: daniel <dwillm...@sysmocom.de>

Reply via email to