From 64f89f319b7e0019c350b0c23e1b50466262e619 Mon Sep 17 00:00:00 2001
From: "kuldeep.k@cisinlabs.com" <kuldeep.k@cisinlabs.com>
Date: Mon, 23 Aug 2021 13:19:54 +0530
Subject: [PATCH] Updated code quality imports placement changes, ignore
 comment for logging, Added bare except warning ignore comments & replaced
 unicode by decode function in depends.py

Added bare except warning ignore comments

Reverted pyelliptic import placement change

Replaced unicode by decode function, reveted logging import placement changes & added ignore comment
---
 src/depends.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/depends.py b/src/depends.py
index bce4e695..48d9daf0 100755
--- a/src/depends.py
+++ b/src/depends.py
@@ -3,7 +3,11 @@ Utility functions to check the availability of dependencies
 and suggest how it may be installed
 """
 
+import os
+import re
+import subprocess
 import sys
+from importlib import import_module
 
 # Only really old versions of Python don't have sys.hexversion. We don't
 # support them. The logging module was introduced in Python 2.3
@@ -14,9 +18,7 @@ if not hasattr(sys, 'hexversion') or sys.hexversion < 0x20300F0:
         % sys.version
     )
 
-import logging
-import os
-from importlib import import_module
+import logging  # noqa:E402
 
 # We can now use logging so set up a simple configuration
 formatter = logging.Formatter('%(levelname)s: %(message)s')
@@ -248,7 +250,6 @@ def check_openssl():
     if sys.platform == 'win32':
         paths = ['libeay32.dll']
         if getattr(sys, 'frozen', False):
-            import os.path
             paths.insert(0, os.path.join(sys._MEIPASS, 'libeay32.dll'))
     else:
         paths = ['libcrypto.so', 'libcrypto.so.1.0.0']
@@ -258,7 +259,7 @@ def check_openssl():
             '/usr/local/opt/openssl/lib/libcrypto.dylib',
             './../Frameworks/libcrypto.dylib'
         ])
-    import re
+
     if re.match(r'linux|darwin|freebsd', sys.platform):
         try:
             import ctypes.util
@@ -338,8 +339,6 @@ def check_curses():
         logger.error('The curses interface can not be used.')
         return False
 
-    import subprocess
-
     try:
         subprocess.check_call(['which', 'dialog'])
     except subprocess.CalledProcessError:
@@ -353,7 +352,7 @@ def check_curses():
     # The pythondialog author does not like Python2 str, so we have to use
     # unicode for just the version otherwise we get the repr form which
     # includes the module and class names along with the actual version.
-    logger.info('dialog Utility Version %s', unicode(dialog_util_version))
+    logger.info('dialog Utility Version %s', dialog_util_version.decode('utf-8'))
     return True