Skip to content
Snippets Groups Projects
Commit afb5b448 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Replace match with if/elif (unspported in Python<3.10)

parent 35b1b86d
Branches
Tags
2 merge requests!143Release 0.15.0,!135Add and fix more type hints
Pipeline #50078 passed with warnings
...@@ -203,18 +203,18 @@ unique: bool, optional ...@@ -203,18 +203,18 @@ unique: bool, optional
:func:`cached_query`. :func:`cached_query`.
""" """
match kind:
case AccessType.QUERY: if kind == AccessType.QUERY:
assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings."
case AccessType.NAME: elif kind == AccessType.NAME:
assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings."
case AccessType.EID: elif kind == AccessType.EID:
assert all(isinstance(key, (str, int)) assert all(isinstance(key, (str, int))
for key in items.keys()), "Keys must be strings or integers." for key in items.keys()), "Keys must be strings or integers."
case AccessType.PATH: elif kind == AccessType.PATH:
assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings." assert all(isinstance(key, str) for key in items.keys()), "Keys must be strings."
case _: elif kind == _:
raise ValueError(f"Unknown AccessType: {kind}") raise ValueError(f"Unknown AccessType: {kind}")
# 1. add the given items to the corresponding dummy dict cache # 1. add the given items to the corresponding dummy dict cache
_DUMMY_CACHE.update(items) _DUMMY_CACHE.update(items)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment