Skip to content

Commit 0bdc3eb

Browse files
committed
Fix linting
1 parent 3e6cc58 commit 0bdc3eb

File tree

3 files changed

+45
-49
lines changed

3 files changed

+45
-49
lines changed

lasso/dimred/dimred_run.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ def __init__(
328328
self.logfile_filepath = (
329329
logfile_filepath
330330
if logfile_filepath
331-
else os.path.join(project_dir, "logfile")
332-
if project_dir
333-
else ""
331+
else os.path.join(project_dir, "logfile") if project_dir else ""
334332
)
335333

336334
self._msg_option = "{:16s}: {}"

lasso/dyna/d3plot.py

+20-22
Original file line numberDiff line numberDiff line change
@@ -2412,12 +2412,10 @@ def _read_geometry_data(self):
24122412
if self.header.has_solid_2_extra_nodes:
24132413
section_word_length = 2 * n_solids
24142414
try:
2415-
self.arrays[
2416-
ArrayType.element_solid_extra_nodes
2417-
] = elem_solid_data = self._buffer.read_ndarray(
2418-
position, section_word_length * self.header.wordsize, 1, self._header.itype
2419-
).reshape(
2420-
(n_solids, 2)
2415+
self.arrays[ArrayType.element_solid_extra_nodes] = elem_solid_data = (
2416+
self._buffer.read_ndarray(
2417+
position, section_word_length * self.header.wordsize, 1, self._header.itype
2418+
).reshape((n_solids, 2))
24212419
)
24222420
except Exception:
24232421
trb_msg = traceback.format_exc()
@@ -2773,9 +2771,9 @@ def _read_rigid_body_description(self):
27732771
rigid_body_n_active_nodes, dtype=self._header.itype
27742772
)
27752773
self.arrays[ArrayType.rigid_body_node_indexes_list] = rigid_body_node_indexes_list
2776-
self.arrays[
2777-
ArrayType.rigid_body_active_node_indexes_list
2778-
] = rigid_body_active_node_indexes_list
2774+
self.arrays[ArrayType.rigid_body_active_node_indexes_list] = (
2775+
rigid_body_active_node_indexes_list
2776+
)
27792777

27802778
# update position
27812779
self.geometry_section_size = position
@@ -4534,10 +4532,10 @@ def _read_states_tshell(self, state_data: np.ndarray, var_index: int, array_dict
45344532
# PSTRAIN
45354533
if has_pstrain:
45364534
try:
4537-
array_dict[
4538-
ArrayType.element_tshell_effective_plastic_strain
4539-
] = tshell_layer_data[:, :, :, i_tshell_layer_var].reshape(
4540-
(n_states, n_tshells, n_layers)
4535+
array_dict[ArrayType.element_tshell_effective_plastic_strain] = (
4536+
tshell_layer_data[:, :, :, i_tshell_layer_var].reshape(
4537+
(n_states, n_tshells, n_layers)
4538+
)
45414539
)
45424540
except Exception:
45434541
trb_msg = traceback.format_exc()
@@ -4924,9 +4922,9 @@ def _read_states_shell(self, state_data: np.ndarray, var_index: int, array_dict:
49244922
pstrain_tensor = shell_nonlayer_data[
49254923
:, :, nonlayer_var_index : nonlayer_var_index + n_plastic_strain_tensor
49264924
]
4927-
array_dict[
4928-
ArrayType.element_shell_plastic_strain_tensor
4929-
] = pstrain_tensor.reshape((n_states, n_shells, n_layers, 6))
4925+
array_dict[ArrayType.element_shell_plastic_strain_tensor] = (
4926+
pstrain_tensor.reshape((n_states, n_shells, n_layers, 6))
4927+
)
49304928
except Exception:
49314929
trb_msg = traceback.format_exc()
49324930
msg = "A failure in %s was caught:\n%s"
@@ -4942,9 +4940,9 @@ def _read_states_shell(self, state_data: np.ndarray, var_index: int, array_dict:
49424940
thermal_tensor = shell_nonlayer_data[
49434941
:, :, nonlayer_var_index : nonlayer_var_index + n_thermal_strain_tensor
49444942
]
4945-
array_dict[
4946-
ArrayType.element_shell_thermal_strain_tensor
4947-
] = thermal_tensor.reshape((n_states, n_shells, 6))
4943+
array_dict[ArrayType.element_shell_thermal_strain_tensor] = (
4944+
thermal_tensor.reshape((n_states, n_shells, 6))
4945+
)
49484946
except Exception:
49494947
trb_msg = traceback.format_exc()
49504948
msg = "A failure in %s was caught:\n%s"
@@ -5434,9 +5432,9 @@ def get_dtype(type_flag):
54345432
# particle segment distance
54355433
elif var_name.startswith("NS dist"):
54365434
try:
5437-
array_dict[
5438-
ArrayType.airbag_particle_nearest_segment_distance
5439-
] = particle_data[:, :, i_particle_var].view(get_dtype(var_type))
5435+
array_dict[ArrayType.airbag_particle_nearest_segment_distance] = (
5436+
particle_data[:, :, i_particle_var].view(get_dtype(var_type))
5437+
)
54405438
except Exception:
54415439
trb_msg = traceback.format_exc()
54425440
msg = "A failure in %s %s was caught:\n%s"

lasso/femzip/femzip_api.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -1068,16 +1068,16 @@ def _decompose_read_variables_array(
10681068
(n_timesteps_read, file_metadata.number_of_nodes, 3)
10691069
)
10701070
var_pos += array_size
1071-
result_arrays[
1072-
(variable_index, variable_name, FemzipVariableCategory.NODE)
1073-
] = var_array
1071+
result_arrays[(variable_index, variable_name, FemzipVariableCategory.NODE)] = (
1072+
var_array
1073+
)
10741074
else:
10751075
array_size = file_metadata.number_of_nodes
10761076
var_array = all_vars_array[:, var_pos : var_pos + array_size]
10771077
var_pos += array_size
1078-
result_arrays[
1079-
(variable_index, variable_name, FemzipVariableCategory.NODE)
1080-
] = var_array
1078+
result_arrays[(variable_index, variable_name, FemzipVariableCategory.NODE)] = (
1079+
var_array
1080+
)
10811081

10821082
elif variable_category == FemzipVariableCategory.SHELL:
10831083
array_size = (
@@ -1086,44 +1086,44 @@ def _decompose_read_variables_array(
10861086
)
10871087
var_array = all_vars_array[:, var_pos : var_pos + array_size]
10881088
var_pos += array_size
1089-
result_arrays[
1090-
(variable_index, variable_name, FemzipVariableCategory.SHELL)
1091-
] = var_array
1089+
result_arrays[(variable_index, variable_name, FemzipVariableCategory.SHELL)] = (
1090+
var_array
1091+
)
10921092
elif variable_category == FemzipVariableCategory.SOLID:
10931093
array_size = file_metadata.number_of_solid_elements
10941094
var_array = all_vars_array[:, var_pos : var_pos + array_size]
10951095
var_pos += array_size
1096-
result_arrays[
1097-
(variable_index, variable_name, FemzipVariableCategory.SOLID)
1098-
] = var_array
1096+
result_arrays[(variable_index, variable_name, FemzipVariableCategory.SOLID)] = (
1097+
var_array
1098+
)
10991099
elif variable_category == FemzipVariableCategory.BEAM:
11001100
array_size = file_metadata.number_of_1D_elements
11011101
var_array = all_vars_array[:, var_pos : var_pos + array_size]
11021102
var_pos += array_size
1103-
result_arrays[
1104-
variable_index, variable_name, FemzipVariableCategory.BEAM
1105-
] = var_array
1103+
result_arrays[variable_index, variable_name, FemzipVariableCategory.BEAM] = (
1104+
var_array
1105+
)
11061106
elif variable_category == FemzipVariableCategory.THICK_SHELL:
11071107
array_size = file_metadata.number_of_thick_shell_elements
11081108
var_array = all_vars_array[:, var_pos : var_pos + array_size]
11091109
var_pos += array_size
1110-
result_arrays[
1111-
variable_index, variable_name, FemzipVariableCategory.THICK_SHELL
1112-
] = var_array
1110+
result_arrays[variable_index, variable_name, FemzipVariableCategory.THICK_SHELL] = (
1111+
var_array
1112+
)
11131113
elif variable_category == FemzipVariableCategory.GLOBAL:
11141114
array_size = 6
11151115
var_array = all_vars_array[:, var_pos : var_pos + array_size]
11161116
var_pos += array_size
1117-
result_arrays[
1118-
variable_index, variable_name, FemzipVariableCategory.GLOBAL
1119-
] = var_array
1117+
result_arrays[variable_index, variable_name, FemzipVariableCategory.GLOBAL] = (
1118+
var_array
1119+
)
11201120
elif variable_category == FemzipVariableCategory.PART:
11211121
array_size = n_parts * 7 + n_rigid_walls * n_rigid_wall_vars
11221122
var_array = all_vars_array[:, var_pos : var_pos + array_size]
11231123
var_pos += array_size
1124-
result_arrays[
1125-
variable_index, variable_name, FemzipVariableCategory.PART
1126-
] = var_array
1124+
result_arrays[variable_index, variable_name, FemzipVariableCategory.PART] = (
1125+
var_array
1126+
)
11271127
elif variable_category == FemzipVariableCategory.CPM_FLOAT_VAR:
11281128
array_size = n_airbag_particles
11291129
var_array = all_vars_array[:, var_pos : var_pos + array_size]

0 commit comments

Comments
 (0)