Skip to content

Commit

Permalink
fix: Fallback to None when attribute is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 24, 2024
1 parent 2162451 commit b547ee3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/bank_reserves/bank_reserves/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(
"Money": get_total_money,
"Loans": get_total_loans,
},
agent_reporters={"Wealth": lambda x: x.wealth},
agent_reporters={"Wealth": lambda x: getattr(x, "wealth", None)},
)

# create a single bank for the model
Expand Down
2 changes: 1 addition & 1 deletion examples/charts/charts/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(
"Money": get_total_money,
"Loans": get_total_loans,
},
agent_reporters={"Wealth": lambda x: x.wealth},
agent_reporters={"Wealth": lambda x: getattr(x, "wealth", None)},
)

# create a single bank for the model
Expand Down

0 comments on commit b547ee3

Please sign in to comment.