Skip to content

Commit febb921

Browse files
committed
Avoid the mypy namespace error
1 parent 1f6a712 commit febb921

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/generate_osv_advisories.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from markdownify import markdownify
2020

2121
from typings import drupal, osv
22-
from helpers.text import Text
22+
from helpers.text_is import TextIs
2323
from user_agent import user_agent
2424

2525

@@ -351,11 +351,11 @@ def patch_advisory(sa_id: str, sa_advisory: drupal.Advisory) -> bool:
351351

352352
if before == sa_advisory['field_affected_versions']:
353353
sa_advisory['field_affected_versions'] = after
354-
print(' \\- ' + Text.success('patched affected versions'))
354+
print(' \\- ' + TextIs.success('patched affected versions'))
355355
return True
356356
print(
357357
' \\- '
358-
+ Text.warning(
358+
+ TextIs.warning(
359359
f'skipped patching as affected version is now "{sa_advisory["field_affected_versions"]}"'
360360
)
361361
)
@@ -379,14 +379,14 @@ def build_osv_advisory(
379379
# we expect that the downloader has excluded PSA type entries, but
380380
# we still guard against them here just in case one slips through
381381
if sa_advisory['field_is_psa'] == '1':
382-
print(' \\-' + Text.error('skipping as it is a psa? (this should not happen)'))
382+
print(' \\-' + TextIs.error('skipping as it is a psa? (this should not happen)'))
383383
return None
384384

385385
# there's not really much we can do if there isn't an affected version
386386
# todo: since build_affected_ranges throws if this isn't present, it might
387387
# make more sense to use that, with a custom exception class
388388
if sa_advisory['field_affected_versions'] is None:
389-
print(' \\- ' + Text.notice('skipping as we do not have any affected versions'))
389+
print(' \\- ' + TextIs.notice('skipping as we do not have any affected versions'))
390390
return None
391391

392392
osv_advisory: osv.Vulnerability = {
@@ -466,7 +466,7 @@ def generate_osv_advisories() -> None:
466466
if is_existing_advisory_ahead(name, sa_id, osv_advisory['modified']):
467467
print(
468468
' \\- '
469-
+ Text.error(
469+
+ TextIs.error(
470470
'error: current modified date is ahead of the proposed modified date (is your cache up to date?)'
471471
)
472472
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
just_fix_windows_console()
55

66

7-
class Text:
7+
class TextIs:
88
@staticmethod
99
def notice(message: str) -> str:
1010
return f'{Fore.YELLOW}{Style.DIM}{message}{Style.RESET_ALL}'

0 commit comments

Comments
 (0)