2525
2626colorama_init ()
2727
28+
2829def fetch_drupal_node (nid : str ) -> drupal .Node :
2930 """
3031 Fetches a node from drupal.org by its id
@@ -356,7 +357,10 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool:
356357 print (' \\ - ' + success_string ('patched affected versions' ))
357358 return True
358359 print (
359- ' \\ - ' + warning_string ('skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' )
360+ ' \\ - '
361+ + warning_string (
362+ f'skipped patching as affected version is now "{ sa_advisory ["field_affected_versions" ]} "'
363+ )
360364 )
361365 return False
362366
@@ -378,7 +382,7 @@ def build_osv_advisory(
378382 # we expect that the downloader has excluded PSA type entries, but
379383 # we still guard against them here just in case one slips through
380384 if sa_advisory ['field_is_psa' ] == '1' :
381- print (' \\ -' + notice_string ('skipping as it is a psa? (this should not happen)' ))
385+ print (' \\ -' + error_string ('skipping as it is a psa? (this should not happen)' ))
382386 return None
383387
384388 # there's not really much we can do if there isn't an affected version
@@ -464,23 +468,30 @@ def generate_osv_advisories() -> None:
464468 os .makedirs (f'advisories/{ name } ' , exist_ok = True )
465469 if is_existing_advisory_ahead (name , sa_id , osv_advisory ['modified' ]):
466470 print (
467- ' \\ - ' + error_string ('error: current modified date is ahead of the proposed modified date (is your cache up to date?)' )
471+ ' \\ - '
472+ + error_string (
473+ 'error: current modified date is ahead of the proposed modified date (is your cache up to date?)'
474+ )
468475 )
469476 exit (1 )
470477
471478 with open (f'advisories/{ name } /D{ sa_id } .json' , 'w' ) as f :
472479 json .dump (osv_advisory , f , indent = 2 )
473480 f .write ('\n ' )
474481
482+
475483def notice_string (message : str ) -> str :
476484 return Fore .YELLOW + Style .DIM + message + Style .RESET_ALL
477485
486+
478487def success_string (message : str ) -> str :
479488 return Fore .GREEN + message + Style .RESET_ALL
480489
490+
481491def warning_string (message : str ) -> str :
482492 return Fore .YELLOW + message + Style .RESET_ALL
483493
494+
484495def error_string (message : str ) -> str :
485496 return Fore .RED + message + Style .RESET_ALL
486497
0 commit comments