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

Fix newline in format string (unsupported by Python < 3.12

parent 32b3c6cb
No related branches found
No related tags found
2 merge requests!143Release 0.15.0,!135Add and fix more type hints
Pipeline #50077 failed
......@@ -126,20 +126,24 @@ def _cached_access(kind: AccessType, value: Union[str, int], unique: bool = True
try:
if kind == AccessType.QUERY:
assert isinstance(value, str), f"If kind is QUERY, value must be a string, not {
type(value)}."
if not isinstance(value, str):
raise TypeError(
f"If AccessType is QUERY, value must be a string, not {type(value)}.")
return execute_query(value, unique=unique)
if kind == AccessType.NAME:
assert isinstance(value, str), f"If kind is NAME, value must be a string, not {
type(value)}."
if not isinstance(value, str):
raise TypeError(
f"If AccessType is NAME, value must be a string, not {type(value)}.")
return get_entity.get_entity_by_name(value)
if kind == AccessType.EID:
assert isinstance(value, (str, int)), f"If kind is EID, value must be a string or int, not {
type(value)}."
if not isinstance(value, (str, int)):
raise TypeError(
f"If AccessType is EID, value must be a string or int, not {type(value)}.")
return get_entity.get_entity_by_id(value)
if kind == AccessType.PATH:
assert isinstance(value, str), f"If kind is PATH, value must be a string, not {
type(value)}."
if not isinstance(value, str):
raise TypeError(
f"If AccessType is PATH, value must be a string, not {type(value)}.")
return get_entity.get_entity_by_path(value)
except (QueryNotUniqueError, EmptyUniqueQueryError) as exc:
return exc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment