@@ -16,7 +16,7 @@ def patch(article_path: str, results: dict, link: str):
1616 article_path_pure = PurePath (re .sub (r"^.*?content/" , "" , article_path ))
1717 article_path_parts = list (article_path_pure .parts )
1818 if "learning-paths" in article_path_parts :
19- content_type , sw_category , content_title , * others_1 = article_path_parts
19+ content_type , sw_category , content_title = article_path_parts
2020 article_path = PurePath (article_path , "_index.md" )
2121 elif "install-guides" in article_path_parts :
2222 # In case the install guide is in a subdirectory
@@ -30,33 +30,30 @@ def patch(article_path: str, results: dict, link: str):
3030 else :
3131 raise SystemExit ("Unknown content path, pass learning paths or install guides only" )
3232
33- if results is not None :
34- test_images = results .keys ()
35- results_values = defaultdict (lambda : "failed" )
36- results_values [0 ] = "passed"
33+ test_images = results .keys ()
34+ results_values = defaultdict (lambda : "failed" )
35+ results_values [0 ] = "passed"
3736
38- content_data = data ["sw_categories" ][sw_category ][content_title ]
37+ content_data = data ["sw_categories" ][sw_category ][content_title ]
3938
40- # Create 'tests_and_status' if it doesn't exist
41- if "tests_and_status" not in content_data or not isinstance (content_data ["tests_and_status" ], list ):
42- content_data ["tests_and_status" ] = [{} for _ in range (len (test_images ))]
39+ # Create 'tests_and_status' if it doesn't exist
40+ if "tests_and_status" not in content_data or not isinstance (content_data ["tests_and_status" ], list ):
41+ content_data ["tests_and_status" ] = [{} for _ in range (len (test_images ))]
4342
44- # If 'tests_and_status' exists but is too short, extend it
45- if len (content_data ["tests_and_status" ]) < len (test_images ):
46- additional_entries = [{} for _ in range (len (test_images ) - len (content_data ["tests_and_status" ]))]
47- content_data ["tests_and_status" ].extend (additional_entries )
43+ # If 'tests_and_status' exists but is too short, extend it
44+ if len (content_data ["tests_and_status" ]) < len (test_images ):
45+ additional_entries = [{} for _ in range (len (test_images ) - len (content_data ["tests_and_status" ]))]
46+ content_data ["tests_and_status" ].extend (additional_entries )
4847
49- # Now safe to index
50- for i , image in enumerate (test_images ):
51- idx = min (i , len (content_data ["tests_and_status" ]) - 1 )
52- content_data ["tests_and_status" ][idx ][image ] = results_values [results [image ]]
48+ # Now safe to index
49+ for i , image in enumerate (test_images ):
50+ idx = min (i , len (content_data ["tests_and_status" ]) - 1 )
51+ content_data ["tests_and_status" ][idx ][image ] = results_values [results [image ]]
5352
54- if link :
55- data ["sw_categories" ][sw_category ][content_title ]["test_link" ] = link
53+ if link :
54+ data ["sw_categories" ][sw_category ][content_title ]["test_link" ] = link
5655
5756
58- with open (stats_file , mode = 'w' ) as f :
59- yaml .dump (data , f )
60- f .close ()
61- else :
62- pass
57+ with open (stats_file , mode = 'w' ) as f :
58+ yaml .dump (data , f )
59+ f .close ()
0 commit comments