Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Error message fixes + typing improvements

elijahbenizzy79bd68a3b95c
diff --git a/burr/core/action.py b/burr/core/action.py
index 194a3715..33d51e00 100644
--- a/burr/core/action.py
+++ b/burr/core/action.py
@@ -225,9 +225,13 @@ class Condition(Function):
return self._name
-default = Condition.default
-when = Condition.when
-expr = Condition.expr
+# Annotated inline as linters don't understand classmethods + properties
+# These, however, are allowed up until python 3.13
+# We're only keeping them as methods for documentation
+# TODO -- remove the static methods and make them
+default: Condition = Condition.default
+when: Condition = Condition.when
+expr: Condition = Condition.expr
class Result(Action):
diff --git a/burr/core/application.py b/burr/core/application.py
index 1787953d..ecf54ff7 100644
--- a/burr/core/application.py
+++ b/burr/core/application.py
@@ -387,12 +387,13 @@ class Application:
f"We have hit halt_after condition with prior action: {prior_action_name}. "
f"Returning: prior_action={prior_action}, result, and state"
)
+ return prior_action, result, self._state
logger.warning(
- "We have it an undefined condition -- do not rely on this behavior. "
"This is trying to return without having computed a single action -- "
"we'll end up just returning some Nones. This means that nothing was executed "
"(E.G. that the state machine had nowhere to go). Either fix the state machine or"
f"the halt conditions, or both... Halt conditions are: halt_before={halt_before}, halt_after={halt_after}."
+ f"Note that this is considered undefined behavior -- if you get here, you should fix!"
)
return prior_action, result, self._state