5151REPORT_PATH = os .path .join (script_dir , "accepted.log" )
5252MANUAL_CHECK_PATH = os .path .join (script_dir , "manual-check.log" )
5353
54- def fetch_status (url , original_status ):
54+
55+ def fetch_status (url , original_status ):
5556 """
5657 Fetch PR status from GitHub API with caching.
5758 """
58-
59+
5960 def cache_and_return (url , result ):
6061 """Cache the result and return it."""
6162 pr_status_cache [url ] = result
6263 return result
63-
64+
6465 if url in pr_status_cache :
6566 logger .debug (f"Cache hit for { url } " )
66- return pr_status_cache [url ]
67+ return pr_status_cache [url ]
6768 match = GITHUB_URL_PATTERN .search (url )
6869 if not match :
6970 return cache_and_return (url , "Invalid URL" )
@@ -90,6 +91,7 @@ def cache_and_return(url, result):
9091 logger .warning (f"Exception fetching PR { url } : { e } ." )
9192 return "Fetch Error"
9293
94+
9395def process_row (filename , index , row ):
9496 """
9597 Only check for updates when the PR is in 'Opened' status.
@@ -121,6 +123,7 @@ def process_row(filename, index, row):
121123 logger .info (msg )
122124 return index , new_status , changed , url , msg
123125
126+
124127def parse_range (range_str ):
125128 if not range_str :
126129 return None , None
@@ -140,6 +143,7 @@ def parse_range(range_str):
140143 logger .error (f"Invalid range values: { range_str } " )
141144 sys .exit (1 )
142145
146+
143147def main ():
144148 parser = argparse .ArgumentParser (description = "Update PR statuses in CSV files." )
145149 parser .add_argument ("--prrange" , type = str ,
@@ -275,5 +279,6 @@ def main():
275279 f .write (line + "\n " )
276280 logger .info (f"Manual check log updated for { filename } " )
277281
282+
278283if __name__ == "__main__" :
279- main ()
284+ main ()
0 commit comments