6
6
7
7
from bs4 import BeautifulSoup
8
8
9
+
9
10
json_file_path = "tutorials-review-data.json"
10
11
11
12
# paths to skip from the post-processing script
30
31
"" : "" , # root dir for index.rst
31
32
}
32
33
33
-
34
34
def get_git_log_date (file_path , git_log_args ):
35
35
try :
36
36
result = subprocess .run (
@@ -46,17 +46,13 @@ def get_git_log_date(file_path, git_log_args):
46
46
pass
47
47
raise ValueError (f"Could not find date for { file_path } " )
48
48
49
-
50
49
def get_creation_date (file_path ):
51
- return get_git_log_date (file_path , ["--diff-filter=A" , "--format=%aD" ]).strftime (
52
- "%b %d, %Y"
53
- )
50
+ return get_git_log_date (file_path , ["--diff-filter=A" , "--format=%aD" ]).strftime ("%b %d, %Y" )
54
51
55
52
56
53
def get_last_updated_date (file_path ):
57
54
return get_git_log_date (file_path , ["-1" , "--format=%aD" ]).strftime ("%b %d, %Y" )
58
55
59
-
60
56
# Try to find the source file with the given base path and the extensions .rst and .py
61
57
def find_source_file (base_path ):
62
58
for ext in [".rst" , ".py" ]:
@@ -67,7 +63,7 @@ def find_source_file(base_path):
67
63
68
64
69
65
# Function to process a JSON file and insert the "Last Verified" information into the HTML files
70
- def process_json_file (build_dir , json_file_path ):
66
+ def process_json_file (build_dir , json_file_path ):
71
67
with open (json_file_path , "r" , encoding = "utf-8" ) as json_file :
72
68
json_data = json .load (json_file )
73
69
@@ -152,14 +148,13 @@ def main():
152
148
exit (1 )
153
149
build_dir = sys .argv [1 ]
154
150
print (f"Build directory: { build_dir } " )
155
- process_json_file (build_dir , json_file_path )
151
+ process_json_file (build_dir , json_file_path )
156
152
print (
157
153
"Finished processing JSON file. Please check the output for any warnings. "
158
154
"Pages like `nlp/index.html` are generated only during the full `make docs` "
159
155
"or `make html` build. Warnings about these files when you run `make html-noplot` "
160
156
"can be ignored."
161
157
)
162
158
163
-
164
159
if __name__ == "__main__" :
165
160
main ()
0 commit comments