From 41059c7ae757aff2db97d0fd0076c06490ba0511 Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 17 Jul 2025 10:09:33 +1200 Subject: [PATCH 01/13] chore: add colour to the advisory generation output. --- poetry.lock | 5 ++--- pyproject.toml | 1 + scripts/generate_osv_advisories.py | 27 ++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index 438b2a1d..b9c6667d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. [[package]] name = "attrs" @@ -164,7 +164,6 @@ description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" groups = ["main"] -markers = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -689,4 +688,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" python-versions = ">= 3.13" -content-hash = "d7bc900df425f2915995c0104ae203b58adcb55f22282da9b5acbc96842aae0a" +content-hash = "02d01245f8d8551d93f26c9435008ebc364867f3fcb7718533c2d5978bf48e57" diff --git a/pyproject.toml b/pyproject.toml index d8a3c938..de3e3ea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ ruff = "~0.14.0" semver = "^3.0.4" types-jsonschema = "^4.23.0.20241208" types-requests = "^2.32.0.20250328" +colorama = "^0.4.6" [tool.poetry] package-mode = false diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index f539776c..bfe39945 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -21,6 +21,11 @@ from typings import drupal, osv from user_agent import user_agent +from colorama import init as colorama_init +from colorama import Fore +from colorama import Style + +colorama_init() def fetch_drupal_node(nid: str) -> drupal.Node: """ @@ -350,10 +355,10 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: if before == sa_advisory['field_affected_versions']: sa_advisory['field_affected_versions'] = after - print(' \\- patched affected versions') + print(' \\- ' + success_string('patched affected versions')) return True print( - f' \\- skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' + f' \\- ' + warning_string('skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"') ) return False @@ -375,14 +380,14 @@ def build_osv_advisory( # we expect that the downloader has excluded PSA type entries, but # we still guard against them here just in case one slips through if sa_advisory['field_is_psa'] == '1': - print(' \\- skipping as it is a psa? (this should not happen)') + print(' \\-' + notice_string('skipping as it is a psa? (this should not happen)')) return None # there's not really much we can do if there isn't an affected version # todo: since build_affected_ranges throws if this isn't present, it might # make more sense to use that, with a custom exception class if sa_advisory['field_affected_versions'] is None: - print(' \\- skipping as we do not have any affected versions') + print(' \\- ' + notice_string('skipping as we do not have any affected versions')) return None osv_advisory: osv.Vulnerability = { @@ -461,7 +466,7 @@ def generate_osv_advisories() -> None: os.makedirs(f'advisories/{name}', exist_ok=True) if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']): print( - ' \\- error: current modified date is ahead of the proposed modified date (is your cache up to date?)' + ' \\- ' + error_string('error: current modified date is ahead of the proposed modified date (is your cache up to date?)') ) exit(1) @@ -469,6 +474,18 @@ def generate_osv_advisories() -> None: json.dump(osv_advisory, f, indent=2) f.write('\n') +def notice_string(message: str) -> str: + return Fore.YELLOW + Style.DIM + message + Style.RESET_ALL + +def success_string(message: str) -> str: + return Fore.GREEN + message + Style.RESET_ALL + +def warning_string(message: str) -> str: + return Fore.YELLOW + message + Style.RESET_ALL + +def error_string(message: str) -> str: + return Fore.RED + message + Style.RESET_ALL + if __name__ == '__main__': generate_osv_advisories() From 2b1961e90ebe9c61617f7a7d38ee142c02392a4e Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 17 Jul 2025 10:33:49 +1200 Subject: [PATCH 02/13] fix: fixed formatting via ruff --- scripts/generate_osv_advisories.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index bfe39945..2fb6f5c0 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -16,15 +16,13 @@ import requests import semver +from colorama import Fore, Style +from colorama import init as colorama_init from markdownify import markdownify from typings import drupal, osv from user_agent import user_agent -from colorama import init as colorama_init -from colorama import Fore -from colorama import Style - colorama_init() def fetch_drupal_node(nid: str) -> drupal.Node: @@ -358,7 +356,7 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: print(' \\- ' + success_string('patched affected versions')) return True print( - f' \\- ' + warning_string('skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"') + ' \\- ' + warning_string('skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"') ) return False From 6035dd7ac40faab4ef285b4ab4416bd22d4eb62f Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 17 Jul 2025 10:50:00 +1200 Subject: [PATCH 03/13] fix: update based on ruff format --- scripts/generate_osv_advisories.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 2fb6f5c0..62afe811 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -25,6 +25,7 @@ colorama_init() + def fetch_drupal_node(nid: str) -> drupal.Node: """ Fetches a node from drupal.org by its id @@ -356,7 +357,10 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: print(' \\- ' + success_string('patched affected versions')) return True print( - ' \\- ' + warning_string('skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"') + ' \\- ' + + warning_string( + f'skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' + ) ) return False @@ -378,7 +382,7 @@ def build_osv_advisory( # we expect that the downloader has excluded PSA type entries, but # we still guard against them here just in case one slips through if sa_advisory['field_is_psa'] == '1': - print(' \\-' + notice_string('skipping as it is a psa? (this should not happen)')) + print(' \\-' + error_string('skipping as it is a psa? (this should not happen)')) return None # there's not really much we can do if there isn't an affected version @@ -464,7 +468,10 @@ def generate_osv_advisories() -> None: os.makedirs(f'advisories/{name}', exist_ok=True) if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']): print( - ' \\- ' + error_string('error: current modified date is ahead of the proposed modified date (is your cache up to date?)') + ' \\- ' + + error_string( + 'error: current modified date is ahead of the proposed modified date (is your cache up to date?)' + ) ) exit(1) @@ -472,15 +479,19 @@ def generate_osv_advisories() -> None: json.dump(osv_advisory, f, indent=2) f.write('\n') + def notice_string(message: str) -> str: return Fore.YELLOW + Style.DIM + message + Style.RESET_ALL + def success_string(message: str) -> str: return Fore.GREEN + message + Style.RESET_ALL + def warning_string(message: str) -> str: return Fore.YELLOW + message + Style.RESET_ALL + def error_string(message: str) -> str: return Fore.RED + message + Style.RESET_ALL From 67de7c9aa80c328cc965fe983014f0b79965a988 Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 17 Jul 2025 10:55:26 +1200 Subject: [PATCH 04/13] fix: help mypy see the returns are strings --- scripts/generate_osv_advisories.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 62afe811..0151ecbf 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -481,19 +481,19 @@ def generate_osv_advisories() -> None: def notice_string(message: str) -> str: - return Fore.YELLOW + Style.DIM + message + Style.RESET_ALL + return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' def success_string(message: str) -> str: - return Fore.GREEN + message + Style.RESET_ALL + return f'{Fore.GREEN}{message}{Style.RESET_ALL}' def warning_string(message: str) -> str: - return Fore.YELLOW + message + Style.RESET_ALL + return f'{Fore.YELLOW}{message}{Style.RESET_ALL}' def error_string(message: str) -> str: - return Fore.RED + message + Style.RESET_ALL + return f'{Fore.RED}{message}{Style.RESET_ALL}' if __name__ == '__main__': From 2817f669b9bea126c1a79573db56eb77a2dc4d33 Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 17 Jul 2025 10:59:51 +1200 Subject: [PATCH 05/13] fix: mypy recommended installing types-colorama --- poetry.lock | 14 +++++++++++++- pyproject.toml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index b9c6667d..4d49a939 100644 --- a/poetry.lock +++ b/poetry.lock @@ -625,6 +625,18 @@ files = [ {file = "soupsieve-2.7.tar.gz", hash = "sha256:ad282f9b6926286d2ead4750552c8a6142bc4c783fd66b0293547c8fe6ae126a"}, ] +[[package]] +name = "types-colorama" +version = "0.4.15.20240311" +description = "Typing stubs for colorama" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "types-colorama-0.4.15.20240311.tar.gz", hash = "sha256:a28e7f98d17d2b14fb9565d32388e419f4108f557a7d939a66319969b2b99c7a"}, + {file = "types_colorama-0.4.15.20240311-py3-none-any.whl", hash = "sha256:6391de60ddc0db3f147e31ecb230006a6823e81e380862ffca1e4695c13a0b8e"}, +] + [[package]] name = "types-jsonschema" version = "4.23.0.20241208" @@ -688,4 +700,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" python-versions = ">= 3.13" -content-hash = "02d01245f8d8551d93f26c9435008ebc364867f3fcb7718533c2d5978bf48e57" +content-hash = "83f45fac03a1e434de3d5294fdf93202d720227a23ae88670f1c80b293f5dd6b" diff --git a/pyproject.toml b/pyproject.toml index de3e3ea9..9f6ffdb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ semver = "^3.0.4" types-jsonschema = "^4.23.0.20241208" types-requests = "^2.32.0.20250328" colorama = "^0.4.6" +types-colorama = "^0.4.15.20240311" [tool.poetry] package-mode = false From 4255c92bad9f267cef757ae7f969ae878b97985a Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 21 Aug 2025 09:15:21 +1200 Subject: [PATCH 06/13] refactor from code review * pyproject.toml ordering * create a helper class for Text * refactor to use Text.*() helpers --- pyproject.toml | 2 +- scripts/generate_osv_advisories.py | 31 ++++++------------------------ scripts/helpers/text.py | 25 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 scripts/helpers/text.py diff --git a/pyproject.toml b/pyproject.toml index 9f6ffdb3..daed841a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,7 @@ name = "drupal-advisory-database" requires-python = ">= 3.13" [tool.poetry.dependencies] +colorama = "^0.4.6" jsonschema = "^4.23.0" markdownify = "^1.1.0" mypy = "^1.15.0" @@ -12,7 +13,6 @@ ruff = "~0.14.0" semver = "^3.0.4" types-jsonschema = "^4.23.0.20241208" types-requests = "^2.32.0.20250328" -colorama = "^0.4.6" types-colorama = "^0.4.15.20240311" [tool.poetry] diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 0151ecbf..fdbf158f 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -16,15 +16,12 @@ import requests import semver -from colorama import Fore, Style -from colorama import init as colorama_init from markdownify import markdownify from typings import drupal, osv +from helpers.text import Text from user_agent import user_agent -colorama_init() - def fetch_drupal_node(nid: str) -> drupal.Node: """ @@ -354,11 +351,11 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: if before == sa_advisory['field_affected_versions']: sa_advisory['field_affected_versions'] = after - print(' \\- ' + success_string('patched affected versions')) + print(' \\- ' + Text.success('patched affected versions')) return True print( ' \\- ' - + warning_string( + + Text.warning( f'skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' ) ) @@ -382,14 +379,14 @@ def build_osv_advisory( # we expect that the downloader has excluded PSA type entries, but # we still guard against them here just in case one slips through if sa_advisory['field_is_psa'] == '1': - print(' \\-' + error_string('skipping as it is a psa? (this should not happen)')) + print(' \\-' + Text.error('skipping as it is a psa? (this should not happen)')) return None # there's not really much we can do if there isn't an affected version # todo: since build_affected_ranges throws if this isn't present, it might # make more sense to use that, with a custom exception class if sa_advisory['field_affected_versions'] is None: - print(' \\- ' + notice_string('skipping as we do not have any affected versions')) + print(' \\- ' + Text.notice('skipping as we do not have any affected versions')) return None osv_advisory: osv.Vulnerability = { @@ -469,7 +466,7 @@ def generate_osv_advisories() -> None: if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']): print( ' \\- ' - + error_string( + + Text.error( 'error: current modified date is ahead of the proposed modified date (is your cache up to date?)' ) ) @@ -480,21 +477,5 @@ def generate_osv_advisories() -> None: f.write('\n') -def notice_string(message: str) -> str: - return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' - - -def success_string(message: str) -> str: - return f'{Fore.GREEN}{message}{Style.RESET_ALL}' - - -def warning_string(message: str) -> str: - return f'{Fore.YELLOW}{message}{Style.RESET_ALL}' - - -def error_string(message: str) -> str: - return f'{Fore.RED}{message}{Style.RESET_ALL}' - - if __name__ == '__main__': generate_osv_advisories() diff --git a/scripts/helpers/text.py b/scripts/helpers/text.py new file mode 100644 index 00000000..2970b8aa --- /dev/null +++ b/scripts/helpers/text.py @@ -0,0 +1,25 @@ +from colorama import Fore, Style +from colorama import just_fix_windows_console + +just_fix_windows_console() + + +class Text: + @staticmethod + def notice(message: str) -> str: + return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' + + + @staticmethod + def success(message: str) -> str: + return f'{Fore.GREEN}{message}{Style.RESET_ALL}' + + + @staticmethod + def warning(message: str) -> str: + return f'{Fore.YELLOW}{message}{Style.RESET_ALL}' + + + @staticmethod + def error(message: str) -> str: + return f'{Fore.RED}{message}{Style.RESET_ALL}' From bb2a30c49f965ec2b79999a7df278cc553ab8d6d Mon Sep 17 00:00:00 2001 From: Gold Date: Thu, 21 Aug 2025 09:35:44 +1200 Subject: [PATCH 07/13] Avoid the mypy namespace error --- scripts/generate_osv_advisories.py | 12 ++++++------ scripts/helpers/{text.py => text_is.py} | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) rename scripts/helpers/{text.py => text_is.py} (97%) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index fdbf158f..1663675e 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -19,7 +19,7 @@ from markdownify import markdownify from typings import drupal, osv -from helpers.text import Text +from helpers.text_is import TextIs from user_agent import user_agent @@ -351,11 +351,11 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: if before == sa_advisory['field_affected_versions']: sa_advisory['field_affected_versions'] = after - print(' \\- ' + Text.success('patched affected versions')) + print(' \\- ' + TextIs.success('patched affected versions')) return True print( ' \\- ' - + Text.warning( + + TextIs.warning( f'skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' ) ) @@ -379,14 +379,14 @@ def build_osv_advisory( # we expect that the downloader has excluded PSA type entries, but # we still guard against them here just in case one slips through if sa_advisory['field_is_psa'] == '1': - print(' \\-' + Text.error('skipping as it is a psa? (this should not happen)')) + print(' \\-' + TextIs.error('skipping as it is a psa? (this should not happen)')) return None # there's not really much we can do if there isn't an affected version # todo: since build_affected_ranges throws if this isn't present, it might # make more sense to use that, with a custom exception class if sa_advisory['field_affected_versions'] is None: - print(' \\- ' + Text.notice('skipping as we do not have any affected versions')) + print(' \\- ' + TextIs.notice('skipping as we do not have any affected versions')) return None osv_advisory: osv.Vulnerability = { @@ -466,7 +466,7 @@ def generate_osv_advisories() -> None: if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']): print( ' \\- ' - + Text.error( + + TextIs.error( 'error: current modified date is ahead of the proposed modified date (is your cache up to date?)' ) ) diff --git a/scripts/helpers/text.py b/scripts/helpers/text_is.py similarity index 97% rename from scripts/helpers/text.py rename to scripts/helpers/text_is.py index 2970b8aa..c4a6cfe9 100644 --- a/scripts/helpers/text.py +++ b/scripts/helpers/text_is.py @@ -4,7 +4,7 @@ just_fix_windows_console() -class Text: +class TextIs: @staticmethod def notice(message: str) -> str: return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' From 43f70922b14a7e81539058edf0dbd4a47c9a734c Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 13:44:38 +1300 Subject: [PATCH 08/13] Remove TextIs class and use as functions --- scripts/generate_osv_advisories.py | 12 ++++++------ scripts/helpers/text_is.py | 22 ++++++++-------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 1663675e..3f23a1b1 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -19,7 +19,7 @@ from markdownify import markdownify from typings import drupal, osv -from helpers.text_is import TextIs +from helpers import text_is from user_agent import user_agent @@ -351,11 +351,11 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool: if before == sa_advisory['field_affected_versions']: sa_advisory['field_affected_versions'] = after - print(' \\- ' + TextIs.success('patched affected versions')) + print(' \\- ' + text_is.success('patched affected versions')) return True print( ' \\- ' - + TextIs.warning( + + text_is.warning( f'skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"' ) ) @@ -379,14 +379,14 @@ def build_osv_advisory( # we expect that the downloader has excluded PSA type entries, but # we still guard against them here just in case one slips through if sa_advisory['field_is_psa'] == '1': - print(' \\-' + TextIs.error('skipping as it is a psa? (this should not happen)')) + print(' \\-' + text_is.error('skipping as it is a psa? (this should not happen)')) return None # there's not really much we can do if there isn't an affected version # todo: since build_affected_ranges throws if this isn't present, it might # make more sense to use that, with a custom exception class if sa_advisory['field_affected_versions'] is None: - print(' \\- ' + TextIs.notice('skipping as we do not have any affected versions')) + print(' \\- ' + text_is.notice('skipping as we do not have any affected versions')) return None osv_advisory: osv.Vulnerability = { @@ -466,7 +466,7 @@ def generate_osv_advisories() -> None: if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']): print( ' \\- ' - + TextIs.error( + + text_is.error( 'error: current modified date is ahead of the proposed modified date (is your cache up to date?)' ) ) diff --git a/scripts/helpers/text_is.py b/scripts/helpers/text_is.py index c4a6cfe9..a8b78141 100644 --- a/scripts/helpers/text_is.py +++ b/scripts/helpers/text_is.py @@ -3,23 +3,17 @@ just_fix_windows_console() +def notice(message: str) -> str: + return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' -class TextIs: - @staticmethod - def notice(message: str) -> str: - return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}' +def success(message: str) -> str: + return f'{Fore.GREEN}{message}{Style.RESET_ALL}' - @staticmethod - def success(message: str) -> str: - return f'{Fore.GREEN}{message}{Style.RESET_ALL}' +def warning(message: str) -> str: + return f'{Fore.YELLOW}{message}{Style.RESET_ALL}' - @staticmethod - def warning(message: str) -> str: - return f'{Fore.YELLOW}{message}{Style.RESET_ALL}' - - @staticmethod - def error(message: str) -> str: - return f'{Fore.RED}{message}{Style.RESET_ALL}' +def error(message: str) -> str: + return f'{Fore.RED}{message}{Style.RESET_ALL}' From 9e9b5d072afe47e9aee1b668f37da372abf93c52 Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 13:51:25 +1300 Subject: [PATCH 09/13] updating poetry.lock --- poetry.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 4d49a939..d0b68f69 100644 --- a/poetry.lock +++ b/poetry.lock @@ -700,4 +700,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.1" python-versions = ">= 3.13" -content-hash = "83f45fac03a1e434de3d5294fdf93202d720227a23ae88670f1c80b293f5dd6b" +content-hash = "d01a497c88d6d315860a3ce2da8777dd3a83759f33bf3119f28382bf7be88090" From edc14fd77d6308ca0db6f1af77e3fc1aaca31509 Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 14:48:02 +1300 Subject: [PATCH 10/13] sort import block for ruff check --- scripts/generate_osv_advisories.py | 2 +- scripts/helpers/text_is.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 3f23a1b1..74b8a208 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -18,8 +18,8 @@ import semver from markdownify import markdownify -from typings import drupal, osv from helpers import text_is +from typings import drupal, osv from user_agent import user_agent diff --git a/scripts/helpers/text_is.py b/scripts/helpers/text_is.py index a8b78141..e0648319 100644 --- a/scripts/helpers/text_is.py +++ b/scripts/helpers/text_is.py @@ -1,5 +1,5 @@ -from colorama import Fore, Style from colorama import just_fix_windows_console +from colorama import Fore, Style just_fix_windows_console() From 02bbbfaf3378cef705530160bfe56c838128a6ec Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 14:54:56 +1300 Subject: [PATCH 11/13] adding an __init__.py so mypy doesn't complain --- scripts/helpers/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 scripts/helpers/__init__.py diff --git a/scripts/helpers/__init__.py b/scripts/helpers/__init__.py new file mode 100644 index 00000000..e69de29b From 727665823b0295dfb2fd3d8614193490b7f4bc42 Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 15:02:20 +1300 Subject: [PATCH 12/13] fixing the import blocks using ruff --fix --- scripts/generate_osv_advisories.py | 2 +- scripts/helpers/text_is.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/generate_osv_advisories.py b/scripts/generate_osv_advisories.py index 74b8a208..5107a524 100755 --- a/scripts/generate_osv_advisories.py +++ b/scripts/generate_osv_advisories.py @@ -16,9 +16,9 @@ import requests import semver +from helpers import text_is from markdownify import markdownify -from helpers import text_is from typings import drupal, osv from user_agent import user_agent diff --git a/scripts/helpers/text_is.py b/scripts/helpers/text_is.py index e0648319..17fda9ef 100644 --- a/scripts/helpers/text_is.py +++ b/scripts/helpers/text_is.py @@ -1,5 +1,4 @@ -from colorama import just_fix_windows_console -from colorama import Fore, Style +from colorama import Fore, Style, just_fix_windows_console just_fix_windows_console() From 6522e863f218d4d97ba2b595de3b0af84350d54c Mon Sep 17 00:00:00 2001 From: Gold Date: Wed, 29 Oct 2025 15:08:32 +1300 Subject: [PATCH 13/13] ruff formatting --- scripts/helpers/text_is.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/helpers/text_is.py b/scripts/helpers/text_is.py index 17fda9ef..8aa3cb45 100644 --- a/scripts/helpers/text_is.py +++ b/scripts/helpers/text_is.py @@ -2,6 +2,7 @@ just_fix_windows_console() + def notice(message: str) -> str: return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}'