Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcrimsontianyu committed Feb 24, 2025
1 parent b75c740 commit 87d1007
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/kvikio/kvikio/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,21 @@ def _set_property(self, property: str, value: Any):


def set(*config: Any) -> ConfigContextManager:
msg = (
"kvikio.defaults.set(config: dict) or kvikio.defaults.set(key: str, value: Any)"
err_msg = (
"Valid arguments are kvikio.defaults.set(config: dict) or "
"kvikio.defaults.set(key: str, value: Any)"
)

if len(config) == 1:
if not isinstance(config[0], dict):
raise ValueError(f"Valid arguments are {msg}")
raise ValueError(err_msg)
return ConfigContextManager(config[0])
elif len(config) == 2:
if not isinstance(config[0], str):
raise ValueError(f"Valid arguments are {msg}")
raise ValueError(err_msg)
return ConfigContextManager({config[0]: config[1]})
else:
raise ValueError(f"Valid arguments are {msg}")
raise ValueError(err_msg)


def compat_mode() -> kvikio.CompatMode:
Expand Down

0 comments on commit 87d1007

Please sign in to comment.