)]}'
{"nova/utils.py":[{"author":{"_account_id":8119,"name":"Eric Brown","email":"eric_wade_brown@yahoo.com","username":"ericwb"},"change_message_id":"838738593dfd00226fa43e4b3302c1c865868ffe","unresolved":false,"context_lines":[{"line_number":18,"context_line":"\"\"\"Utilities and helper functions.\"\"\""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"import contextlib"},{"line_number":21,"context_line":"from Crypto import Random as cryptorandom"},{"line_number":22,"context_line":"import datetime"},{"line_number":23,"context_line":"import errno"},{"line_number":24,"context_line":"import functools"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_7cb9eceb","line":21,"updated":"2015-08-10 05:46:21.000000000","message":"Not sure about introducing new code that uses PyCrypto.  pyca/cryptography is preferred over PyCrypto nowadays although it doesn\u0027t provide secure random generators.\n\nI also don\u0027t see pycrypto in the requirements.txt, but the tests are passing, so I must be missing something.","commit_id":"d915987729197d35f6228594033971cd497ab825"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"fceea08168c853fc7198a054888542fd4c183a69","unresolved":false,"context_lines":[{"line_number":378,"context_line":"    return (begin, end)"},{"line_number":379,"context_line":""},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"def _randomIndex(len):"},{"line_number":382,"context_line":"    random_bytes \u003d cryptorandom.new().read(4)"},{"line_number":383,"context_line":"    random_int \u003d struct.unpack(\u0027\u003dI\u0027, random_bytes)[0]"},{"line_number":384,"context_line":"    return random_int % len"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_546fcdfb","line":381,"updated":"2015-08-11 16:20:02.000000000","message":"Consistency dictates: _random_index().","commit_id":"d915987729197d35f6228594033971cd497ab825"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"fceea08168c853fc7198a054888542fd4c183a69","unresolved":false,"context_lines":[{"line_number":411,"context_line":"        # NOTE(jerdfelt): Some password policies require at least one character"},{"line_number":412,"context_line":"        # from each group of symbols, so start off with one random character"},{"line_number":413,"context_line":"        # from each symbol group"},{"line_number":414,"context_line":"        if (length - i) \u003c\u003d len(not_used_symbolgroups):"},{"line_number":415,"context_line":"            symbol_group_index \u003d not_used_symbolgroups.pop(0)"},{"line_number":416,"context_line":"        else:"},{"line_number":417,"context_line":"            symbol_group_index \u003d _randomIndex(num_symbolgroups)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_88a216ad","line":414,"updated":"2015-08-11 16:20:02.000000000","message":"Why couldn\u0027t this check simply be:\nif len(not_used_symbolgroups):\n\n...the objective is to use the groups that haven\u0027t been used yet, right?  I\u0027m not seeing why we need to calculate the number of characters left to generate, which is the length - i.","commit_id":"d915987729197d35f6228594033971cd497ab825"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"fceea08168c853fc7198a054888542fd4c183a69","unresolved":false,"context_lines":[{"line_number":416,"context_line":"        else:"},{"line_number":417,"context_line":"            symbol_group_index \u003d _randomIndex(num_symbolgroups)"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":"        if (symbol_group_index in not_used_symbolgroups):"},{"line_number":420,"context_line":"            not_used_symbolgroups.remove(symbol_group_index)"},{"line_number":421,"context_line":"        symbolgroup \u003d symbolgroups[symbol_group_index]"},{"line_number":422,"context_line":"        password.append(_random_char(symbolgroup))"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_cdf6f05c","line":419,"updated":"2015-08-11 16:20:02.000000000","message":"This check is only need for the \u0027else:\u0027 leg above since it would have been pop\u0027d otherwise.\n\nAlso, there is no need for the () here.","commit_id":"d915987729197d35f6228594033971cd497ab825"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"f6356dcf319951c9da87c9adf2cc13794b1a4b65","unresolved":false,"context_lines":[{"line_number":414,"context_line":"            symbol_group_index \u003d not_used_symbolgroups.pop(0)"},{"line_number":415,"context_line":"        else:"},{"line_number":416,"context_line":"            symbol_group_index \u003d _random_index(num_symbolgroups)"},{"line_number":417,"context_line":"            if (symbol_group_index in not_used_symbolgroups):"},{"line_number":418,"context_line":"                not_used_symbolgroups.remove(symbol_group_index)"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        symbolgroup \u003d symbolgroups[symbol_group_index]"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_226a9581","line":417,"updated":"2015-08-13 13:54:26.000000000","message":"Now that I read this again, is this \u0027if\u0027 statement even needed? \n\n If there were groups that were not used, then it would hit the first part of the parent \u0027if\u0027 and the selected group would be removed by the pop.  If we hit the \u0027else\u0027 then there are no groups left unused and no need for this check.","commit_id":"1445cab16955b4f033438779b3ce72b554ce5800"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"b34d206871ecb8912a365d3d2987d9edd705b3ba","unresolved":false,"context_lines":[{"line_number":418,"context_line":"                not_used_symbolgroups.remove(symbol_group_index)"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        symbolgroup \u003d symbolgroups[symbol_group_index]"},{"line_number":421,"context_line":"        password.append(_random_char(symbolgroup))"},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    # shuffle using crypto random"},{"line_number":424,"context_line":"    for i in range(0, length):"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_f0c4660f","line":421,"updated":"2015-08-13 18:29:06.000000000","message":"Actually, could this whole algorithm be reduced to (the picking part):\n\n# Pick a group to use for each character\n\ngroups \u003d [ not_used_symbolgroups.pop(0) if not_used_symbolgroups else _random_index(num_symbolgroups) for i in range(length)] \n\npassword \u003d [_random_char(symbolgroups[i]) for i in groups]","commit_id":"1445cab16955b4f033438779b3ce72b554ce5800"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e4dec92066319e2995b2f56d5bddba86f7d27407","unresolved":false,"context_lines":[{"line_number":418,"context_line":"                not_used_symbolgroups.remove(symbol_group_index)"},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"        symbolgroup \u003d symbolgroups[symbol_group_index]"},{"line_number":421,"context_line":"        password.append(_random_char(symbolgroup))"},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    # shuffle using crypto random"},{"line_number":424,"context_line":"    for i in range(0, length):"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa1b9901_3570d271","line":421,"in_reply_to":"1a4dcd0f_f0c4660f","updated":"2015-08-26 14:55:10.000000000","message":"groups \u003d [ not_used_symbolgroups.pop(0) if not_used_symbolgroups else _random_index(num_symbolgroups) for i in range(length)]\n\n^ grosses me out.  Sure it\u0027s fun to be fancy and write a bunch of code on one line, but it\u0027s not fun to read or try to maintain.","commit_id":"1445cab16955b4f033438779b3ce72b554ce5800"},{"author":{"_account_id":8662,"name":"Kyle L. Henderson","email":"kyleh@us.ibm.com","username":"kyleh"},"change_message_id":"032ee0a613c29f11d796d54ae10db93a94cca540","unresolved":false,"context_lines":[{"line_number":552,"context_line":"    password \u003d []"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"    for i in range(length):"},{"line_number":555,"context_line":"        symbol_group_index \u003d 0"},{"line_number":556,"context_line":""},{"line_number":557,"context_line":"        # NOTE(jerdfelt): Some password policies require at least one character"},{"line_number":558,"context_line":"        # from each group of symbols, so start off with one random character"}],"source_content_type":"text/x-python","patch_set":6,"id":"da20952f_21884022","line":555,"updated":"2015-08-27 00:25:55.000000000","message":"Not needed since it\u0027s set in both legs of the \u0027if\u0027 below.","commit_id":"8cf1b591910b74764efe5b4dd1b827c53b5c7dbc"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"39df8fbe849aea8b2641e4830271a93f95be6412","unresolved":false,"context_lines":[{"line_number":544,"context_line":"    Believed to be reasonably secure (with a reasonable password length!)"},{"line_number":545,"context_line":""},{"line_number":546,"context_line":"    \"\"\""},{"line_number":547,"context_line":"    if length is None:"},{"line_number":548,"context_line":"        length \u003d CONF.password_length"},{"line_number":549,"context_line":""},{"line_number":550,"context_line":"    num_symbolgroups \u003d len(symbolgroups)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a29b11f_143314f8","line":547,"updated":"2015-10-23 13:27:36.000000000","message":"should we also check somehow that length is more than 0? new _random_index will have % 0 in this case, maybe I missed something","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"},{"author":{"_account_id":16839,"name":"Cale Rath","email":"ctrath@us.ibm.com","username":"ctrath"},"change_message_id":"f734ec02077b718b8d258cc615f743cec1d90f07","unresolved":false,"context_lines":[{"line_number":544,"context_line":"    Believed to be reasonably secure (with a reasonable password length!)"},{"line_number":545,"context_line":""},{"line_number":546,"context_line":"    \"\"\""},{"line_number":547,"context_line":"    if length is None:"},{"line_number":548,"context_line":"        length \u003d CONF.password_length"},{"line_number":549,"context_line":""},{"line_number":550,"context_line":"    num_symbolgroups \u003d len(symbolgroups)"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba0121b8_33492ad1","line":547,"in_reply_to":"3a29b11f_143314f8","updated":"2016-03-31 16:43:25.000000000","message":"This should be fine.. To make sure, I added an additional test case to cover this scenario.","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"39df8fbe849aea8b2641e4830271a93f95be6412","unresolved":false,"context_lines":[{"line_number":551,"context_line":"    not_used_symbolgroups \u003d list(range(num_symbolgroups))"},{"line_number":552,"context_line":"    password \u003d []"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"    for i in range(length):"},{"line_number":555,"context_line":"        # NOTE(jerdfelt): Some password policies require at least one character"},{"line_number":556,"context_line":"        # from each group of symbols, so start off with one random character"},{"line_number":557,"context_line":"        # from each symbol group"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a29b11f_4e0fbe36","line":554,"updated":"2015-10-23 13:27:36.000000000","message":"is it better to use six.moves range and xrange for improved compatibility?","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"},{"author":{"_account_id":16839,"name":"Cale Rath","email":"ctrath@us.ibm.com","username":"ctrath"},"change_message_id":"f734ec02077b718b8d258cc615f743cec1d90f07","unresolved":false,"context_lines":[{"line_number":551,"context_line":"    not_used_symbolgroups \u003d list(range(num_symbolgroups))"},{"line_number":552,"context_line":"    password \u003d []"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"    for i in range(length):"},{"line_number":555,"context_line":"        # NOTE(jerdfelt): Some password policies require at least one character"},{"line_number":556,"context_line":"        # from each group of symbols, so start off with one random character"},{"line_number":557,"context_line":"        # from each symbol group"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba0121b8_930e368a","line":554,"in_reply_to":"3a29b11f_4e0fbe36","updated":"2016-03-31 16:43:25.000000000","message":"Done","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"39df8fbe849aea8b2641e4830271a93f95be6412","unresolved":false,"context_lines":[{"line_number":564,"context_line":"        password.append(_random_char(symbolgroup))"},{"line_number":565,"context_line":""},{"line_number":566,"context_line":"    # shuffle using crypto random"},{"line_number":567,"context_line":"    for i in range(0, length):"},{"line_number":568,"context_line":"        j \u003d _random_index(length)"},{"line_number":569,"context_line":"        password[i], password[j] \u003d password[j], password[i]"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a29b11f_b40ca03c","line":567,"updated":"2015-10-23 13:27:36.000000000","message":"why not range(length)?","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"},{"author":{"_account_id":16839,"name":"Cale Rath","email":"ctrath@us.ibm.com","username":"ctrath"},"change_message_id":"f734ec02077b718b8d258cc615f743cec1d90f07","unresolved":false,"context_lines":[{"line_number":564,"context_line":"        password.append(_random_char(symbolgroup))"},{"line_number":565,"context_line":""},{"line_number":566,"context_line":"    # shuffle using crypto random"},{"line_number":567,"context_line":"    for i in range(0, length):"},{"line_number":568,"context_line":"        j \u003d _random_index(length)"},{"line_number":569,"context_line":"        password[i], password[j] \u003d password[j], password[i]"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"ba0121b8_f32972e7","line":567,"in_reply_to":"3a29b11f_b40ca03c","updated":"2016-03-31 16:43:25.000000000","message":"Done","commit_id":"ada09695be9620bf600dbceb993df72c61c41c1b"}]}
