Skip to content
Snippets Groups Projects
Commit ed070c0e authored by David Hendriks's avatar David Hendriks
Browse files

Working on adding these functions to the grid

parent 991ea310
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -25,11 +25,25 @@ from collections import defaultdict ...@@ -25,11 +25,25 @@ from collections import defaultdict
from binarycpython import _binary_c_bindings from binarycpython import _binary_c_bindings
########################################################
# Unsorted
########################################################
class catchtime(object):
def __enter__(self):
self.t = time.clock()
return self
def __exit__(self, type, value, traceback):
self.t = time.clock() - self.t
print("Took {}s".format(self.t))
def is_capsule(o): def is_capsule(o):
t = type(o) t = type(o)
return t.__module__ == 'builtins' and t.__name__ == 'PyCapsule' return t.__module__ == 'builtins' and t.__name__ == 'PyCapsule'
class Capturing(list): class Capturing(list):
def __enter__(self): def __enter__(self):
self._stdout = sys.stdout self._stdout = sys.stdout
...@@ -40,8 +54,6 @@ class Capturing(list): ...@@ -40,8 +54,6 @@ class Capturing(list):
del self._stringio # free up some memory del self._stringio # free up some memory
sys.stdout = self._stdout sys.stdout = self._stdout
######################################################## ########################################################
# utility functions # utility functions
######################################################## ########################################################
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment