From 3171fc533812e15bcb5eda607c7c82d37d0aaf42 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 3 Jul 2023 12:25:29 -0400 Subject: [PATCH] add better comments for mypy suppressions --- mesonbuild/modules/gnome.py | 4 ++-- mesonbuild/modules/pkgconfig.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 7a9acea00..755bf240b 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1744,7 +1744,7 @@ class GnomeModule(ExtensionModule): 'identifier_prefix', 'symbol_prefix', 'vhead', 'vprod', 'vtail'] for arg in known_kwargs: - # mypy can't figure this out + # Mypy can't figure out that this TypedDict index is correct, without repeating T.Literal for the entire list if kwargs[arg]: # type: ignore cmd += ['--' + arg.replace('_', '-'), kwargs[arg]] # type: ignore @@ -1966,7 +1966,7 @@ class GnomeModule(ExtensionModule): mlog.bold('https://github.com/mesonbuild/meson/pull/2049'), once=True, fatal=False) for k in ['internal', 'nostdinc', 'skip_source', 'stdinc', 'valist_marshallers']: - # Mypy can't figure out that this is correct + # Mypy can't figure out that this TypedDict index is correct, without repeating T.Literal for the entire list if kwargs[k]: # type: ignore cmd.append(f'--{k.replace("_", "-")}') diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index 921fb6661..9f71d952c 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -649,6 +649,7 @@ class PkgConfigModule(NewExtensionModule): if dataonly: default_subdirs = [] blocked_vars = ['libraries', 'libraries_private', 'requires_private', 'extra_cflags', 'subdirs'] + # Mypy can't figure out that this TypedDict index is correct, without repeating T.Literal for the entire list if any(kwargs[k] for k in blocked_vars): # type: ignore raise mesonlib.MesonException(f'Cannot combine dataonly with any of {blocked_vars}') default_install_dir = os.path.join(state.environment.get_datadir(), 'pkgconfig')