Skip to content

Commit

Permalink
Style linting and missing doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
norbusan committed Sep 4, 2024
1 parent 42b686f commit 62d89cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions preflight_parser/preflight_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def deal_with_bibliographies(


def _generate_preflight_response_dict(rundir: str) -> PreflightResponse:
"""Parse submission and generated preflight response."""
"""Parse submission and generated preflight response as dictionary."""
# parse files
n: dict[str, ParsedTeXFile] | ToplevelFile = parse_dir(rundir)
nodes: dict[str, ParsedTeXFile]
Expand Down Expand Up @@ -1109,14 +1109,16 @@ def _generate_preflight_response_dict(rundir: str) -> PreflightResponse:
tex_files=[n for n in nodes.values()],
)

def generate_preflight_response(rundir: str, json: bool = False, **kwargs) -> PreflightResponse|str:

def generate_preflight_response(rundir: str, json: bool = False, **kwargs) -> PreflightResponse | str:
"""Parse submission and generated preflight response as dictionary or json."""
try:
pfr: PreflightResponse = _generate_preflight_response_dict(rundir)
except PreflightException as e:
pfr = PreflightResponse(
status = PreflightStatus(key=PreflightStatusValues.error, info=str(e)),
status=PreflightStatus(key=PreflightStatusValues.error, info=str(e)),
detected_toplevel_files=[],
tex_files=[]
tex_files=[],
)
if json:
return pfr.model_dump_json(exclude_none=True, exclude_defaults=True, **kwargs)
Expand Down

0 comments on commit 62d89cd

Please sign in to comment.