MCPcopy Create free account
hub / github.com/PyTables/PyTables / set_attr

Method set_attr

bench/undo_redo.py:118–148  ·  view source on GitHub ↗

Checking a undo/redo for setting attributes.

(self)

Source from the content-addressed store, hash-verified

116 )
117
118 def set_attr(self):
119 """Checking a undo/redo for setting attributes."""
120
121 # Create a new array
122 self.fileh.create_array("/", "array", self.a1)
123 for i in range(self.nobjects):
124 # Set an attribute
125 setattr(self.fileh.root.array.attrs, "attr" + str(i), str(self.a1))
126 # Put a mark
127 self.fileh.mark()
128 # Unwind all marks sequentially
129 for i in range(self.niter):
130 t1 = clock()
131 for i in range(self.nobjects):
132 self.fileh.undo()
133 if verbose:
134 print("u", end=" ")
135 if verbose:
136 print()
137 undo = clock() - t1
138 # Rewind all marks sequentially
139 t1 = clock()
140 for i in range(self.nobjects):
141 self.fileh.redo()
142 if verbose:
143 print("r", end=" ")
144 if verbose:
145 print()
146 redo = clock() - t1
147
148 print("Time for Undo, Redo (set_attr):", undo, "s, ", redo, "s")
149
150 def runall(self):
151

Callers

nothing calls this directly

Calls 4

markMethod · 0.80
undoMethod · 0.80
redoMethod · 0.80
create_arrayMethod · 0.45

Tested by

no test coverage detected