Fix Runnable Lambda Afunc Repr (#13413)

Otherwise, you get an error when using async functions.


h/t to Chris Ruppelt
pull/13419/head^2
William FH 10 months ago committed by GitHub
parent 1726d5dcdd
commit ba501b27a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2430,7 +2430,12 @@ class RunnableLambda(Runnable[Input, Output]):
def __repr__(self) -> str:
"""A string representation of this runnable."""
return f"RunnableLambda({get_lambda_source(self.func) or '...'})"
if hasattr(self, "func"):
return f"RunnableLambda({get_lambda_source(self.func) or '...'})"
elif hasattr(self, "afunc"):
return f"RunnableLambda(afunc={get_lambda_source(self.afunc) or '...'})"
else:
return "RunnableLambda(...)"
def _invoke(
self,

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save