From afb5b4487083d7e8db4d643325800ecc8f8db9ad Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Sat, 20 Apr 2024 21:57:25 +0200 Subject: [PATCH] Replace match with if/elif (unspported in Python<3.10) --- src/linkahead/cached.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/linkahead/cached.py b/src/linkahead/cached.py index eaf24da0..ea743015 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) -- GitLab