lf_ftp.py: text and whitespace updates - autopep8

Signed-off-by: Scott Wedge <scott.wedge@candelatech.com>
This commit is contained in:
Scott Wedge
2022-01-31 09:07:32 -06:00
committed by shivam
parent df85ca92f2
commit ae4cac5587

View File

@@ -342,7 +342,6 @@ class FtpTest(LFCliBase):
else:
return float(upper[:-2]) * 10 ** 6
def my_monitor(self, time1):
# data in json format
data = self.json_get("layer4/list?fields=bytes-rd")
@@ -439,11 +438,12 @@ class FtpTest(LFCliBase):
return create_dict
def convert_min_in_time(self, total_minutes):
'''
# Get hours with floor division
hours = total_minutes // 60
# Get additional minutes with modulus
minutes = total_minutes % 60
'''
# Create time as a string
time_string = str("%d:%02d" % (divmod(total_minutes, 60))) + ":00" + ":000000"
@@ -475,7 +475,7 @@ class FtpTest(LFCliBase):
else:
self.rows_head.append(str(self.num_stations // 2) + "+" + str(self.num_stations // 2) + " Clients-2.4G+5G")
#creating dict for a table
# creating dict for a table
table_dict_pass_fail = {}
i = 0
table_dict_pass_fail[""] = self.rows_head
@@ -537,7 +537,7 @@ class FtpTest(LFCliBase):
return table_dict_time
def generate_graph_time(self,result_data, x_axis, band, size):
def generate_graph_time(self, result_data, x_axis, band, size):
'''Method for generating graph for time'''
num_stations = result_data[1]["num_stations"]
@@ -553,9 +553,9 @@ class FtpTest(LFCliBase):
dataset.append(data["time"])
labels.append("Download")
#Adding red bar if client unable to download/upload file
# Adding red bar if client unable to download/upload file
color_list = []
#converting minutes in seconds
# converting minutes in seconds
duration = data["duration"] * 60
for i in data["time"]:
if i < duration:
@@ -629,10 +629,9 @@ class FtpTest(LFCliBase):
else:
handles.append(mpatches.Patch(color='red', label='Upload/Download > threshold time'))
self.report.set_obj_html(graph_name, graph_description)
self.report.build_objective()
image_name = "image"+band+size
image_name = "image" + band + size
x_axis_name = "Stations"
y_axis_name = "Time in seconds"
self.bar_graph(x_axis, image_name, dataset, color, labels, x_axis_name, y_axis_name, handles, ncol=num_col, box=box, fontsize=12)
@@ -654,7 +653,8 @@ class FtpTest(LFCliBase):
color.append("Orange")
graph_name = "File size " + size + " " + str(
num_stations) + " Clients " + band + "-File Download Throughput(MB)"
graph_description = str(data["num_stations"] - data["time"].count(0)) + " clients are able to download " + data["file_size"] + " file."
graph_description = str(data["num_stations"] - data["time"].count(0)) + \
" clients are able to download " + data["file_size"] + " file."
count = count + 1
if data["band"] == band and data["file_size"] == size and data["direction"] == "Upload":
dataset.append(data["throughput"])
@@ -662,7 +662,8 @@ class FtpTest(LFCliBase):
color.append("Blue")
graph_name = "File size " + size + " " + str(
num_stations) + " Clients " + band + "-File Upload Throughput(MB)"
graph_description = graph_description + str(data["num_stations"] - data["time"].count(0)) + " clients are able to upload " + data["file_size"] + " file."
graph_description = graph_description + str(data["num_stations"] - data["time"].count(0)) + \
" clients are able to upload " + data["file_size"] + " file."
count = count + 1
if count == 2:
graph_name = "File size " + size + " " + str(
@@ -676,7 +677,7 @@ class FtpTest(LFCliBase):
box = (1.1, 1.05)
self.bar_graph(x_axis, image_name, dataset, color, labels, x_axis_name, y_axis_name, handles=None, ncol=1, box=box, fontsize=None)
def bar_graph(self, x_axis, image_name, dataset, color, labels, x_axis_name, y_axis_name,handles, ncol, box, fontsize):
def bar_graph(self, x_axis, image_name, dataset, color, labels, x_axis_name, y_axis_name, handles, ncol, box, fontsize):
'''This Method will plot bar graph'''
graph = lf_graph.lf_bar_graph(_data_set=dataset,
@@ -722,7 +723,6 @@ class FtpTest(LFCliBase):
self.generate_graph_time(result_data, x_axis, b, size)
self.generate_graph_throughput(result_data, x_axis, b, size)
def generate_report(self, ftp_data, date, test_setup_info, input_setup_info, test_rig, test_tag, dut_hw_version,
dut_sw_version, dut_model_num, dut_serial_num, test_id, bands,
csv_outfile):
@@ -738,7 +738,9 @@ class FtpTest(LFCliBase):
self.report.test_setup_table(value="Device under test", test_setup_data=test_setup_info)
self.report.set_obj_html("Objective",
"This FTP Test is used to Verify that N clients connected on Specified band and can simultaneously download/upload some amount of file from FTP server and measuring the time taken by client to Download/Upload the file.")
"This FTP Test is used to Verify that N clients connected on Specified band and can "
"simultaneously download/upload some amount of file from FTP server and measuring the "
"time taken by client to Download/Upload the file.")
self.report.build_objective()
self.report.set_obj_html("PASS/FAIL Results",
"This Table will give Pass/Fail results.")
@@ -837,7 +839,6 @@ class FtpTest(LFCliBase):
}
# print("upload_table_value:{upload_table_value}".format(upload_table_value=upload_table_value))
# Get the report path to create the kpi.csv path
kpi_path = self.report.get_report_path()
# print("kpi_path :{kpi_path}".format(kpi_path=kpi_path))
@@ -946,7 +947,6 @@ class FtpTest(LFCliBase):
self.report.write_pdf_with_timestamp(_page_size='A4', _orientation='Landscape')
def main():
parser = argparse.ArgumentParser(
prog='lf_ftp.py',
@@ -1141,7 +1141,7 @@ CLI Example:
date = str(datetime.now()).split(",")[0].replace(" ", "-").split(".")[0]
#print(ftp_data)
# print(ftp_data)
test_setup_info = {
"AP Name": args.ap_name,
@@ -1169,4 +1169,3 @@ CLI Example:
if __name__ == '__main__':
main()