Adding type suppressions for pyrefly

PiperOrigin-RevId: 950703735
Change-Id: I6b6d5826a0dd1f4c0a1cbb2a46aee944cd60d884
This commit is contained in:
Hana Joo
2026-07-20 02:39:22 -07:00
committed by Copybara-Service
parent 00abc5465f
commit 78946ca94e
30 changed files with 193 additions and 193 deletions
+4 -4
View File
@@ -126,22 +126,22 @@ def main(argv: Sequence[str]) -> None:
raise app.UsageError('Too many command-line arguments.')
visitor = ast_processor.process(
_JSON_PATH.value,
_JSON_PATH.value, # pyrefly: ignore[bad-argument-type]
(_HEADER_PATHS.value or '').split(),
_EXCLUDED,
)
with open(_OUT_FUNCTIONS.value, 'w') as f:
with open(_OUT_FUNCTIONS.value, 'w') as f: # pyrefly: ignore[no-matching-overload]
functions_str = formatter.format_as_python_code(visitor.exported_functions)
f.write(_HEADER_TEMPLATE.format(year=2022, type='functions'))
f.write(_FUNCTIONS_TEMPLATE.format(functions_str=functions_str))
with open(_OUT_ENUMS.value, 'w') as f:
with open(_OUT_ENUMS.value, 'w') as f: # pyrefly: ignore[no-matching-overload]
enums_str = formatter.format_as_python_code(visitor.exported_enums)
f.write(_HEADER_TEMPLATE.format(year=2022, type='enums'))
f.write(_ENUMS_TEMPLATE.format(enums_str=enums_str))
with open(_OUT_STRUCTS.value, 'w') as f:
with open(_OUT_STRUCTS.value, 'w') as f: # pyrefly: ignore[no-matching-overload]
structs_str = formatter.format_as_python_code(visitor.exported_structs)
f.write(_HEADER_TEMPLATE.format(year=2023, type='structs'))
f.write(_STRUCTS_TEMPLATE.format(structs_str=structs_str))
+2 -2
View File
@@ -57,7 +57,7 @@ def _parse_maybe_array(
int(s.strip()) for s in ARRAY_N_PATTERN.findall(array_match.group(0)))
inner_type_str = type_name[:array_match.start()]
return ast_nodes.ArrayType(
inner_type=_parse_maybe_pointer(inner_type_str.strip(), innermost_type),
inner_type=_parse_maybe_pointer(inner_type_str.strip(), innermost_type), # pyrefly: ignore[bad-argument-type]
extents=extents)
else:
return _parse_maybe_pointer(type_name, innermost_type)
@@ -140,7 +140,7 @@ def parse_type(
result = None
while type_str_stack:
try:
result = _parse_maybe_array(type_str_stack.pop(), result)
result = _parse_maybe_array(type_str_stack.pop(), result) # pyrefly: ignore[bad-argument-type]
except AssertionError as e:
raise ValueError(f'invalid type name {type_name!r}') from e