Compare commits

..

2 commits

Author SHA1 Message Date
c9a6030591
Install poetry environment before pyright
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/static_analysis Pipeline was successful
2023-08-29 10:04:21 +02:00
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 image: ghcr.io/withlogicco/poetry:1.5.1
commands: commands:
- pip install pyright - pip install pyright
- poetry install
- python --version && poetry --version && pyright --version - python --version && poetry --version && pyright --version
- echo "------------- running pyright typecheck -------------" - echo "------------- running pyright typecheck -------------"
- poetry run pyright - poetry run pyright

View file

@ -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