)]}'
{"novaclient/v2/security_group_rules.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"5acb5cb0625039bb683e555d2f7b68e7b29362c5","unresolved":false,"context_lines":[{"line_number":56,"context_line":"            raise exceptions.CommandError(_(\"To port must be an integer.\"))"},{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"            if int(ip_protocol) not in range(0, 256):"},{"line_number":60,"context_line":"                raise exceptions.CommandError(_(\"IP protocol must be\""},{"line_number":61,"context_line":"                     \" \u0027tcp\u0027, \u0027udp\u0027,\u0027icmp\u0027,and integer representations\""},{"line_number":62,"context_line":"                     \" [0 to 255] are supported.\"))"}],"source_content_type":"text/x-python","patch_set":4,"id":"da6ed579_a4f2b26d","line":59,"updated":"2016-01-13 17:13:16.000000000","message":"This isn\u0027t the most efficient way of accomplishing this.  The range() operation generates a list (in Python 2.7) or an iterable (in Python 3), which then has to be traversed to see if int(ip_protocol) is present.  I\u0027d suggest rewriting this logic as:\n\n    ip_protocol \u003d int(ip_protocol)\n    if ip_protocol \u003c 0 or ip_protocol \u003e 255:\n        …\n\nThis assumes that line 76 can tolerate ip_protocol being specified as an integer type; if it needs to be a string, then I\u0027d suggest using a temporary variable.","commit_id":"d5cf50b22ee2f281e4c809cb2ce83c6851d3fe3f"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"5acb5cb0625039bb683e555d2f7b68e7b29362c5","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"            if int(ip_protocol) not in range(0, 256):"},{"line_number":60,"context_line":"                raise exceptions.CommandError(_(\"IP protocol must be\""},{"line_number":61,"context_line":"                     \" \u0027tcp\u0027, \u0027udp\u0027,\u0027icmp\u0027,and integer representations\""},{"line_number":62,"context_line":"                     \" [0 to 255] are supported.\"))"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        except (ValueError, TypeError):"},{"line_number":65,"context_line":"            if ip_protocol.upper() not in [\u0027TCP\u0027, \u0027UDP\u0027, \u0027ICMP\u0027]:"}],"source_content_type":"text/x-python","patch_set":4,"id":"da6ed579_449ad664","line":62,"range":{"start_line":60,"start_character":48,"end_line":62,"end_character":49},"updated":"2016-01-13 17:13:16.000000000","message":"1. I have a slight preference for having continuation spaces at the ends of lines, i.e.:\n\n    raise exceptions.CommandError(_(\"IP protocol must be \"\n                                    \"\u0027tcp\u0027, \u0027udp\u0027, […]\"))\n\n2. Your pep8 error comes from incorrect indentation on the string continuation.  If you don\u0027t want to use the indentation I illustrate above (and I wouldn\u0027t blame you :), the following would be acceptable to pep8:\n\n    raise exceptions.CommandError(_(\n        \"IP protocol must be \u0027tcp\u0027, \u0027udp\u0027, […]\"))\n\n3. You\u0027re dropping some needed spaces and replacing the conjunction \"or\" with \"and\", which makes the text not quite track.  Let me suggest the following wording:\n\n    IP protocol must be \u0027tcp\u0027, \u0027udp\u0027, \u0027icmp\u0027, or an integer\n    between 0 and 255.","commit_id":"d5cf50b22ee2f281e4c809cb2ce83c6851d3fe3f"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"5acb5cb0625039bb683e555d2f7b68e7b29362c5","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                     \" [0 to 255] are supported.\"))"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        except AttributeError:"},{"line_number":71,"context_line":"            raise exceptions.CommandError(_(\"IP protocol must be\""},{"line_number":72,"context_line":"                 \" \u0027tcp\u0027, \u0027udp\u0027,\u0027icmp\u0027,and integer representations\""},{"line_number":73,"context_line":"                 \" [0 to 255] are supported.\"))"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da6ed579_84968eee","line":71,"updated":"2016-01-13 17:13:16.000000000","message":"I wish there was a way to keep from having to specify the same exception multiple times in this code.","commit_id":"d5cf50b22ee2f281e4c809cb2ce83c6851d3fe3f"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"994b261b86ef374aa9ffd7e8b6079a9db986b70e","unresolved":false,"context_lines":[{"line_number":57,"context_line":"            raise exceptions.CommandError(_(\"To port must be an integer.\"))"},{"line_number":58,"context_line":"        try:"},{"line_number":59,"context_line":"            customer \u003d int(ip_protocol)"},{"line_number":60,"context_line":"            if customer and(customer \u003c 0 or customer \u003e 255):"},{"line_number":61,"context_line":"                raise exceptions.CommandError(_("},{"line_number":62,"context_line":"                    \"IP protocol must be \u0027tcp\u0027,\u0027udp\u0027,\u0027icmp\u0027,\""},{"line_number":63,"context_line":"                    \"or an integer between 0 and 255.\"))"}],"source_content_type":"text/x-python","patch_set":6,"id":"da6ed579_d8f8a7c5","line":60,"range":{"start_line":60,"start_character":24,"end_line":60,"end_character":28},"updated":"2016-01-14 16:48:03.000000000","message":"1. This is styled incorrectly; there should be a space before the open parenthesis.\n\n2. There\u0027s no need for the parenthesized clause here at all; the \"customer and\" portion is redundant.  After line 59, customer can only be an int (if it wasn\u0027t, you\u0027d go to the except clause at line 65), so the only way that \"customer\" can be equivalent to boolean False is when it is 0, which is already outside the range we\u0027re requiring.","commit_id":"61aef785137592dc0a2e40ce94a9f2bf18af1740"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"994b261b86ef374aa9ffd7e8b6079a9db986b70e","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            customer \u003d int(ip_protocol)"},{"line_number":60,"context_line":"            if customer and(customer \u003c 0 or customer \u003e 255):"},{"line_number":61,"context_line":"                raise exceptions.CommandError(_("},{"line_number":62,"context_line":"                    \"IP protocol must be \u0027tcp\u0027,\u0027udp\u0027,\u0027icmp\u0027,\""},{"line_number":63,"context_line":"                    \"or an integer between 0 and 255.\"))"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        except (ValueError, TypeError):"}],"source_content_type":"text/x-python","patch_set":6,"id":"da6ed579_78ef3be9","line":62,"updated":"2016-01-14 16:48:03.000000000","message":"There should be a space after every comma here, including the one at the end of the line:\n\n    \"IP protocol must be \u0027tcp\u0027, \u0027udp\u0027, \u0027icmp\u0027, \"\n    \"or an integer between 0 and 255.\"","commit_id":"61aef785137592dc0a2e40ce94a9f2bf18af1740"}]}
