From cb401867ef2fa8179b8144c4702dda1bfe4d8e67 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Sat, 26 Jun 2021 12:08:23 +0100 Subject: [PATCH] Updated docstrings --- badges/docstring_coverage.svg | 6 +++--- binarycpython/utils/functions.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/badges/docstring_coverage.svg b/badges/docstring_coverage.svg index 3bbc9abdf..bb8342261 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 30ae38001..f32fc5151 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 -- GitLab