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