Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions burr/core/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,12 @@ def validate_inputs(self, inputs: Optional[Dict[str, Any]]) -> None:
missing_inputs = required_inputs - given_inputs
additional_inputs = given_inputs - required_inputs - optional_inputs
if missing_inputs or additional_inputs:
raise ValueError(
f"Inputs to function {self} are invalid. "
+ f"Missing the following inputs: {', '.join(missing_inputs)}."
if missing_inputs
else (
"" f"Additional inputs: {','.join(additional_inputs)}."
if additional_inputs
else ""
)
)
parts = [f"Inputs to function {self} are invalid."]
if missing_inputs:
parts.append(f"Missing the following inputs: {', '.join(missing_inputs)}.")
if additional_inputs:
parts.append(f"Additional inputs: {', '.join(additional_inputs)}.")
raise ValueError(" ".join(parts))

def is_async(self) -> bool:
"""Convenience method to check if the function is async or not.
Expand Down
10 changes: 5 additions & 5 deletions burr/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ def _render_graphviz(

if output_file_path.suffix != "":
# infer format from path; i.e., extract `svg` from the `.svg` suffix
format = output_file_path.suffix.partition(".")[-1]
fmt = output_file_path.suffix.partition(".")[-1]
else:
format = "png"
fmt = "png"

path_without_suffix = pathlib.Path(output_file_path.parent, output_file_path.stem)
if write_dot or view:
# `.render()` appends the `format` kwarg to the filename
# i.e., we need to pass `/my/filepath` to generate `/my/filepath.png`
# otherwise, passing `/my/filepath.png` will generate `/my/filepath.png.png`
graphviz_obj.render(path_without_suffix, format=format, view=view)
graphviz_obj.render(path_without_suffix, format=fmt, view=view)
else:
# `.pipe()` doesn't append the format to the filename, so we do it explicitly
pathlib.Path(f"{path_without_suffix}.{format}").write_bytes(
graphviz_obj.pipe(format=format)
pathlib.Path(f"{path_without_suffix}.{fmt}").write_bytes(
graphviz_obj.pipe(format=fmt)
)


Expand Down
2 changes: 1 addition & 1 deletion burr/integrations/persisters/b_aiosqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from burr.core import State
from burr.core.persistence import AsyncBaseStatePersister, PersistedStateData

logger = logging.getLogger()
logger = logging.getLogger(__name__)

try:
from typing import Self
Expand Down
Loading