Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -16,7 +16,13 @@ Query = Union[
def query_var(v: SimpleQuery) -> str:
"""Convert a query variable to a string."""
"""Convert a query variable to a string.
Note: Objects implementing the ``__int__`` data model method (typed as
``SupportsInt``; e.g. ``uuid.UUID``) are converted via ``int()`` first.
Callers should convert such values to ``str`` explicitly if the string
representation is desired.
"""
cls = type(v)
if cls is int: # Fast path for non-subclassed int
return str(v)
@ -38,7 +44,7 @@ def query_var(v: SimpleQuery) -> str:
def get_str_query_from_sequence_iterable(
items: Iterable[tuple[Union[str, istr], QueryVariable]],
items: Iterable[tuple[str | istr, QueryVariable]],
) -> str:
"""Return a query string from a sequence of (key, value) pairs.
@ -58,7 +64,7 @@ def get_str_query_from_sequence_iterable(
def get_str_query_from_iterable(
items: Iterable[tuple[Union[str, istr], SimpleQuery]],
items: Iterable[tuple[str | istr, SimpleQuery]],
) -> str:
"""Return a query string from an iterable.
@ -76,14 +82,14 @@ def get_str_query_from_iterable(
return "&".join(pairs)
def get_str_query(*args: Any, **kwargs: Any) -> Union[str, None]:
def get_str_query(*args: Any, **kwargs: Any) -> str | None:
"""Return a query string from supported args."""
query: Union[
str,
Mapping[str, QueryVariable],
Sequence[tuple[Union[str, istr], SimpleQuery]],
None,
]
query: (
str
| Mapping[str, QueryVariable]
| Sequence[tuple[str | istr, SimpleQuery]]
| None
)
if kwargs:
if args:
msg = "Either kwargs or single query parameter must be present"