@@ -73,15 +73,15 @@ def __getitem__(self, index):
73
73
return self .transformed_structures [index ]
74
74
75
75
def __getattr__ (self , name ):
76
- return [getattr (x , name ) for x in self .transformed_structures ]
76
+ return [getattr (ts , name ) for ts in self .transformed_structures ]
77
77
78
78
def __len__ (self ):
79
79
return len (self .transformed_structures )
80
80
81
81
def __str__ (self ):
82
82
output = ["Current structures" , "------------" ]
83
- for x in self .transformed_structures :
84
- output .append (str (x .final_structure ))
83
+ for ts in self .transformed_structures :
84
+ output .append (str (ts .final_structure ))
85
85
return "\n " .join (output )
86
86
87
87
def undo_last_change (self ) -> None :
@@ -90,17 +90,17 @@ def undo_last_change(self) -> None:
90
90
Raises:
91
91
IndexError if already at the oldest change.
92
92
"""
93
- for x in self .transformed_structures :
94
- x .undo_last_change ()
93
+ for ts in self .transformed_structures :
94
+ ts .undo_last_change ()
95
95
96
96
def redo_next_change (self ) -> None :
97
97
"""Redo the last undone transformation in the TransformedStructure.
98
98
99
99
Raises:
100
100
IndexError if already at the latest change.
101
101
"""
102
- for x in self .transformed_structures :
103
- x .redo_next_change ()
102
+ for ts in self .transformed_structures :
103
+ ts .redo_next_change ()
104
104
105
105
def append_transformation (self , transformation , extend_collection = False , clear_redo = True ):
106
106
"""Append a transformation to all TransformedStructures.
@@ -122,15 +122,15 @@ def append_transformation(self, transformation, extend_collection=False, clear_r
122
122
if self .ncores and transformation .use_multiprocessing :
123
123
with Pool (self .ncores ) as p :
124
124
# need to condense arguments into single tuple to use map
125
- z = ((x , transformation , extend_collection , clear_redo ) for x in self .transformed_structures )
125
+ z = ((ts , transformation , extend_collection , clear_redo ) for ts in self .transformed_structures )
126
126
trafo_new_structs = p .map (_apply_transformation , z , 1 )
127
127
self .transformed_structures = []
128
128
for ts in trafo_new_structs :
129
129
self .transformed_structures .extend (ts )
130
130
else :
131
131
new_structures = []
132
- for x in self .transformed_structures :
133
- new = x .append_transformation (transformation , extend_collection , clear_redo = clear_redo )
132
+ for ts in self .transformed_structures :
133
+ new = ts .append_transformation (transformation , extend_collection , clear_redo = clear_redo )
134
134
if new is not None :
135
135
new_structures += new
136
136
self .transformed_structures += new_structures
0 commit comments