Skip to content

Commit d69d1b2

Browse files
committed
Fix order
1 parent 01952f4 commit d69d1b2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/py/kaleido/_fig_tools.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def to_spec(figure: Figurish, layout_opts: LayoutOpts) -> Spec:
125125

126126
# Extract info
127127
extension = _get_format(layout_opts.get("format") or DEFAULT_EXT)
128+
128129
width, height = _get_figure_dimensions(
129130
layout,
130131
layout_opts.get("width"),
@@ -160,7 +161,11 @@ def _next_filename(path: Path | str, prefix: str, ext: str) -> str:
160161

161162

162163
# validate and build full route if needed:
163-
def _build_full_path(path, fig, ext):
164+
def _build_full_path(
165+
path: Path | None,
166+
fig: Figurish,
167+
ext: FormatString,
168+
) -> Path:
164169
full_path: Path | None = None
165170

166171
directory: Path
@@ -187,6 +192,7 @@ def _build_full_path(path, fig, ext):
187192
_logger.debug(f"Found: {prefix}")
188193
name = _next_filename(directory, prefix, ext)
189194
full_path = directory / name
195+
return full_path
190196

191197

192198
# call all validators/automatic config fill-in/packaging in expected format
@@ -214,8 +220,8 @@ def build_fig_spec(
214220
if _assert_format(ext): # not strict necessary if but helps typeguard
215221
opts["format"] = ext
216222

217-
full_path = _build_full_path(path, fig, ext)
218-
219223
spec = to_spec(fig, opts)
220224

225+
full_path = _build_full_path(path, fig, spec["format"])
226+
221227
return spec, full_path

0 commit comments

Comments
 (0)