Skip to content

Commit

Permalink
Make black and ruff agree
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Moss committed Feb 1, 2024
1 parent e1376b8 commit aab49a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 3 additions & 9 deletions aequilibrae/matrix/aequilibrae_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,7 @@ def create_empty(
raise ValueError(mat_name + " is a reserved name")
if len(mat_name) > CORE_NAME_MAX_LENGTH:
raise ValueError(
"Matrix names need to be be shorter " "than {}: {}".format(
CORE_NAME_MAX_LENGTH, mat_name
)
f"Matrix names need to be be shorter than {CORE_NAME_MAX_LENGTH}: {mat_name}"
)
else:
raise ValueError("Matrix core names need to be strings: " + str(mat_name))
Expand Down Expand Up @@ -608,9 +606,7 @@ def __write__(self):
np.memmap(self.file_path, dtype="uint8", offset=17, mode="r+", shape=1)[0] = data_size

# matrix name
np.memmap(self.file_path, dtype="S" + str(MATRIX_NAME_MAX_LENGTH), offset=18, mode="r+", shape=1)[
0
] = self.name
np.memmap(self.file_path, dtype=f"S{MATRIX_NAME_MAX_LENGTH}", offset=18, mode="r+", shape=1)[0] = self.name

# matrix description
offset = 18 + MATRIX_NAME_MAX_LENGTH
Expand Down Expand Up @@ -1133,9 +1129,7 @@ def setName(self, matrix_name: str):
if len(str(matrix_name)) > MATRIX_NAME_MAX_LENGTH:
matrix_name = str(matrix_name)[0:MATRIX_NAME_MAX_LENGTH]

np.memmap(self.file_path, dtype="S" + str(MATRIX_NAME_MAX_LENGTH), offset=18, mode="r+", shape=1)[
0
] = matrix_name
np.memmap(self.file_path, dtype=f"S{MATRIX_NAME_MAX_LENGTH}", offset=18, shape=1)[0] = matrix_name

def setDescription(self, matrix_description: str):
"""
Expand Down
6 changes: 2 additions & 4 deletions aequilibrae/transit/gtfs_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ def __deconflict_stop_times(self) -> None:
}
)

for _, rec in max_speeds.iterrows():
df.loc[
(df.dist >= rec.min_distance) & (df.dist < rec.max_distance), "max_speed"
] = rec.speed
for _, r in max_speeds.iterrows():
df.loc[(df.dist >= r.min_distance) & (df.dist < r.max_distance), "max_speed"] = r.speed

to_fix = df[df.max_speed < df.speed].index.values
if to_fix.shape[0] > 0:
Expand Down

0 comments on commit aab49a8

Please sign in to comment.