Compare commits

...

2 Commits

Author SHA1 Message Date
Marty Oehme c9a6030591
Install poetry environment before pyright
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/static_analysis Pipeline was successful Details
2023-08-29 10:04:21 +02:00
Marty Oehme ea99ef071a
Format black 2023-08-29 10:04:06 +02:00
2 changed files with 9 additions and 6 deletions

View File

@ -3,6 +3,7 @@ pipeline:
image: ghcr.io/withlogicco/poetry:1.5.1
commands:
- pip install pyright
- poetry install
- python --version && poetry --version && pyright --version
- echo "------------- running pyright typecheck -------------"
- poetry run pyright

View File

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