diff --git a/badges/docstring_coverage.svg b/badges/docstring_coverage.svg index 3bbc9abdff8b8656da7208d061e7a9227206711f..bb83422617c573dda55319b7fadb4a026c5677b7 100644 --- a/badges/docstring_coverage.svg +++ b/badges/docstring_coverage.svg @@ -8,13 +8,13 @@ </clipPath> <g clip-path="url(#r)"> <rect width="99" height="20" fill="#555"/> - <rect x="99" width="43" height="20" fill="#dfb317"/> + <rect x="99" width="43" height="20" fill="#4c1"/> <rect width="142" height="20" fill="url(#s)"/> </g> <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="110"> <text x="505" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="890">docstr-coverage</text> <text x="505" y="140" transform="scale(.1)" textLength="890">docstr-coverage</text> - <text x="1195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)">74%</text> - <text x="1195" y="140" transform="scale(.1)">74%</text> + <text x="1195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)">98%</text> + <text x="1195" y="140" transform="scale(.1)">98%</text> </g> </svg> \ No newline at end of file diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 30ae3800186b6fb024a0360e172b6780a70d51c4..f32fc5151e63cca44b9ba3078e6abfcb8cf4e617 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -253,10 +253,12 @@ class catchtime(object): """ def __enter__(self): + """On entry we start the clock""" self.t = time.clock() return self def __exit__(self, type, value, traceback): + """On exit we stop the clock and measure the time spent""" self.t = time.clock() - self.t print("Took {}s".format(self.t)) @@ -276,11 +278,15 @@ class Capturing(list): """ def __enter__(self): + """On entry we capture the stdout output""" + self._stdout = sys.stdout sys.stdout = self._stringio = StringIO() return self def __exit__(self, *args): + """On exit we release the capture again""" + self.extend(self._stringio.getvalue().splitlines()) del self._stringio # free up some memory sys.stdout = self._stdout