Format black

This commit is contained in:
Marty Oehme 2023-08-29 10:04:06 +02:00
parent f3cbe31990
commit ea99ef071a
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -42,7 +42,7 @@ def start(filename: Path) -> list[Annotation]:
def _tag_from_colorname(colorname: str) -> str: def _tag_from_colorname(colorname: str) -> str:
color_mapping: dict[str,str] = getdict("tags", "plugins.extract") color_mapping: dict[str, str] = getdict("tags", "plugins.extract")
if not color_mapping: if not color_mapping:
return "" return ""
@ -82,6 +82,7 @@ def _retrieve_annotation_content(
# just a highlight without any text # just a highlight without any text
return (None, None) return (None, None)
# mimics the functions in papis.config.{getlist,getint,getfloat} etc. # mimics the functions in papis.config.{getlist,getint,getfloat} etc.
def getdict(key: str, section: Optional[str] = None) -> dict[str, str]: def getdict(key: str, section: Optional[str] = None) -> dict[str, str]:
"""Dict getter """Dict getter
@ -97,13 +98,14 @@ def getdict(key: str, section: Optional[str] = None) -> dict[str, str]:
rawvalue = eval(rawvalue) rawvalue = eval(rawvalue)
except Exception: except Exception:
raise SyntaxError( raise SyntaxError(
"The key '{}' must be a valid Python object: {}" "The key '{}' must be a valid Python object: {}".format(key, rawvalue)
.format(key, rawvalue)) )
else: else:
if not isinstance(rawvalue, dict): if not isinstance(rawvalue, dict):
raise SyntaxError( raise SyntaxError(
"The key '{}' must be a valid Python dict. Got: {} (type {!r})" "The key '{}' must be a valid Python dict. Got: {} (type {!r})".format(
.format(key, rawvalue, type(rawvalue).__name__)) key, rawvalue, type(rawvalue).__name__
)
)
return rawvalue return rawvalue