Use underscore for variables that we don't reference

This pleases pyright/pylance and is a pattern that we use in other
portions of the code.
pull/11976/head
Tristan Partin 1 year ago
parent 24edddb412
commit 020692b9d9
  1. 6
      mesonbuild/utils/universal.py

@ -1214,7 +1214,7 @@ def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData',
define_value: T.List[str] = [] define_value: T.List[str] = []
for token in arr[2:]: for token in arr[2:]:
try: try:
(v, desc) = confdata.get(token) v, _ = confdata.get(token)
define_value += [str(v)] define_value += [str(v)]
except KeyError: except KeyError:
define_value += [token] define_value += [token]
@ -1230,7 +1230,7 @@ def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData',
varname = arr[1] varname = arr[1]
try: try:
(v, desc) = confdata.get(varname) v, _ = confdata.get(varname)
except KeyError: except KeyError:
return '/* #undef %s */\n' % varname return '/* #undef %s */\n' % varname
if isinstance(v, bool): if isinstance(v, bool):
@ -1246,7 +1246,7 @@ def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData',
else: else:
result = get_cmake_define(line, confdata) result = get_cmake_define(line, confdata)
result = f'#define {varname} {result}\n' result = f'#define {varname} {result}\n'
(result, missing_variable) = do_replacement(regex, result, variable_format, confdata) result, _ = do_replacement(regex, result, variable_format, confdata)
return result return result
else: else:
raise MesonException('#mesondefine argument "%s" is of unknown type.' % varname) raise MesonException('#mesondefine argument "%s" is of unknown type.' % varname)

Loading…
Cancel
Save