build: Fix argument type in clutter-keysyms-update.py

It's not a single-element-tuple but something we can iterate and
produces strings.

Also ignore typing for the requests module because we'd have to install
more things for it to be available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4267>
This commit is contained in:
Sebastian Wick
2025-02-12 15:08:05 +01:00
committed by Marge Bot
parent 0718ef101c
commit 1fdebedd94

View File

@ -11,9 +11,9 @@
import os import os
import sys import sys
import re import re
from typing import TextIO from typing import TextIO, Iterable
import requests import requests # type: ignore[import-untyped]
KEYSYMDEF_URL = "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/keysymdef.h" KEYSYMDEF_URL = "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/keysymdef.h"
XF86KEYSYM_URL = "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/XF86keysym.h" XF86KEYSYM_URL = "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/XF86keysym.h"
@ -58,22 +58,23 @@ def get_and_filter_header(
url: str, url: str,
prefix: str, prefix: str,
output_file: TextIO, output_file: TextIO,
filter_out: tuple[str] | None = None, filter_out: Iterable[str] | None = None,
replaces: dict[str, str] | None = None, replaces: dict[str, str] | None = None,
): ):
""" """
Fetches and processes a header file containing macro definitions, filtering and transforming Fetches and processes a header file containing macro definitions, filtering
entries based on the specified prefix, exclusions, and replacements. and transforming entries based on the specified prefix, exclusions, and
replacements.
Args: Args:
url (str): The URL to fetch the file content from. url: The URL to fetch the file content from.
prefix (str): The prefix to filter the macro definitions in the file. prefix: The prefix to filter the macro definitions in the file.
output_file (TextIO): The file object where the filtered and transformed definitions output_file: The file object where the filtered and transformed
will be written. definitions will be written.
filter_out (tuple, optional): A tuple of macro names to exclude from processing. filter_out: An iterable producing macro names to exclude from
Defaults to None. processing. Defaults to None.
replaces (dict, optional): A dictionary mapping macro names to their replacements. replaces: A dictionary mapping macro names to their replacements.
Defaults to None. Defaults to None.
""" """
for line in requests.get(url, timeout=5).text.splitlines(): for line in requests.get(url, timeout=5).text.splitlines():
if not line.startswith("#define " + prefix): if not line.startswith("#define " + prefix):