mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 01:57:48 -06:00
13 lines
489 B
Python
13 lines
489 B
Python
"""Keyword options a function takes through a TypedDict, checked as named parameters are."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping
|
|
|
|
|
|
def reject_unknown(function: str, options: Mapping[str, object], known: frozenset[str]) -> None:
|
|
"""Refuse a keyword the options do not declare, as a named parameter would."""
|
|
for key in options:
|
|
if key not in known:
|
|
raise TypeError(f"{function}() got an unexpected keyword argument '{key}'")
|