)]}'
{"oslo_utils/timeutils.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"ac099554e09a250724a1e23d3972e08257eb5e87","unresolved":false,"context_lines":[{"line_number":255,"context_line":"    return normalize_time(dt) \u003c\u003d soon"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"class Split(object):"},{"line_number":259,"context_line":"    \"\"\"A *immutable* stopwatch split."},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"    See: http://en.wikipedia.org/wiki/Stopwatch for what this is/represents."}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_5ce11dfd","line":258,"updated":"2015-02-10 10:06:21.000000000","message":"What about using a namedtuple?","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"4252c8acc84d7cb551ba8ea675ff19ad2cd60fe2","unresolved":false,"context_lines":[{"line_number":255,"context_line":"    return normalize_time(dt) \u003c\u003d soon"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"class Split(object):"},{"line_number":259,"context_line":"    \"\"\"A *immutable* stopwatch split."},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"    See: http://en.wikipedia.org/wiki/Stopwatch for what this is/represents."}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_c49b66c7","line":258,"in_reply_to":"da86d52c_5ce11dfd","updated":"2015-02-10 15:38:31.000000000","message":"Ya, trying to remember why I didn\u0027t do that; think the reason was because I can\u0027t really add docstrings to that (it generates some of its own that are crap) and the docstrings are somewhat useful here.","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"4ee5dbd52dc40b8c5c1d8e29d8449d186e016fe0","unresolved":false,"context_lines":[{"line_number":255,"context_line":"    return normalize_time(dt) \u003c\u003d soon"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"class Split(object):"},{"line_number":259,"context_line":"    \"\"\"A *immutable* stopwatch split."},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"    See: http://en.wikipedia.org/wiki/Stopwatch for what this is/represents."}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_cf61bfa9","line":258,"in_reply_to":"da86d52c_c49b66c7","updated":"2015-02-10 15:54:18.000000000","message":"Good reason.","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"ac099554e09a250724a1e23d3972e08257eb5e87","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        until the override(s) are cleared via the :meth:`.clear_overrides`"},{"line_number":399,"context_line":"        method)."},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"        **Only to be used for testing (affects all watch instances).**"},{"line_number":402,"context_line":"        \"\"\""},{"line_number":403,"context_line":"        if isinstance(now, (list, tuple)):"},{"line_number":404,"context_line":"            cls._now_override \u003d list(now)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_bcc4d940","line":401,"updated":"2015-02-10 10:06:21.000000000","message":"I\u0027m not sure all that override mechanism is worth it. Just using mock would be enough, no?","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"4ee5dbd52dc40b8c5c1d8e29d8449d186e016fe0","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        until the override(s) are cleared via the :meth:`.clear_overrides`"},{"line_number":399,"context_line":"        method)."},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"        **Only to be used for testing (affects all watch instances).**"},{"line_number":402,"context_line":"        \"\"\""},{"line_number":403,"context_line":"        if isinstance(now, (list, tuple)):"},{"line_number":404,"context_line":"            cls._now_override \u003d list(now)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_4ff4efce","line":401,"in_reply_to":"da86d52c_44c4d691","updated":"2015-02-10 15:54:18.000000000","message":"If you mock the _now() function that should do what ever you want, no?","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"e183ad20e05105df65104cc651c996cda52b742f","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        until the override(s) are cleared via the :meth:`.clear_overrides`"},{"line_number":399,"context_line":"        method)."},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"        **Only to be used for testing (affects all watch instances).**"},{"line_number":402,"context_line":"        \"\"\""},{"line_number":403,"context_line":"        if isinstance(now, (list, tuple)):"},{"line_number":404,"context_line":"            cls._now_override \u003d list(now)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_aa8f1922","line":401,"in_reply_to":"da86d52c_4ff4efce","updated":"2015-02-10 16:23:02.000000000","message":"Ah, good idear; probably would work fine. Lets do that.","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"4252c8acc84d7cb551ba8ea675ff19ad2cd60fe2","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        until the override(s) are cleared via the :meth:`.clear_overrides`"},{"line_number":399,"context_line":"        method)."},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"        **Only to be used for testing (affects all watch instances).**"},{"line_number":402,"context_line":"        \"\"\""},{"line_number":403,"context_line":"        if isinstance(now, (list, tuple)):"},{"line_number":404,"context_line":"            cls._now_override \u003d list(now)"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_44c4d691","line":401,"in_reply_to":"da86d52c_bcc4d940","updated":"2015-02-10 15:38:31.000000000","message":"Depends on what u are trying to test. If u want the code using a stop watch to appear like its having time shifts then I don\u0027t think mocks are going to work for that (especially if the stop watch usage is hidden say inside a object u are testings functions). What do u think? Maybe still not worth it (fine with me, less code, ha).","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"ac099554e09a250724a1e23d3972e08257eb5e87","unresolved":false,"context_lines":[{"line_number":466,"context_line":"        if self._duration is None:"},{"line_number":467,"context_line":"            if not return_none:"},{"line_number":468,"context_line":"                raise RuntimeError(\"Can not get the leftover time of a watch\""},{"line_number":469,"context_line":"                                   \" that has no duration\")"},{"line_number":470,"context_line":"            else:"},{"line_number":471,"context_line":"                return None"},{"line_number":472,"context_line":"        return max(0.0, self._duration - self.elapsed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_bc76993c","line":469,"updated":"2015-02-10 10:06:21.000000000","message":"I find this kind of return_none hackish… just raise a custom exception that can be caught?","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"4ee5dbd52dc40b8c5c1d8e29d8449d186e016fe0","unresolved":false,"context_lines":[{"line_number":466,"context_line":"        if self._duration is None:"},{"line_number":467,"context_line":"            if not return_none:"},{"line_number":468,"context_line":"                raise RuntimeError(\"Can not get the leftover time of a watch\""},{"line_number":469,"context_line":"                                   \" that has no duration\")"},{"line_number":470,"context_line":"            else:"},{"line_number":471,"context_line":"                return None"},{"line_number":472,"context_line":"        return max(0.0, self._duration - self.elapsed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_4fe22f02","line":469,"in_reply_to":"da86d52c_04e81eb3","updated":"2015-02-10 15:54:18.000000000","message":"I think you made a good point with that common pattern usage. :)","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"4252c8acc84d7cb551ba8ea675ff19ad2cd60fe2","unresolved":false,"context_lines":[{"line_number":466,"context_line":"        if self._duration is None:"},{"line_number":467,"context_line":"            if not return_none:"},{"line_number":468,"context_line":"                raise RuntimeError(\"Can not get the leftover time of a watch\""},{"line_number":469,"context_line":"                                   \" that has no duration\")"},{"line_number":470,"context_line":"            else:"},{"line_number":471,"context_line":"                return None"},{"line_number":472,"context_line":"        return max(0.0, self._duration - self.elapsed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"da86d52c_04e81eb3","line":469,"in_reply_to":"da86d52c_bc76993c","updated":"2015-02-10 15:38:31.000000000","message":"Depends; the common usage of this is something like:\n\n  def wait(timeout\u003dNone):\n     watch \u003d StopWatch(duration\u003dtimeout)\n     watch.start()\n     while (waiting on something...):\n          event.wait(timeout\u003dwatch.leftover(return_none\u003dTrue))\n\nThe above is how I have commonly used it; a custom exception would make that code more verbose for not much value (imho). It would then have to be.\n\n  def wait(timeout\u003dNone):\n     watch \u003d StopWatch(duration\u003dtimeout)\n     watch.start()\n     while (waiting on something...):\n          try:\n              event.wait(timeout\u003dwatch.leftover())\n          except ThingException:\n              event.wait()\n\nFor the common case where this is used for events (or other waiting on things that accept none the exception catching and switching would seem duplicated when those wait functions take \u0027none\u0027 as a valid value\u0027 aka to wait forever).\n\nIf though an exception is better (which I can understand that its less \u0027hacky\u0027); then sure, lets do it (as long as we accept the common usage of something like the above wait() function will be made more verbose due to it...","commit_id":"cb33d16eeedb4aa0f3d2b10033f2945bd17f26b1"},{"author":{"_account_id":6601,"name":"James Carey","email":"jecarey@yerac.com","username":"jecarey"},"change_message_id":"5447800efa76ee7e93bf1aee1319ee891e982238","unresolved":false,"context_lines":[{"line_number":297,"context_line":"    _STOPPED \u003d \u0027STOPPED\u0027"},{"line_number":298,"context_line":""},{"line_number":299,"context_line":"    def __init__(self, duration\u003dNone):"},{"line_number":300,"context_line":"        if duration is not None:"},{"line_number":301,"context_line":"            if duration \u003c 0:"},{"line_number":302,"context_line":"                raise ValueError(\"Duration must be greater or equal to\""},{"line_number":303,"context_line":"                                 \" zero and not %s\" % duration)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_0fae322e","line":300,"updated":"2015-02-16 23:58:55.000000000","message":"why not combine ifs and just set self._duration to duration if don\u0027t raise?","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"8b5c77c3f2bb80790e631bac3920474b72a955a5","unresolved":false,"context_lines":[{"line_number":297,"context_line":"    _STOPPED \u003d \u0027STOPPED\u0027"},{"line_number":298,"context_line":""},{"line_number":299,"context_line":"    def __init__(self, duration\u003dNone):"},{"line_number":300,"context_line":"        if duration is not None:"},{"line_number":301,"context_line":"            if duration \u003c 0:"},{"line_number":302,"context_line":"                raise ValueError(\"Duration must be greater or equal to\""},{"line_number":303,"context_line":"                                 \" zero and not %s\" % duration)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_d86894f7","line":300,"in_reply_to":"da86d52c_0fae322e","updated":"2015-02-17 23:04:44.000000000","message":"Sureee.","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":6601,"name":"James Carey","email":"jecarey@yerac.com","username":"jecarey"},"change_message_id":"5447800efa76ee7e93bf1aee1319ee891e982238","unresolved":false,"context_lines":[{"line_number":338,"context_line":"            self._splits.append(Split(elapsed, length))"},{"line_number":339,"context_line":"            return self._splits[-1]"},{"line_number":340,"context_line":"        else:"},{"line_number":341,"context_line":"            raise RuntimeError(\"Can not create a split time of a stopwatch\""},{"line_number":342,"context_line":"                               \" if it has not been started\")"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def restart(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_22006daa","line":341,"updated":"2015-02-16 23:58:55.000000000","message":"This is also reached if it is stopped.   Shouldn\u0027t message say \u0027... not been started or is stopped\u0027?","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"8b5c77c3f2bb80790e631bac3920474b72a955a5","unresolved":false,"context_lines":[{"line_number":338,"context_line":"            self._splits.append(Split(elapsed, length))"},{"line_number":339,"context_line":"            return self._splits[-1]"},{"line_number":340,"context_line":"        else:"},{"line_number":341,"context_line":"            raise RuntimeError(\"Can not create a split time of a stopwatch\""},{"line_number":342,"context_line":"                               \" if it has not been started\")"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def restart(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_787de8b1","line":341,"in_reply_to":"da86d52c_22006daa","updated":"2015-02-17 23:04:44.000000000","message":"Sureee.","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":6601,"name":"James Carey","email":"jecarey@yerac.com","username":"jecarey"},"change_message_id":"5447800efa76ee7e93bf1aee1319ee891e982238","unresolved":false,"context_lines":[{"line_number":354,"context_line":"        return max(0.0, later - earlier)"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def elapsed(self, maximum\u003dNone):"},{"line_number":357,"context_line":"        \"\"\"Returns how many seconds have elapsed.\"\"\""},{"line_number":358,"context_line":"        if self._state not in (self._STOPPED, self._STARTED):"},{"line_number":359,"context_line":"            raise RuntimeError(\"Can not get the elapsed time of a stopwatch\""},{"line_number":360,"context_line":"                               \" if it has not been started/stopped\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_42a4814a","line":357,"updated":"2015-02-16 23:58:55.000000000","message":"Probably should document the parameter and fact that if \u003c0 defaults to 0","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"8b5c77c3f2bb80790e631bac3920474b72a955a5","unresolved":false,"context_lines":[{"line_number":354,"context_line":"        return max(0.0, later - earlier)"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def elapsed(self, maximum\u003dNone):"},{"line_number":357,"context_line":"        \"\"\"Returns how many seconds have elapsed.\"\"\""},{"line_number":358,"context_line":"        if self._state not in (self._STOPPED, self._STARTED):"},{"line_number":359,"context_line":"            raise RuntimeError(\"Can not get the elapsed time of a stopwatch\""},{"line_number":360,"context_line":"                               \" if it has not been started/stopped\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_d836d402","line":357,"in_reply_to":"da86d52c_42a4814a","updated":"2015-02-17 23:04:44.000000000","message":"Well time durations don\u0027t really have negative concepts (u have elapsed -1 seconds? huh?) so not sure that saying that adds much value.","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":6601,"name":"James Carey","email":"jecarey@yerac.com","username":"jecarey"},"change_message_id":"5447800efa76ee7e93bf1aee1319ee891e982238","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            if not return_none:"},{"line_number":394,"context_line":"                raise RuntimeError(\"Can not get the leftover time of a watch\""},{"line_number":395,"context_line":"                                   \" that has no duration\")"},{"line_number":396,"context_line":"            else:"},{"line_number":397,"context_line":"                return None"},{"line_number":398,"context_line":"        return max(0.0, self._duration - self.elapsed())"},{"line_number":399,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_4271e10a","line":396,"updated":"2015-02-16 23:58:55.000000000","message":"Could you remove else and outdent the return None?","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"8b5c77c3f2bb80790e631bac3920474b72a955a5","unresolved":false,"context_lines":[{"line_number":393,"context_line":"            if not return_none:"},{"line_number":394,"context_line":"                raise RuntimeError(\"Can not get the leftover time of a watch\""},{"line_number":395,"context_line":"                                   \" that has no duration\")"},{"line_number":396,"context_line":"            else:"},{"line_number":397,"context_line":"                return None"},{"line_number":398,"context_line":"        return max(0.0, self._duration - self.elapsed())"},{"line_number":399,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_5822e4b9","line":396,"in_reply_to":"da86d52c_4271e10a","updated":"2015-02-17 23:04:44.000000000","message":"Likely could.","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":6601,"name":"James Carey","email":"jecarey@yerac.com","username":"jecarey"},"change_message_id":"5447800efa76ee7e93bf1aee1319ee891e982238","unresolved":false,"context_lines":[{"line_number":404,"context_line":"                               \" if it has not been started/stopped\")"},{"line_number":405,"context_line":"        if self._duration is None:"},{"line_number":406,"context_line":"            return False"},{"line_number":407,"context_line":"        if self.elapsed() \u003e self._duration:"},{"line_number":408,"context_line":"            return True"},{"line_number":409,"context_line":"        return False"},{"line_number":410,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_62050579","line":407,"updated":"2015-02-16 23:58:55.000000000","message":"replace with: return self.elapsed() \u003e self._duration","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"8b5c77c3f2bb80790e631bac3920474b72a955a5","unresolved":false,"context_lines":[{"line_number":404,"context_line":"                               \" if it has not been started/stopped\")"},{"line_number":405,"context_line":"        if self._duration is None:"},{"line_number":406,"context_line":"            return False"},{"line_number":407,"context_line":"        if self.elapsed() \u003e self._duration:"},{"line_number":408,"context_line":"            return True"},{"line_number":409,"context_line":"        return False"},{"line_number":410,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_b8184085","line":407,"in_reply_to":"da86d52c_62050579","updated":"2015-02-17 23:04:44.000000000","message":"Sureee.","commit_id":"1a3360f6580f4c1ec0ba1aab409491ba82f8c825"}]}
