mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
refactor: one keyword-option guard in core
This commit is contained in:
1 parent
27330be60a
commit
b4573d310b
13 files changed
+42
-44
No files matched your search
@@ -0,0 +1,12 @@
|
||||
"""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}'")
|
||||
Reference in new issue
Block a user