diff --git a/src/linkahead/cached.py b/src/linkahead/cached.py index eaf24da0d79b643dea67116f428d906f3d0db784..ea7430155b2305d27c06deff2a5c6df5784d9995 100644 --- a/src/linkahead/cached.py +++ b/src/linkahead/cached.py @@ -203,18 +203,18 @@ unique: bool, optional :func:`cached_query`. """ - match kind: - case AccessType.QUERY: - assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." - case AccessType.NAME: - assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." - case AccessType.EID: - assert all(isinstance(key, (str, int)) - for key in items.keys()), "Keys must be strings or integers." - case AccessType.PATH: - assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." - case _: - raise ValueError(f"Unknown AccessType: {kind}") + + if kind == AccessType.QUERY: + assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." + elif kind == AccessType.NAME: + assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." + elif kind == AccessType.EID: + assert all(isinstance(key, (str, int)) + for key in items.keys()), "Keys must be strings or integers." + elif kind == AccessType.PATH: + assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." + elif kind == _: + raise ValueError(f"Unknown AccessType: {kind}") # 1. add the given items to the corresponding dummy dict cache _DUMMY_CACHE.update(items)