7 return ''.join([str(string) for string in lst])
10 def debug(desc, *args):
12 print(desc, join_strings(args))
15 def log(desc, arg=None):
22 def print_and_exit(error_code, error_desc):
24 print("status={0}. {1}".format(error_code, '' if not error_desc else error_desc))
26 print("status={0}".format(error_code))
30 def print_name_and_return_code(name, code, with_line=True):
31 if _strings_correct(name, code):
33 print("----------------------------------------")
34 print("{0:30} | {1:6}".format(name, code))
36 print("----------------------------------------")
38 print("name of the item or return code from request is none -> error occurred!!")
41 def _strings_correct(*strings):
42 results = [(string is not None and string != "") for string in strings]
43 return all(results) is True
45 # def parse_cmd_line_params(argv):
46 # print('Number of arguments:', len(sys.argv), 'arguments.')
50 # be_host = 'localhost'
52 # admin_user = 'jh0003'
56 # opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="])
57 # except getopt.GetoptError:
59 # error_and_exit(2, 'Invalid input')
61 # for opt, arg in opts:
66 # elif opt in ("-i", "--ip"):
68 # elif opt in ("-p", "--port"):
70 # elif opt in ("-u", "--user"):
72 # elif opt in ("-s", "--scheme"):
75 # print('scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user)
80 # return scheme, be_host, be_port, admin_user
84 # print(sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http ] '
85 # '[-i <be host> | --ip=<be host>] [-p <be port> | '
86 # '--port=<be port> ] [-u <user userId> | --user=<user userId> ] ')