)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"9b579d5280cdf658ad8f38578cbd08cc90d05cbd","unresolved":false,"context_lines":[{"line_number":3,"context_line":"AuthorDate: 2019-07-03 17:32:59 -0400"},{"line_number":4,"context_line":"Commit:     Colbert Philippe (cp0396) \u003ccp0396@att.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-07-09 23:57:33 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Made fixes for third review!"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Make python script parameter even more generic"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"7faddb67_552c5a98","line":7,"range":{"start_line":6,"start_character":0,"end_line":7,"end_character":28},"updated":"2019-07-10 13:20:31.000000000","message":"? The commitmsg shouldn\u0027t update per review. This should just be \"Make python script parameter even more generic\"","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":17068,"name":"Jean-Philippe Evrard","email":"openstack@a.spamming.party","username":"evrardjp"},"change_message_id":"5024c5ad95240d8911b2b75684568a49341e4fcb","unresolved":false,"context_lines":[{"line_number":5,"context_line":"CommitDate: 2019-07-15 08:20:53 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Make python script parameter even more generic"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Made fixes for third review!"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Make python script parameter even more generic"},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"7faddb67_1b58aff8","line":9,"range":{"start_line":8,"start_character":0,"end_line":9,"end_character":28},"updated":"2019-07-22 10:09:41.000000000","message":"Please explain WHY you are doing this.","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"6421c62ad4713b64056a84f8f8b02b26371cecd9","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Make python script parameter even more generic"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Made fixes for third review!"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Make python script parameter even more generic"},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"7faddb67_cfda5578","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":28},"updated":"2019-07-22 02:38:02.000000000","message":"not needed","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"6421c62ad4713b64056a84f8f8b02b26371cecd9","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Made fixes for third review!"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Make python script parameter even more generic"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Change-Id: Ie7d86859e04fa884ed564889cb40b7bade72fae0"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"7faddb67_2ff689fb","line":11,"range":{"start_line":11,"start_character":0,"end_line":11,"end_character":46},"updated":"2019-07-22 02:38:02.000000000","message":"duplicate","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"}],"nagios/plugins/query_es_failedlogins.py":[{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"07f9ffabc43efab628b40c9edebc5f622176aa9c","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#!/usr/bin/env python"},{"line_number":2,"context_line":"# -*- coding: utf-8 -*-"},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"# Copyright 2017 The Openstack-Helm Authors."},{"line_number":5,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_e2e93180","line":2,"range":{"start_line":2,"start_character":0,"end_line":2,"end_character":23},"updated":"2019-07-08 15:04:49.000000000","message":"probably unneeded","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8c9fe5dac4a047307902e0e5ff34cd34f1ff0733","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#!/usr/bin/env python"},{"line_number":2,"context_line":"# -*- coding: utf-8 -*-"},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"# Copyright 2017 The Openstack-Helm Authors."},{"line_number":5,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_95cf597e","line":2,"range":{"start_line":2,"start_character":0,"end_line":2,"end_character":23},"in_reply_to":"7faddb67_e2e93180","updated":"2019-07-08 15:43:54.000000000","message":"Unneeded","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"07f9ffabc43efab628b40c9edebc5f622176aa9c","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#!/usr/bin/env python"},{"line_number":2,"context_line":"# -*- coding: utf-8 -*-"},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"# Copyright 2017 The Openstack-Helm Authors."},{"line_number":5,"context_line":"#"},{"line_number":6,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");"},{"line_number":7,"context_line":"# you may not use this file except in compliance with the License."}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_82e15d9d","line":4,"range":{"start_line":4,"start_character":15,"end_line":4,"end_character":16},"updated":"2019-07-08 15:04:49.000000000","message":"9","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":17068,"name":"Jean-Philippe Evrard","email":"openstack@a.spamming.party","username":"evrardjp"},"change_message_id":"6f5853c22346abbee477257ecfb86a3a6526a72a","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#!/usr/bin/env python"},{"line_number":2,"context_line":"# -*- coding: utf-8 -*-"},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"# Copyright 2017 The Openstack-Helm Authors."},{"line_number":5,"context_line":"#"},{"line_number":6,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");"},{"line_number":7,"context_line":"# you may not use this file except in compliance with the License."}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_ae2b14e9","line":4,"range":{"start_line":4,"start_character":17,"end_line":4,"end_character":44},"updated":"2019-07-09 12:55:25.000000000","message":"Incorrect license owner, either do not put a line, or put a line with the correct owner.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":31,"context_line":"import requests"},{"line_number":32,"context_line":"from nagiosutil import NagiosUtil"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"def check_bool(value):"},{"line_number":35,"context_line":"    \"\"\"validate range\"\"\""},{"line_number":36,"context_line":"    return value.lower() in [ \u0027true\u0027, \u0027yes\u0027, \u0027on\u0027, \u0027t\u0027, \u0027y\u0027,  \u00271\u0027]"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_420a85d2","line":34,"range":{"start_line":34,"start_character":4,"end_line":34,"end_character":14},"updated":"2019-07-08 14:57:17.000000000","message":"I am not sure if this function does what it is called, it is returning if value is true.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":17068,"name":"Jean-Philippe Evrard","email":"openstack@a.spamming.party","username":"evrardjp"},"change_message_id":"6f5853c22346abbee477257ecfb86a3a6526a72a","unresolved":false,"context_lines":[{"line_number":31,"context_line":"import requests"},{"line_number":32,"context_line":"from nagiosutil import NagiosUtil"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"def check_bool(value):"},{"line_number":35,"context_line":"    \"\"\"validate range\"\"\""},{"line_number":36,"context_line":"    return value.lower() in [ \u0027true\u0027, \u0027yes\u0027, \u0027on\u0027, \u0027t\u0027, \u0027y\u0027,  \u00271\u0027]"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_8e38983d","line":34,"range":{"start_line":34,"start_character":4,"end_line":34,"end_character":14},"in_reply_to":"7faddb67_420a85d2","updated":"2019-07-09 12:55:25.000000000","message":"agreed, very confusing.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"def check_range(value):"},{"line_number":39,"context_line":"    \"\"\"validate range\"\"\""},{"line_number":40,"context_line":"    minutes \u003d int(value)"},{"line_number":41,"context_line":"    if minutes \u003c 1 or minutes \u003e 1440:"},{"line_number":42,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid search time range.\u0027"},{"line_number":43,"context_line":"                                         \u0027 Valid values are between 1 and 1440\u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_2260a9a5","line":40,"range":{"start_line":40,"start_character":3,"end_line":40,"end_character":24},"updated":"2019-07-08 14:57:17.000000000","message":"what if a non-integer get pass in, wouldn\u0027t this bomb out with ValueError exception?","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8c9fe5dac4a047307902e0e5ff34cd34f1ff0733","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"def check_range(value):"},{"line_number":39,"context_line":"    \"\"\"validate range\"\"\""},{"line_number":40,"context_line":"    minutes \u003d int(value)"},{"line_number":41,"context_line":"    if minutes \u003c 1 or minutes \u003e 1440:"},{"line_number":42,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid search time range.\u0027"},{"line_number":43,"context_line":"                                         \u0027 Valid values are between 1 and 1440\u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_35a6a5c3","line":40,"range":{"start_line":40,"start_character":3,"end_line":40,"end_character":24},"in_reply_to":"7faddb67_2260a9a5","updated":"2019-07-08 15:43:54.000000000","message":"Yes","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":17068,"name":"Jean-Philippe Evrard","email":"openstack@a.spamming.party","username":"evrardjp"},"change_message_id":"6f5853c22346abbee477257ecfb86a3a6526a72a","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"def check_range(value):"},{"line_number":39,"context_line":"    \"\"\"validate range\"\"\""},{"line_number":40,"context_line":"    minutes \u003d int(value)"},{"line_number":41,"context_line":"    if minutes \u003c 1 or minutes \u003e 1440:"},{"line_number":42,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid search time range.\u0027"},{"line_number":43,"context_line":"                                         \u0027 Valid values are between 1 and 1440\u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_2e3f2426","line":40,"range":{"start_line":40,"start_character":3,"end_line":40,"end_character":24},"in_reply_to":"7faddb67_2260a9a5","updated":"2019-07-09 12:55:25.000000000","message":"yassss.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":47,"context_line":""},{"line_number":48,"context_line":"def check_threshold(value):"},{"line_number":49,"context_line":"    \"\"\"validate threshold\"\"\""},{"line_number":50,"context_line":"    threshold \u003d int(value)"},{"line_number":51,"context_line":"    if threshold \u003c 1:"},{"line_number":52,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid threshold\u0027"},{"line_number":53,"context_line":"                                         \u0027 Valid threshold is \u003e 0\u0027 % value)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_c2919554","line":50,"range":{"start_line":50,"start_character":0,"end_line":50,"end_character":26},"updated":"2019-07-08 14:57:17.000000000","message":"ditto","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"def check_match(value):"},{"line_number":58,"context_line":"    \"\"\"validate match clauses\"\"\""},{"line_number":59,"context_line":"    if not value:  # tolerate empty match clause"},{"line_number":60,"context_line":"        return"},{"line_number":61,"context_line":"    try:"},{"line_number":62,"context_line":"        match_fields \u003d dict(item.split(\u0027:\u0027) for item in value.split(\u0027,\u0027))"},{"line_number":63,"context_line":"        return match_fields"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_829b9d70","line":60,"range":{"start_line":59,"start_character":0,"end_line":60,"end_character":14},"updated":"2019-07-08 14:57:17.000000000","message":"should this null check be on the other function?","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":79,"context_line":"def check_date(value):"},{"line_number":80,"context_line":"    \"\"\"validate date (only, no time) in standard format \"\"\""},{"line_number":81,"context_line":"    the_date \u003d None"},{"line_number":82,"context_line":"    if not re.match(r\u0027\\d{4}\\-\\d{2}\\-\\d{2}\u0027, value.strip()):"},{"line_number":83,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid date format, expect YYYY-mm-dd\u0027 % value)"},{"line_number":84,"context_line":"    else:"},{"line_number":85,"context_line":"        the_date \u003d datetime.strptime(value, \u0027%Y-%m-%d\u0027)"},{"line_number":86,"context_line":"    return the_date"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"def check_timezone(value):"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_e2837103","line":85,"range":{"start_line":82,"start_character":0,"end_line":85,"end_character":55},"updated":"2019-07-08 14:57:17.000000000","message":"this can bomb out with a string that match the regex but still not a date: e.g. \"2099-40-50\"","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    \"\"\"validate timezone specification +/-hh:mm \"\"\""},{"line_number":90,"context_line":"    text \u003d value.strip()"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    if not re.match(r\u0027(\\+|\\-){1}\\d{2}\\:\\d{2}\u0027, text):"},{"line_number":93,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid timezone format, expect +/-hh:mm\u0027 % text)"},{"line_number":94,"context_line":"    return text"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_4294c537","line":92,"range":{"start_line":92,"start_character":0,"end_line":92,"end_character":53},"updated":"2019-07-08 14:57:17.000000000","message":"what if someone sends in a \u0027Z\u0027 for zulu time?","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":194,"context_line":"def build_detailed_string_from_results(args, result_array):"},{"line_number":195,"context_line":"    returned_string \u003d \"\""},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    for i in range(len(result_array)):"},{"line_number":198,"context_line":"        jobj \u003d result_array[i]"},{"line_number":199,"context_line":"        jsource \u003d jobj[\u0027_source\u0027]"},{"line_number":200,"context_line":"        the_time \u003d jsource[\u0027@timestamp\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_e2e611e9","line":197,"range":{"start_line":197,"start_character":0,"end_line":197,"end_character":38},"updated":"2019-07-08 14:57:17.000000000","message":"why not do:\n\n   for result in result_array: \n\nYou are not using the index i other to fetch the object.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8c9fe5dac4a047307902e0e5ff34cd34f1ff0733","unresolved":false,"context_lines":[{"line_number":194,"context_line":"def build_detailed_string_from_results(args, result_array):"},{"line_number":195,"context_line":"    returned_string \u003d \"\""},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    for i in range(len(result_array)):"},{"line_number":198,"context_line":"        jobj \u003d result_array[i]"},{"line_number":199,"context_line":"        jsource \u003d jobj[\u0027_source\u0027]"},{"line_number":200,"context_line":"        the_time \u003d jsource[\u0027@timestamp\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_15dda913","line":197,"range":{"start_line":197,"start_character":0,"end_line":197,"end_character":38},"in_reply_to":"7faddb67_e2e611e9","updated":"2019-07-08 15:43:54.000000000","message":"++","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":30120,"name":"Colbert Philippe","email":"cp0396@ATT.com","username":"cp0396"},"change_message_id":"2d6c919c2b7e1edf2c6dfa9ea292a90156bc54be","unresolved":false,"context_lines":[{"line_number":194,"context_line":"def build_detailed_string_from_results(args, result_array):"},{"line_number":195,"context_line":"    returned_string \u003d \"\""},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    for i in range(len(result_array)):"},{"line_number":198,"context_line":"        jobj \u003d result_array[i]"},{"line_number":199,"context_line":"        jsource \u003d jobj[\u0027_source\u0027]"},{"line_number":200,"context_line":"        the_time \u003d jsource[\u0027@timestamp\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_ab9b06c7","line":197,"range":{"start_line":197,"start_character":0,"end_line":197,"end_character":38},"in_reply_to":"7faddb67_e2e611e9","updated":"2019-07-11 12:59:30.000000000","message":"Done","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        the_time \u003d jsource[\u0027@timestamp\u0027]"},{"line_number":201,"context_line":"        the_reason \u003d jsource[\u0027log\u0027]"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        the_who \u003d \u0027\u0027"},{"line_number":204,"context_line":"        the_who2 \u003d \u0027\u0027"},{"line_number":205,"context_line":"        match_obj \u003d re.match(r\u0027.*\\: from user\\: (\\S+)\\: to user\\: (\\S+).*\u0027, the_reason, re.M|re.I)"},{"line_number":206,"context_line":"        if match_obj:"},{"line_number":207,"context_line":"            the_who \u003d match_obj.group(1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_62da2118","line":204,"range":{"start_line":203,"start_character":0,"end_line":204,"end_character":21},"updated":"2019-07-08 14:57:17.000000000","message":"these variables should be better named.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8c9fe5dac4a047307902e0e5ff34cd34f1ff0733","unresolved":false,"context_lines":[{"line_number":191,"context_line":"        NagiosUtil.service_ok(args.ok_msg)"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"def build_detailed_string_from_results(args, result_array):"},{"line_number":195,"context_line":"    returned_string \u003d \"\""},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    for i in range(len(result_array)):"},{"line_number":198,"context_line":"        jobj \u003d result_array[i]"},{"line_number":199,"context_line":"        jsource \u003d jobj[\u0027_source\u0027]"},{"line_number":200,"context_line":"        the_time \u003d jsource[\u0027@timestamp\u0027]"},{"line_number":201,"context_line":"        the_reason \u003d jsource[\u0027log\u0027]"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        the_who \u003d \u0027\u0027"},{"line_number":204,"context_line":"        the_who2 \u003d \u0027\u0027"},{"line_number":205,"context_line":"        match_obj \u003d re.match(r\u0027.*\\: from user\\: (\\S+)\\: to user\\: (\\S+).*\u0027, the_reason, re.M|re.I)"},{"line_number":206,"context_line":"        if match_obj:"},{"line_number":207,"context_line":"            the_who \u003d match_obj.group(1)"},{"line_number":208,"context_line":"            if the_who and the_who.lower() \u003d\u003d \u0027root\u0027:"},{"line_number":209,"context_line":"                the_who \u003d \u0027\u0027"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"            the_who2 \u003d match_obj.group(2)"},{"line_number":212,"context_line":"            if the_who2 and the_who2.lower() \u003d\u003d \u0027root\u0027:"},{"line_number":213,"context_line":"                the_who2 \u003d \u0027\u0027"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        if args.only_nonpattern_user_id:"},{"line_number":216,"context_line":"            uid_regex \u003d args.user_id_regex"},{"line_number":217,"context_line":"            if (not re.match(uid_regex,the_who)) or (not re.match(uid_regex,the_who2)):"},{"line_number":218,"context_line":"                returned_string +\u003d ( \u0027( \u0027 + the_time + \u0027 ; \u0027 + the_who + \u0027 ; \u0027 + the_who2 + \u0027 ; \u0027 + the_reason + \u0027 ) \u0027 )"},{"line_number":219,"context_line":"        else:"},{"line_number":220,"context_line":"            returned_string +\u003d ( \u0027( \u0027 + the_time + \u0027 ; \u0027 + the_who + \u0027 ; \u0027 + the_who2 + \u0027 ; \u0027 + the_reason + \u0027 ) \u0027 )"},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"    return returned_string"},{"line_number":223,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_95cbd951","line":220,"range":{"start_line":194,"start_character":0,"end_line":220,"end_character":116},"updated":"2019-07-08 15:43:54.000000000","message":"This entire function could be cleaned up for clarity, it\u0027s not quite obvious what this does.","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":241,"context_line":""},{"line_number":242,"context_line":"    args \u003d parser.parse_args()"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"    # find search date, etheir noew or parameter timestamp"},{"line_number":245,"context_line":"    lt_time \u003d datetime.utcnow()"},{"line_number":246,"context_line":"    if args.search_timestamp:"},{"line_number":247,"context_line":"        lt_time \u003d args.search_timestamp"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_22066988","line":244,"range":{"start_line":244,"start_character":24,"end_line":244,"end_character":35},"updated":"2019-07-08 14:57:17.000000000","message":"spelling","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"fa36e83c6bdc9185b816c1461fe906a925cdc10f","unresolved":false,"context_lines":[{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    gte_time \u003d lt_time - timedelta(minutes\u003d(int(args.range)))"},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"    # if es_index_date was not passed as parameter, then  create it and use search_timestamp as value"},{"line_number":252,"context_line":"    adjust_missing_index_date(args, lt_time)"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"    if not args.search_timezone:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7faddb67_e2fff164","line":251,"range":{"start_line":251,"start_character":57,"end_line":251,"end_character":58},"updated":"2019-07-08 14:57:17.000000000","message":"extra space","commit_id":"1f9be664f999c04eb4b64e887a6038df7e276541"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    \"\"\"validates and reads range, must be less than 1 day \"\"\"\r"},{"line_number":35,"context_line":"\r"},{"line_number":36,"context_line":"    minutes \u003d None\r"},{"line_number":37,"context_line":"    if re.match(r\u0027\\-{0,1}\\d{1,4}\u0027, value.strip()):\r"},{"line_number":38,"context_line":"        minutes \u003d int(value)\r"},{"line_number":39,"context_line":"        if minutes \u003c 1 or minutes \u003e 1440:\r"},{"line_number":40,"context_line":"            raise argparse.ArgumentTypeError(\u0027%s is an invalid search time range.\u0027\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_5679cef9","line":37,"range":{"start_line":37,"start_character":18,"end_line":37,"end_character":25},"updated":"2019-07-09 22:35:39.000000000","message":"If we are only wanting a positive value here, why are we allowing a \u0027-\u0027 here?","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":51,"context_line":"    \"\"\"validates and reads threshold\"\"\"\r"},{"line_number":52,"context_line":"\r"},{"line_number":53,"context_line":"    threshold \u003d None\r"},{"line_number":54,"context_line":"    if re.match(r\u0027\\-{0,1}\\d{1,4}\u0027, value.strip()):\r"},{"line_number":55,"context_line":"        threshold \u003d int(value)\r"},{"line_number":56,"context_line":"        if threshold \u003c 1:\r"},{"line_number":57,"context_line":"            raise argparse.ArgumentTypeError(\u0027%s is an invalid threshold\u0027\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_b61cc2c1","line":54,"range":{"start_line":54,"start_character":18,"end_line":54,"end_character":25},"updated":"2019-07-09 22:35:39.000000000","message":"ditto","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":99,"context_line":"\r"},{"line_number":100,"context_line":"def get_utc_timezone_str():\r"},{"line_number":101,"context_line":"    \"\"\" using available libraries, get current timezone offset and converts to HH:MM (hour, minute) \"\"\"\r"},{"line_number":102,"context_line":"    final_string \u003d \u0027\u0027\r"},{"line_number":103,"context_line":"    \r"},{"line_number":104,"context_line":"    seconds_timezone_offset \u003d time.altzone\r"},{"line_number":105,"context_line":"    converted_to_dec_day_offset \u003d -1 * seconds_timezone_offset / (60 * 60)  # -1 necessary for international standard\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_165cb67c","line":102,"range":{"start_line":102,"start_character":4,"end_line":102,"end_character":16},"updated":"2019-07-09 22:35:39.000000000","message":"This could be better named, something like \"offset_value\"?","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":100,"context_line":"def get_utc_timezone_str():\r"},{"line_number":101,"context_line":"    \"\"\" using available libraries, get current timezone offset and converts to HH:MM (hour, minute) \"\"\"\r"},{"line_number":102,"context_line":"    final_string \u003d \u0027\u0027\r"},{"line_number":103,"context_line":"    \r"},{"line_number":104,"context_line":"    seconds_timezone_offset \u003d time.altzone\r"},{"line_number":105,"context_line":"    converted_to_dec_day_offset \u003d -1 * seconds_timezone_offset / (60 * 60)  # -1 necessary for international standard\r"},{"line_number":106,"context_line":"    converted_to_int_day_offset \u003d int(converted_to_dec_day_offset)\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_76872a63","line":103,"range":{"start_line":103,"start_character":0,"end_line":103,"end_character":4},"updated":"2019-07-09 22:35:39.000000000","message":"whitespace","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":187,"context_line":"    hits \u003d results[\u0027hits\u0027][\u0027total\u0027]\r"},{"line_number":188,"context_line":"\r"},{"line_number":189,"context_line":"    result_array \u003d results[\u0027hits\u0027][\u0027hits\u0027]\r"},{"line_number":190,"context_line":"    result_string \u003d  build_detailed_string_from_results(args, result_array)\r"},{"line_number":191,"context_line":"\r"},{"line_number":192,"context_line":"    message \u003d (\u0027Found %s \u003e\u003d %s(threshold) occurrences\u0027\r"},{"line_number":193,"context_line":"               \u0027 within the last %s minute(s). %s results: %s\u0027)\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_f6c6ba49","line":190,"updated":"2019-07-09 22:35:39.000000000","message":"extra space here","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":200,"context_line":"\r"},{"line_number":201,"context_line":"\r"},{"line_number":202,"context_line":"def build_detailed_string_from_results(args, results_array):\r"},{"line_number":203,"context_line":"    \"\"\" builds detailed string with information from each results in array \"\"\"\r"},{"line_number":204,"context_line":"    final_string \u003d \"\"\r"},{"line_number":205,"context_line":"\r"},{"line_number":206,"context_line":"    # loop through each result in results_array\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_56c78e13","line":203,"range":{"start_line":203,"start_character":7,"end_line":203,"end_character":75},"updated":"2019-07-09 22:35:39.000000000","message":"What info is in this \"detailed string?\"\n\nLooks like a \"from user\" (sender) and \"to user\" (recipient)?","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":212,"context_line":"        the_reason \u003d jsource[\u0027log\u0027]\r"},{"line_number":213,"context_line":"\r"},{"line_number":214,"context_line":"        # log result can have two user specs - we are acconting for both\r"},{"line_number":215,"context_line":"        the_user \u003d \u0027\u0027\r"},{"line_number":216,"context_line":"        the_user2 \u003d \u0027\u0027\r"},{"line_number":217,"context_line":"        match_obj \u003d re.match(r\u0027.*\\: from user\\: (\\S+)\\: to user\\: (\\S+).*\u0027, the_reason, re.M|re.I)\r"},{"line_number":218,"context_line":"        if match_obj:\r"},{"line_number":219,"context_line":"            the_user \u003d match_obj.group(1)\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_36d452bd","line":216,"range":{"start_line":215,"start_character":0,"end_line":216,"end_character":17},"updated":"2019-07-09 22:35:39.000000000","message":"What are these users?  Echoing Tin\u0027s comment from the previous ps about better naming.","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"07165f95869c218d400844be49bd902c230a4152","unresolved":false,"context_lines":[{"line_number":305,"context_line":"    params[\u0027target_timezone\u0027] \u003d args.search_timezone\r"},{"line_number":306,"context_line":"\r"},{"line_number":307,"context_line":"    params[\u0027target_field\u0027] \u003d \"log\"\r"},{"line_number":308,"context_line":"    params[\u0027target_value\u0027] \u003d \" nologin: allowed: from user:\"\r"},{"line_number":309,"context_line":"    params[\u0027want_size\u0027] \u003d 25\r"},{"line_number":310,"context_line":"\r"},{"line_number":311,"context_line":"    data_json[\u0027params\u0027] \u003d params\r"}],"source_content_type":"text/x-python","patch_set":2,"id":"7faddb67_9677463b","line":308,"range":{"start_line":308,"start_character":30,"end_line":308,"end_character":31},"updated":"2019-07-09 22:35:39.000000000","message":"extra space","commit_id":"f241a009d2a42e8aaf947c0d62489b01cc003f34"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":31,"context_line":"from nagiosutil import NagiosUtil\r"},{"line_number":32,"context_line":"\r"},{"line_number":33,"context_line":"def check_range(value):\r"},{"line_number":34,"context_line":"    \"\"\"validates and reads range, must be less than 1 day \"\"\"\r"},{"line_number":35,"context_line":"\r"},{"line_number":36,"context_line":"    minutes \u003d None\r"},{"line_number":37,"context_line":"    if re.match(r\u0027\\d{1,4}\u0027, value.strip()):\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_db207bb3","line":34,"range":{"start_line":34,"start_character":27,"end_line":34,"end_character":32},"updated":"2019-07-10 15:26:17.000000000","message":"Is it true that this must be minutes? If so, please provide that information as a part of this description.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":46,"context_line":"                                        \u0027minutes (1 day) .\u0027 % value)\r"},{"line_number":47,"context_line":"    return minutes\r"},{"line_number":48,"context_line":"\r"},{"line_number":49,"context_line":"\r"},{"line_number":50,"context_line":"def check_threshold(value):\r"},{"line_number":51,"context_line":"    \"\"\"validates and reads threshold\"\"\"\r"},{"line_number":52,"context_line":"\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_469caebf","line":49,"updated":"2019-07-10 15:26:17.000000000","message":"Light suggestion: I think it makes more sense to have one generic, range-checking function. It could accept the start and end values of the range based on the operation.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":54,"context_line":"    if re.match(r\u0027\\d{1,4}\u0027, value.strip()):\r"},{"line_number":55,"context_line":"        threshold \u003d int(value)\r"},{"line_number":56,"context_line":"    else:\r"},{"line_number":57,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is out-of-range or not entirely numeric, \u0027\r"},{"line_number":58,"context_line":"                                          \u0027a positive value is required.\u0027 % value)\r"},{"line_number":59,"context_line":"    return threshold\r"},{"line_number":60,"context_line":"\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_0658f62f","line":57,"range":{"start_line":57,"start_character":41,"end_line":57,"end_character":60},"updated":"2019-07-10 15:26:17.000000000","message":"We should provide feedback on the size of the range. In this case, the max value is 9999.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":61,"context_line":"def check_datetime(value):\r"},{"line_number":62,"context_line":"    \"\"\" validates and reads the datatime from string value \"\"\"\r"},{"line_number":63,"context_line":"    the_datetime \u003d None\r"},{"line_number":64,"context_line":"    if re.match(r\u0027\\d{4}\\-\\d{2}\\-\\d{2}T\\d{2}\\:\\d{2}\\:\\d{2}(\\.\\d+){0,1}\u0027, value.strip()):\r"},{"line_number":65,"context_line":"        try:\r"},{"line_number":66,"context_line":"            the_datetime \u003d datetime.strptime(value, \u0027%Y-%m-%dT%H:%M:%S\u0027)\r"},{"line_number":67,"context_line":"        except ValueError:\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_86c0667d","line":64,"range":{"start_line":64,"start_character":4,"end_line":64,"end_character":87},"updated":"2019-07-10 15:26:17.000000000","message":"This is not necessary. You can handle the exception thrown by the datetime module if the provided value does not match the format you specify below.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":72,"context_line":"\r"},{"line_number":73,"context_line":"def check_date(value):\r"},{"line_number":74,"context_line":"    \"\"\"validates and reads date (only, no time) in standard format \"\"\"\r"},{"line_number":75,"context_line":"    the_date \u003d None\r"},{"line_number":76,"context_line":"    if re.match(r\u0027\\d{4}\\-\\d{2}\\-\\d{2}\u0027, value.strip()):\r"},{"line_number":77,"context_line":"        try:\r"},{"line_number":78,"context_line":"            the_date \u003d datetime.strptime(value, \u0027%Y-%m-%d\u0027)\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_065b16f7","line":75,"range":{"start_line":75,"start_character":4,"end_line":75,"end_character":12},"updated":"2019-07-10 15:26:17.000000000","message":"Tin\u0027s comment below also applies here. \"the\" is redundant and does not provide meaningful value to variable names. Please remove it from all variable names.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":73,"context_line":"def check_date(value):\r"},{"line_number":74,"context_line":"    \"\"\"validates and reads date (only, no time) in standard format \"\"\"\r"},{"line_number":75,"context_line":"    the_date \u003d None\r"},{"line_number":76,"context_line":"    if re.match(r\u0027\\d{4}\\-\\d{2}\\-\\d{2}\u0027, value.strip()):\r"},{"line_number":77,"context_line":"        try:\r"},{"line_number":78,"context_line":"            the_date \u003d datetime.strptime(value, \u0027%Y-%m-%d\u0027)\r"},{"line_number":79,"context_line":"        except ValueError:\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_8655c6c8","line":76,"range":{"start_line":76,"start_character":4,"end_line":76,"end_character":55},"updated":"2019-07-10 15:26:17.000000000","message":"Same here. This is unnecessary, as datetime will throw an exception for a value not matching the given pattern. You can handle that exception to provide meaningful output, as you already do below.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"9b579d5280cdf658ad8f38578cbd08cc90d05cbd","unresolved":false,"context_lines":[{"line_number":87,"context_line":"\r"},{"line_number":88,"context_line":"def check_timezone(value):\r"},{"line_number":89,"context_line":"    \"\"\"validate timezone specification +/-hh:mm \"\"\"\r"},{"line_number":90,"context_line":"    the_timezone \u003d None\r"},{"line_number":91,"context_line":"    value \u003d value.strip()\r"},{"line_number":92,"context_line":"    if re.match(r\u0027(\\+|\\-){1}\\d{2}\\:\\d{2}\u0027, value):\r"},{"line_number":93,"context_line":"        the_timezone \u003d value\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_b56a6eb0","line":90,"range":{"start_line":90,"start_character":4,"end_line":90,"end_character":16},"updated":"2019-07-10 13:20:31.000000000","message":"nit: why not name it timezone? or current_timezone, not sure what the_ adds to the variable name","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"ca0b45800cddd2d6292597f1d43c452d852c6dad","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    \"\"\"validate timezone specification +/-hh:mm \"\"\"\r"},{"line_number":90,"context_line":"    the_timezone \u003d None\r"},{"line_number":91,"context_line":"    value \u003d value.strip()\r"},{"line_number":92,"context_line":"    if re.match(r\u0027(\\+|\\-){1}\\d{2}\\:\\d{2}\u0027, value):\r"},{"line_number":93,"context_line":"        the_timezone \u003d value\r"},{"line_number":94,"context_line":"    else:\r"},{"line_number":95,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid timezone format, expect +/-hh:mm\u0027 % value)\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_0610f600","line":92,"range":{"start_line":92,"start_character":4,"end_line":92,"end_character":50},"updated":"2019-07-10 15:26:17.000000000","message":"Can we use datetime instead of regular expressions?","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"9b579d5280cdf658ad8f38578cbd08cc90d05cbd","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid timezone format, expect +/-hh:mm\u0027 % value)\r"},{"line_number":96,"context_line":"    return the_timezone\r"},{"line_number":97,"context_line":"\r"},{"line_number":98,"context_line":"def get_utc_timezone_str():\r"},{"line_number":99,"context_line":"    \"\"\" using available libraries, get current timezone offset and converts to HH:MM (hour, minute) \"\"\"\r"},{"line_number":100,"context_line":"    seconds_timezone_offset \u003d time.altzone\r"},{"line_number":101,"context_line":"    converted_to_dec_day_offset \u003d -1 * seconds_timezone_offset / (60 * 60)  # -1 necessary for international standard\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_d53ccac0","line":98,"range":{"start_line":98,"start_character":0,"end_line":98,"end_character":27},"updated":"2019-07-10 13:20:31.000000000","message":"you sure there isn\u0027t a python library that does this for you automatically? All these manual time/string changes along with regex matches and arithmetics are kind of scary without tests.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"9b579d5280cdf658ad8f38578cbd08cc90d05cbd","unresolved":false,"context_lines":[{"line_number":171,"context_line":"    if (not response or not hasattr(response, \u0027status_code\u0027)\r"},{"line_number":172,"context_line":"            or response.status_code \u003c 200 or response.status_code \u003e\u003d 400\r"},{"line_number":173,"context_line":"            or not response.json()):\r"},{"line_number":174,"context_line":"        NagiosUtil.service_unknown(\u0027Unexpected results found. \u0027 + response.text)\r"},{"line_number":175,"context_line":"    elif (not response.json()[\u0027hits\u0027]\r"},{"line_number":176,"context_line":"          or int(response.json()[\u0027hits\u0027][\u0027total\u0027]) \u003c 0):\r"},{"line_number":177,"context_line":"        NagiosUtil.service_unknown(\u0027Unexpected results found. \u0027 + str(response.json()))\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_95b41237","line":174,"range":{"start_line":174,"start_character":66,"end_line":174,"end_character":79},"updated":"2019-07-10 13:20:31.000000000","message":"in the event response pass in as None, if (not response or ...) is evaluated true, and then we get to this, and response.text will bomb out on you.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"9b579d5280cdf658ad8f38578cbd08cc90d05cbd","unresolved":false,"context_lines":[{"line_number":206,"context_line":"        the_reason \u003d jsource[\u0027log\u0027]\r"},{"line_number":207,"context_line":"\r"},{"line_number":208,"context_line":"        # log result can have two user specs - we are acconting for both\r"},{"line_number":209,"context_line":"        the_user \u003d \u0027\u0027\r"},{"line_number":210,"context_line":"        the_user2 \u003d \u0027\u0027\r"},{"line_number":211,"context_line":"        match_obj \u003d re.match(r\u0027.*\\: from user\\: (\\S+)\\: to user\\: (\\S+).*\u0027, the_reason, re.M|re.I)\r"},{"line_number":212,"context_line":"        if match_obj:\r"},{"line_number":213,"context_line":"            the_user \u003d match_obj.group(1)\r"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_15826250","line":210,"range":{"start_line":209,"start_character":0,"end_line":210,"end_character":22},"updated":"2019-07-10 13:20:31.000000000","message":"ditto: nit, at this point, you might well name these user and user2.","commit_id":"53ad0f2bfbc1b0a78381121e1bc2942a7b3b0d6a"},{"author":{"_account_id":23928,"name":"Pete Birley","email":"petebirley@gmail.com","username":"portdirect"},"change_message_id":"dba09caec72e8d2dcf89d885122a56cfa6bcbe00","unresolved":false,"context_lines":[{"line_number":54,"context_line":"    if re.match(r\u0027\\d{1,4}\u0027, value.strip()):\r"},{"line_number":55,"context_line":"        threshold \u003d int(value)\r"},{"line_number":56,"context_line":"    else:\r"},{"line_number":57,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is out-of-range or not entirely numeric, \u0027\r"},{"line_number":58,"context_line":"                                          \u0027a positive value is required.\u0027 % value)\r"},{"line_number":59,"context_line":"    return threshold\r"},{"line_number":60,"context_line":"\r"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_2f99421e","line":57,"range":{"start_line":57,"start_character":48,"end_line":57,"end_character":60},"updated":"2019-07-10 19:31:35.000000000","message":"what is the range? looks like this just allows any int \u003c10000?","commit_id":"aadc1fd434a535b16d4532a2426bf891d8bd755b"},{"author":{"_account_id":23928,"name":"Pete Birley","email":"petebirley@gmail.com","username":"portdirect"},"change_message_id":"dba09caec72e8d2dcf89d885122a56cfa6bcbe00","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is an invalid timezone format, expect +/-hh:mm\u0027 % value)\r"},{"line_number":89,"context_line":"    return timezone\r"},{"line_number":90,"context_line":"\r"},{"line_number":91,"context_line":"def get_utc_timezone_str():\r"},{"line_number":92,"context_line":"    \"\"\" using available libraries, get current timezone offset and converts to HH:MM (hour, minute) \"\"\"\r"},{"line_number":93,"context_line":"    seconds_timezone_offset \u003d time.altzone\r"},{"line_number":94,"context_line":"    converted_to_dec_day_offset \u003d -1 * seconds_timezone_offset / (60 * 60)  # -1 necessary for international standard\r"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_afad3232","line":91,"range":{"start_line":91,"start_character":4,"end_line":91,"end_character":24},"updated":"2019-07-10 19:31:35.000000000","message":"please see tins comment from ps3, have you looked into alternative approaches to this?","commit_id":"aadc1fd434a535b16d4532a2426bf891d8bd755b"},{"author":{"_account_id":23928,"name":"Pete Birley","email":"petebirley@gmail.com","username":"portdirect"},"change_message_id":"f1d67ec0868fd1b01a9118baa39d7e57d763655c","unresolved":false,"context_lines":[{"line_number":42,"context_line":"    else:\r"},{"line_number":43,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is out-of-range or not entirely \u0027\r"},{"line_number":44,"context_line":"                                         \u0027numeric. Expecting values are \u0027\r"},{"line_number":45,"context_line":"                                         \u0027between 1 and 1440 minutes (1 day).\u0027 \r"},{"line_number":46,"context_line":"                                         % value)\r"},{"line_number":47,"context_line":"    return minutes\r"},{"line_number":48,"context_line":"\r"}],"source_content_type":"text/x-python","patch_set":7,"id":"7faddb67_b50fb8df","line":45,"range":{"start_line":45,"start_character":78,"end_line":45,"end_character":79},"updated":"2019-07-11 12:59:43.000000000","message":"ws","commit_id":"fbe140498b47e055a531b29ca14eb7942cde1c97"},{"author":{"_account_id":23928,"name":"Pete Birley","email":"petebirley@gmail.com","username":"portdirect"},"change_message_id":"f1d67ec0868fd1b01a9118baa39d7e57d763655c","unresolved":false,"context_lines":[{"line_number":54,"context_line":"    if re.match(r\u0027\\d{1,4}\u0027, value.strip()):\r"},{"line_number":55,"context_line":"        threshold \u003d int(value)\r"},{"line_number":56,"context_line":"    else:\r"},{"line_number":57,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is out-of-range or not entirely \u0027\r"},{"line_number":58,"context_line":"                                          \u0027numeric, a positive value is \u0027\r"},{"line_number":59,"context_line":"                                          \u0027required.\u0027 % value)\r"},{"line_number":60,"context_line":"    return threshold\r"}],"source_content_type":"text/x-python","patch_set":7,"id":"7faddb67_95f4fcd0","line":57,"range":{"start_line":57,"start_character":48,"end_line":57,"end_character":60},"updated":"2019-07-11 12:59:43.000000000","message":"there have been multiple comments regarding the definition of range here, please address them.","commit_id":"fbe140498b47e055a531b29ca14eb7942cde1c97"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"8f69a3040ec0dc170854dd878cff455a0d4910c1","unresolved":false,"context_lines":[{"line_number":30,"context_line":"from nagiosutil import NagiosUtil\r"},{"line_number":31,"context_line":"\r"},{"line_number":32,"context_line":"def check_duration(value):\r"},{"line_number":33,"context_line":"    \"\"\" Duration here means the amount of time (in minutes) to go back \r"},{"line_number":34,"context_line":"        to do the search.   So the time interval of the search starts\r"},{"line_number":35,"context_line":"        now and goes back to a number of minutes (specified here).\r"},{"line_number":36,"context_line":"        The number of minutes is specified here.  \r"}],"source_content_type":"text/x-python","patch_set":8,"id":"7faddb67_3172f512","line":33,"range":{"start_line":33,"start_character":70,"end_line":33,"end_character":71},"updated":"2019-07-12 15:14:41.000000000","message":"Please remove all trailing whitespace (highlighted in red).","commit_id":"8aa64463b03af68eac531c7db3861d0bb5c9c85e"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"8f69a3040ec0dc170854dd878cff455a0d4910c1","unresolved":false,"context_lines":[{"line_number":36,"context_line":"        The number of minutes is specified here.  \r"},{"line_number":37,"context_line":"        It must be less than 1 day \"\"\"\r"},{"line_number":38,"context_line":"    minutes \u003d None\r"},{"line_number":39,"context_line":"    if re.match(r\u0027\\d{1,4}\u0027, value.strip()):\r"},{"line_number":40,"context_line":"        minutes \u003d int(value)\r"},{"line_number":41,"context_line":"        if minutes \u003c 1 or minutes \u003e 1440:\r"},{"line_number":42,"context_line":"            raise argparse.ArgumentTypeError(\u0027%s is an invalid search time \u0027\r"}],"source_content_type":"text/x-python","patch_set":8,"id":"7faddb67_d14cc19f","line":39,"range":{"start_line":39,"start_character":4,"end_line":39,"end_character":43},"updated":"2019-07-12 15:14:41.000000000","message":"It is preferred to use built-in types in Python wherever possible, rather than relying on regular expressions.\n\nFor example, you could do so the following way:\n\n  try:\n    minutes \u003d int(value)\n  except ValueError:\n    # Now you know the value was not an integer\n    # raise meaningful exception here.","commit_id":"8aa64463b03af68eac531c7db3861d0bb5c9c85e"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"8f69a3040ec0dc170854dd878cff455a0d4910c1","unresolved":false,"context_lines":[{"line_number":51,"context_line":"    return minutes\r"},{"line_number":52,"context_line":"\r"},{"line_number":53,"context_line":"\r"},{"line_number":54,"context_line":"def check_failure_count_threshold(value):\r"},{"line_number":55,"context_line":"    \"\"\"validates and reads threshold.  Threshold is for the count of login \r"},{"line_number":56,"context_line":"       failures found in search \"\"\"\r"},{"line_number":57,"context_line":"    threshold \u003d None\r"}],"source_content_type":"text/x-python","patch_set":8,"id":"7faddb67_0c1d5e65","line":54,"range":{"start_line":54,"start_character":4,"end_line":54,"end_character":33},"updated":"2019-07-12 15:14:41.000000000","message":"As mentioned in my review of patch set 3, this check repeats logic from the above check.\n\nThe same check could serve checking the failure count threshold and the duration. i.e. the first check verifies an integer range of [1,1440] and this check verifies an integer range of [1,9999].\n\nUse the generic check multiple times in each relevant part of the script below.","commit_id":"8aa64463b03af68eac531c7db3861d0bb5c9c85e"},{"author":{"_account_id":28618,"name":"Drew Walters","email":"drewwalters@microsoft.com","username":"drewwalters96"},"change_message_id":"8f69a3040ec0dc170854dd878cff455a0d4910c1","unresolved":false,"context_lines":[{"line_number":99,"context_line":"    return timezone\r"},{"line_number":100,"context_line":"\r"},{"line_number":101,"context_line":"def get_utc_timezone_str():\r"},{"line_number":102,"context_line":"    \"\"\" using available libraries, get current timezone offset and converts \r"},{"line_number":103,"context_line":"        to HH:MM (hour, minute) \"\"\"\r"},{"line_number":104,"context_line":"    seconds_timezone_offset \u003d time.altzone\r"},{"line_number":105,"context_line":"    # -1 necessary to meet international standard\r"},{"line_number":106,"context_line":"    converted_to_dec_day_offset \u003d -1 * seconds_timezone_offset / (60 * 60)\r"}],"source_content_type":"text/x-python","patch_set":8,"id":"7faddb67_0c923e9f","line":103,"range":{"start_line":102,"start_character":5,"end_line":103,"end_character":35},"updated":"2019-07-12 15:14:41.000000000","message":"I\u0027m not exactly clear what is happening here. Aren\u0027t we using timezone unaware datetime objects?\n\nThe name of the function here is get_utc_timezone_str. You can get the current UTC time like so:\n\n  datetime.now(timezone.utc).strftime(\"%H:%M\")","commit_id":"8aa64463b03af68eac531c7db3861d0bb5c9c85e"},{"author":{"_account_id":17068,"name":"Jean-Philippe Evrard","email":"openstack@a.spamming.party","username":"evrardjp"},"change_message_id":"5024c5ad95240d8911b2b75684568a49341e4fcb","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#!/usr/bin/env python\r"},{"line_number":2,"context_line":"#\r"},{"line_number":3,"context_line":"# Copyright 2019 The Openstack-Helm Authors.\r"},{"line_number":4,"context_line":"#\r"},{"line_number":5,"context_line":"# Licensed under the Apache License, Version 2.0 (the \"License\");\r"},{"line_number":6,"context_line":"# you may not use this file except in compliance with the License.\r"}],"source_content_type":"text/x-python","patch_set":9,"id":"7faddb67_5b5e27ea","line":3,"range":{"start_line":3,"start_character":0,"end_line":3,"end_character":44},"updated":"2019-07-22 10:09:41.000000000","message":"Please remove this line, or use your company name.","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"6421c62ad4713b64056a84f8f8b02b26371cecd9","unresolved":false,"context_lines":[{"line_number":58,"context_line":"    try:\r"},{"line_number":59,"context_line":"        threshold \u003d int(value)\r"},{"line_number":60,"context_line":"    except ValueError:\r"},{"line_number":61,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s is out-of-range or not entirely \u0027\r"},{"line_number":62,"context_line":"                                          \u0027or must be numeric, \u0027\r"},{"line_number":63,"context_line":"                                          \u0027or a positive value is required.\u0027\r"},{"line_number":64,"context_line":"                                           % value)\r"}],"source_content_type":"text/x-python","patch_set":9,"id":"7faddb67_cf95758a","line":61,"range":{"start_line":61,"start_character":45,"end_line":61,"end_character":70},"updated":"2019-07-22 02:38:02.000000000","message":"this is not an out of range check","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"6421c62ad4713b64056a84f8f8b02b26371cecd9","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        datetime \u003d datetime.strptime(value, \u0027%Y-%m-%dT%H:%M:%S\u0027)\r"},{"line_number":72,"context_line":"    except ValueError:\r"},{"line_number":73,"context_line":"        raise argparse.ArgumentTypeError(\u0027%s has date-time format but a \u0027\r"},{"line_number":74,"context_line":"                                         \u0027value is out-of-range, expect \u0027\r"},{"line_number":75,"context_line":"                                         \u0027YYYY-mm-ddThh:mm:ss\u0027 % value)\r"},{"line_number":76,"context_line":"    return datetime\r"},{"line_number":77,"context_line":"\r"}],"source_content_type":"text/x-python","patch_set":9,"id":"7faddb67_af8cb97f","line":74,"range":{"start_line":74,"start_character":51,"end_line":74,"end_character":63},"updated":"2019-07-22 02:38:02.000000000","message":"if it is a ValueError exception, it is just an invalid date, not out of range as no range is specified.","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"6421c62ad4713b64056a84f8f8b02b26371cecd9","unresolved":false,"context_lines":[{"line_number":100,"context_line":"    return timezone\r"},{"line_number":101,"context_line":"\r"},{"line_number":102,"context_line":"def get_utc_timezone_str():\r"},{"line_number":103,"context_line":"    \"\"\" get current timezone if format (+/-)HH:MM (hour, minute) \"\"\"\r"},{"line_number":104,"context_line":"    # -1 is to meet international standard and not doing fractional timezone\r"},{"line_number":105,"context_line":"    current_time_timezone \u003d int(-1 * time.altzone / (60 * 60))\r"},{"line_number":106,"context_line":"    timezone_sign \u003d \u0027\u0027\r"},{"line_number":107,"context_line":"    if current_time_timezone \u003c 0:\r"},{"line_number":108,"context_line":"        timezone_sign \u003d \u0027-\u0027\r"},{"line_number":109,"context_line":"    else:\r"},{"line_number":110,"context_line":"        timezone_sign \u003d \u0027+\u0027\r"},{"line_number":111,"context_line":"    return timezone_sign + format(abs(current_time_timezone), \u002702d\u0027) + \u0027:00\u0027\r"},{"line_number":112,"context_line":"\r"},{"line_number":113,"context_line":"\r"},{"line_number":114,"context_line":"def setup_argparse(parser):\r"}],"source_content_type":"text/x-python","patch_set":9,"id":"7faddb67_0ff14d02","line":111,"range":{"start_line":103,"start_character":0,"end_line":111,"end_character":76},"updated":"2019-07-22 02:38:02.000000000","message":"isn\u0027t this just:\n\n   from dateutil import tz\n   s \u003d datetime.now(tz.tzlocal()).strftime(\u0027%z\u0027)\n   return \"%s:%s\" % (s[:3], s[-2:])","commit_id":"3f9c4530b0ab4797bccf24aef4720f3fd9fc7632"}]}
