Skip to content

Commit e31a231

Browse files
committed
Updated code to reflect older version of Black (22.12.0)
1 parent faa3a5b commit e31a231

17 files changed

+82
-86
lines changed

activitysim/abm/models/disaggregate_accessibility.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ class DisaggregateAccessibilitySettings(PydanticReadable, extra="forbid"):
100100
BASE_RANDOM_SEED: int = 0
101101
add_size_tables: bool = True
102102
zone_id_names: dict[str, str] = {"index_col": "zone_id"}
103-
ORIGIN_SAMPLE_METHOD: Literal[None, "full", "uniform", "uniform-taz", "kmeans"] = (
104-
None
105-
)
103+
ORIGIN_SAMPLE_METHOD: Literal[
104+
None, "full", "uniform", "uniform-taz", "kmeans"
105+
] = None
106106
"""
107107
The method in which origins are sampled.
108108

activitysim/abm/models/location_choice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,9 +1014,9 @@ def iterate_location_choice(
10141014

10151015
logger.debug(f"{trace_label} max_iterations: {max_iterations}")
10161016

1017-
save_sample_df = choices_df = (
1018-
None # initialize to None, will be populated in first iteration
1019-
)
1017+
save_sample_df = (
1018+
choices_df
1019+
) = None # initialize to None, will be populated in first iteration
10201020

10211021
for iteration in range(1, max_iterations + 1):
10221022
persons_merged_df_ = persons_merged_df.copy()

activitysim/abm/models/trip_departure_choice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ def build_patterns(trips, time_windows):
132132
]
133133
possible_windows = np.unique(possible_windows, axis=1).transpose()
134134
filler = np.full((possible_windows.shape[0], max_trip_count), np.nan)
135-
filler[: possible_windows.shape[0], : possible_windows.shape[1]] = (
136-
possible_windows
137-
)
135+
filler[
136+
: possible_windows.shape[0], : possible_windows.shape[1]
137+
] = possible_windows
138138
patterns.append(filler)
139139
pattern_sizes.append(filler.shape[0])
140140

activitysim/abm/models/trip_scheduling_choice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ def run_trip_scheduling_choice(
251251
tours.loc[tours[HAS_OB_STOPS] != tours[HAS_IB_STOPS], NUM_ALTERNATIVES] = (
252252
tours[TOUR_DURATION_COLUMN] + 1
253253
)
254-
tours.loc[tours[HAS_OB_STOPS] & tours[HAS_IB_STOPS], NUM_ALTERNATIVES] = (
255-
tours.apply(lambda x: alt_sizes[1, x.duration], axis=1)
256-
)
254+
tours.loc[
255+
tours[HAS_OB_STOPS] & tours[HAS_IB_STOPS], NUM_ALTERNATIVES
256+
] = tours.apply(lambda x: alt_sizes[1, x.duration], axis=1)
257257

258258
# If no intermediate stops on the tour, then then main leg duration
259259
# equals the tour duration and the intermediate durations are zero

activitysim/abm/models/util/cdap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def assign_cdap_rank(
150150
)
151151

152152
# tag the backfilled persons
153-
persons.loc[others[others.cdap_rank == RANK_UNASSIGNED].index, "cdap_rank"] = (
154-
RANK_BACKFILL
155-
)
153+
persons.loc[
154+
others[others.cdap_rank == RANK_UNASSIGNED].index, "cdap_rank"
155+
] = RANK_BACKFILL
156156
del others
157157

158158
# assign person number in cdapPersonArray preference order

activitysim/abm/models/util/school_escort_tours_trips.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ def join_attributes(df, column_names):
165165
).sum(axis=1)
166166

167167
# school_destinations, school_starts, school_ends, and school_tour_ids are concatenated
168-
bundles.loc[filtered_bundles.index, "school_destinations"] = (
169-
join_attributes(
170-
filtered_bundles,
171-
[
172-
f"school_destination_child{first_child}",
173-
f"school_destination_child{second_child}",
174-
f"school_destination_child{third_child}",
175-
],
176-
)
168+
bundles.loc[
169+
filtered_bundles.index, "school_destinations"
170+
] = join_attributes(
171+
filtered_bundles,
172+
[
173+
f"school_destination_child{first_child}",
174+
f"school_destination_child{second_child}",
175+
f"school_destination_child{third_child}",
176+
],
177177
)
178178

179179
bundles.loc[filtered_bundles.index, "school_starts"] = join_attributes(
@@ -194,15 +194,15 @@ def join_attributes(df, column_names):
194194
],
195195
)
196196

197-
bundles.loc[filtered_bundles.index, "school_tour_ids"] = (
198-
join_attributes(
199-
filtered_bundles,
200-
[
201-
f"school_tour_id_child{first_child}",
202-
f"school_tour_id_child{second_child}",
203-
f"school_tour_id_child{third_child}",
204-
],
205-
)
197+
bundles.loc[
198+
filtered_bundles.index, "school_tour_ids"
199+
] = join_attributes(
200+
filtered_bundles,
201+
[
202+
f"school_tour_id_child{first_child}",
203+
f"school_tour_id_child{second_child}",
204+
f"school_tour_id_child{third_child}",
205+
],
206206
)
207207

208208
bundles.drop(columns=["first_child", "second_child", "third_child"], inplace=True)
@@ -399,9 +399,9 @@ def create_chauf_escort_trips(bundles):
399399
~chauf_trips["primary_purpose"].isna()
400400
), f"Missing tour purpose for {chauf_trips[chauf_trips['primary_purpose'].isna()]}"
401401

402-
chauf_trips.loc[chauf_trips["purpose"] == "home", "trip_num"] = (
403-
999 # trips home are always last
404-
)
402+
chauf_trips.loc[
403+
chauf_trips["purpose"] == "home", "trip_num"
404+
] = 999 # trips home are always last
405405
chauf_trips.sort_values(
406406
by=["household_id", "tour_id", "outbound", "trip_num"],
407407
ascending=[True, True, False, True],
@@ -559,9 +559,9 @@ def create_escortee_trips(bundles):
559559
id_cols = ["household_id", "person_id", "tour_id"]
560560
escortee_trips[id_cols] = escortee_trips[id_cols].astype("int64")
561561

562-
escortee_trips.loc[escortee_trips["purpose"] == "home", "trip_num"] = (
563-
999 # trips home are always last
564-
)
562+
escortee_trips.loc[
563+
escortee_trips["purpose"] == "home", "trip_num"
564+
] = 999 # trips home are always last
565565
escortee_trips.sort_values(
566566
by=["household_id", "tour_id", "outbound", "trip_num"],
567567
ascending=[True, True, False, True],

activitysim/abm/models/util/tour_scheduling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def run_tour_scheduling(
7979
specs[spec_segment_name] = simulate.eval_coefficients(
8080
state, model_spec, coefficients_df, estimator
8181
)
82-
compute_settings[spec_segment_name] = (
83-
spec_settings.compute_settings.subcomponent_settings(spec_segment_name)
84-
)
82+
compute_settings[
83+
spec_segment_name
84+
] = spec_settings.compute_settings.subcomponent_settings(spec_segment_name)
8585

8686
if estimator:
8787
estimators[spec_segment_name] = estimator # add to local list

activitysim/abm/models/vehicle_allocation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ def vehicle_allocation(
255255

256256
# set choice for non-household vehicle option
257257
choices["choice"] = choices["choice"].astype(veh_choice_dtype)
258-
choices.loc[choices["alt_choice"] == alts_from_spec[-1], "choice"] = (
259-
alts_from_spec[-1]
260-
)
258+
choices.loc[
259+
choices["alt_choice"] == alts_from_spec[-1], "choice"
260+
] = alts_from_spec[-1]
261261

262262
# creating a column for choice of each occupancy level
263263
tours_veh_occup_col = f"vehicle_occup_{occup}"

activitysim/abm/models/vehicle_type_choice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ class VehicleTypeChoiceSettings(LogitComponentSettings, extra="forbid"):
566566
PROBS_SPEC: str | None = None
567567
combinatorial_alts: dict | None = None
568568
alts_preprocessor: PreprocessorSettings | None = None
569-
SIMULATION_TYPE: Literal["simple_simulate", "interaction_simulate"] = (
570-
"interaction_simulate"
571-
)
569+
SIMULATION_TYPE: Literal[
570+
"simple_simulate", "interaction_simulate"
571+
] = "interaction_simulate"
572572
COLS_TO_INCLUDE_IN_VEHICLE_TABLE: list[str] = []
573573

574574
COLS_TO_INCLUDE_IN_CHOOSER_TABLE: list[str] = []

activitysim/abm/tables/disaggregate_accessibility.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ def disaggregate_accessibility(state: workflow.State) -> pd.DataFrame:
190190
)
191191

192192
# Copy home_zone_id in proto-table to match the temporary 'nearest_zone_id'
193-
proto_accessibility_df["nearest_accessibility_zone_id"] = (
194-
proto_accessibility_df.home_zone_id
195-
)
193+
proto_accessibility_df[
194+
"nearest_accessibility_zone_id"
195+
] = proto_accessibility_df.home_zone_id
196196

197197
# Set up the useful columns
198198
exact_cols = merging_params.get("by", [])

0 commit comments

Comments
 (0)