Skip to content

Commit b8d5623

Browse files
committed
ruff fixes
1 parent ce779bc commit b8d5623

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

HARK/model.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from HARK.parser import math_text_to_lambda
1616
from typing import Any, Callable, Mapping, List, Union
1717

18+
1819
class Aggregate:
1920
"""
2021
Used to designate a shock as an aggregate shock.
@@ -267,7 +268,11 @@ def get_dynamics(self):
267268
return self.dynamics
268269

269270
def get_vars(self):
270-
return list(self.shocks.keys()) + list(self.dynamics.keys()) + list(self.reward.keys())
271+
return (
272+
list(self.shocks.keys())
273+
+ list(self.dynamics.keys())
274+
+ list(self.reward.keys())
275+
)
271276

272277
def transition(self, pre, dr):
273278
"""

HARK/simulation/monte_carlo.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def __init__(
456456
self.initial = initial
457457

458458
self.seed = seed # NOQA
459-
self.agent_count = agent_count # TODO: pass this in at block level
459+
self.agent_count = agent_count # TODO: pass this in at block level
460460
self.T_sim = T_sim
461461

462462
# changes here from HARK.core.AgentType
@@ -534,20 +534,20 @@ def sim_one_period(self):
534534

535535
shocks_now = draw_shocks(
536536
self.shocks,
537-
np.zeros(self.agent_count) # TODO: stupid hack to remove age calculations.
538-
# this needs a little more thought
539-
)
537+
np.zeros(self.agent_count), # TODO: stupid hack to remove age calculations.
538+
# this needs a little more thought
539+
)
540540

541-
pre = self.calibration # for AgentTypeMC, this is conditional on age
542-
# TODO: generalize indexing into calibration.
541+
pre = self.calibration # for AgentTypeMC, this is conditional on age
542+
# TODO: generalize indexing into calibration.
543543

544544
pre.update(self.vars_prev)
545545
pre.update(shocks_now)
546546

547547
# Won't work for 3.8: self.parameters | self.vars_prev | shocks_now
548-
549-
dr = self.dr # AgentTypeMC chooses rule by age;
550-
# that generalizes to age as a DR argument?
548+
549+
dr = self.dr # AgentTypeMC chooses rule by age;
550+
# that generalizes to age as a DR argument?
551551

552552
post = simulate_dynamics(self.dynamics, pre, dr)
553553

@@ -570,7 +570,7 @@ def sim_birth(self, which_agents):
570570
-------
571571
None
572572
"""
573-
573+
574574
initial_vals = draw_shocks(self.initial, np.zeros(which_agents.sum()))
575575

576576
if np.sum(which_agents) > 0:
@@ -636,4 +636,4 @@ def clear_history(self):
636636
"""
637637
for var_name in self.vars:
638638
self.history[var_name] = np.empty((self.T_sim, self.agent_count))
639-
self.history[var_name].fill(np.nan)
639+
self.history[var_name].fill(np.nan)

HARK/simulation/test_monte_carlo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,4 @@ def test_simulate(self):
204204
- history["c"][5]
205205
)
206206

207-
self.assertTrue((a1 == b1).all())
207+
self.assertTrue((a1 == b1).all())

HARK/utilities.py

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def apply_fun_to_vals(fun, vals):
129129
"""
130130
return fun(*[vals[var] for var in signature(fun).parameters])
131131

132+
132133
# =======================================================
133134
# ================ Other useful functions ===============
134135
# =======================================================

0 commit comments

Comments
 (0)