)]}'
{"oslo_policy/_enforcers/opa.py":[{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":15,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":16,"context_line":"#    under the License."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"import json"},{"line_number":19,"context_line":"import logging"},{"line_number":20,"context_line":"import requests"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"from oslo_config import cfg"},{"line_number":23,"context_line":"from oslo_context import context"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"from oslo_policy._i18n import _"},{"line_number":26,"context_line":"from oslo_policy import policy"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"LOG \u003d logging.getLogger(__name__)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_e9df13d5","line":26,"range":{"start_line":18,"start_character":0,"end_line":26,"end_character":30},"updated":"2018-09-24 14:44:34.000000000","message":"is there a guideline for imports?\n\nI recall something about std library, empty line, own imports, empty line, 3rd party imports.","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":29,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"_options \u003d ["},{"line_number":32,"context_line":"    cfg.StrOpt(\u0027url\u0027,"},{"line_number":33,"context_line":"               help\u003d_(\u0027This option points to the URL where Open Policy Agent \u0027"},{"line_number":34,"context_line":"                      \u0027is listening on.\u0027))"},{"line_number":35,"context_line":"]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_c9f0176a","line":32,"range":{"start_line":32,"start_character":8,"end_line":32,"end_character":14},"updated":"2018-09-24 14:44:34.000000000","message":"Have you considered URIOpt?","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":42,"context_line":"    \"\"\""},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self, conf, rules\u003dNone, default_rule\u003dNone, *args, **kwargs):"},{"line_number":45,"context_line":"        opt_group \u003d cfg.OptGroup(name\u003d\u0027oslo_policy_opa\u0027,"},{"line_number":46,"context_line":"                                 title\u003d\u0027Open Policy Agent driver options\u0027)"},{"line_number":47,"context_line":"        conf.register_group(opt_group)"},{"line_number":48,"context_line":"        conf.register_opts(_options, group\u003dopt_group)"},{"line_number":49,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_6968e3f3","line":46,"range":{"start_line":45,"start_character":0,"end_line":46,"end_character":74},"updated":"2018-09-24 14:44:34.000000000","message":"you could declare _group like you did with _options avoiding to create multiple instances of OptGroup()","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":44,"context_line":"    def __init__(self, conf, rules\u003dNone, default_rule\u003dNone, *args, **kwargs):"},{"line_number":45,"context_line":"        opt_group \u003d cfg.OptGroup(name\u003d\u0027oslo_policy_opa\u0027,"},{"line_number":46,"context_line":"                                 title\u003d\u0027Open Policy Agent driver options\u0027)"},{"line_number":47,"context_line":"        conf.register_group(opt_group)"},{"line_number":48,"context_line":"        conf.register_opts(_options, group\u003dopt_group)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        super(Enforcer, self).__init__(conf, rules, default_rule)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_8c578d02","line":47,"range":{"start_line":47,"start_character":8,"end_line":47,"end_character":38},"updated":"2018-09-24 14:44:34.000000000","message":"you can dismiss this line, conf.register_opts() takes care of it.","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        opt_group \u003d cfg.OptGroup(name\u003d\u0027oslo_policy_opa\u0027,"},{"line_number":46,"context_line":"                                 title\u003d\u0027Open Policy Agent driver options\u0027)"},{"line_number":47,"context_line":"        conf.register_group(opt_group)"},{"line_number":48,"context_line":"        conf.register_opts(_options, group\u003dopt_group)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        super(Enforcer, self).__init__(conf, rules, default_rule)"},{"line_number":51,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_cfbed763","line":48,"range":{"start_line":48,"start_character":8,"end_line":48,"end_character":53},"updated":"2018-09-24 14:44:34.000000000","message":"you can just do conf.register_opts(_opts, _group) and get rid of the group\u003d","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27954,"name":"Moisés Guimarães de Medeiros","email":"guimaraes@pm.me","username":"moguimar"},"change_message_id":"66a7190c4895500b90675eaade74aecb70be9e9c","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        \"\"\""},{"line_number":122,"context_line":"        if isinstance(creds, context.RequestContext):"},{"line_number":123,"context_line":"            creds \u003d self._map_context_attributes_into_creds(creds)"},{"line_number":124,"context_line":"        data \u003d {"},{"line_number":125,"context_line":"            \"input\": {"},{"line_number":126,"context_line":"                \"action_name\": rule,"},{"line_number":127,"context_line":"                \"credentials\": creds,"},{"line_number":128,"context_line":"                \"target\": target"},{"line_number":129,"context_line":"            }"},{"line_number":130,"context_line":"        }"},{"line_number":131,"context_line":"        headers \u003d {"},{"line_number":132,"context_line":"            \"Content-Type\": \"application/json\""},{"line_number":133,"context_line":"        }"},{"line_number":134,"context_line":"        req \u003d self.sess.post(self.url, data\u003djson.dumps(data), headers\u003dheaders)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        if req.status_code !\u003d 200:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_6d06a824","line":133,"range":{"start_line":124,"start_character":0,"end_line":133,"end_character":9},"updated":"2018-09-24 14:44:34.000000000","message":"I\u0027d include an empty line before those two and move headers before data just for readability.","commit_id":"5dbd69d3fd9946e2a0438850036a09c1d0c6d1b8"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"0e2160ddf67b63dd7daad8080d90e80734ce1c7a","unresolved":false,"context_lines":[{"line_number":50,"context_line":"        super(Enforcer, self).__init__(conf, rules, default_rule)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"        self.url \u003d self.conf.oslo_policy_opa.url"},{"line_number":53,"context_line":"        self.sess \u003d requests.Session()"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"    def set_rules(self, rules, overwrite\u003dTrue, use_conf\u003dFalse):"},{"line_number":56,"context_line":"        \"\"\"Create a new :class:`Rules` based on the provided dict of rules."}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_b93813ed","line":53,"updated":"2018-10-11 06:59:34.000000000","message":"I think we can rename it to self.session for more readability.","commit_id":"4a063ca2a73fd55a0daaaa6576ae9484ac5f2600"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"0e2160ddf67b63dd7daad8080d90e80734ce1c7a","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        For the OpenPolicyAgent driver, this is not implemented as rules are"},{"line_number":59,"context_line":"        handled separately in the agent."},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        :param dict rules: New rules to use."},{"line_number":62,"context_line":"        :param overwrite: Whether to overwrite current rules or update them"},{"line_number":63,"context_line":"                          with the new rules."},{"line_number":64,"context_line":"        :param use_conf: Whether to reload rules from cache or config file."}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_4b124657","line":61,"updated":"2018-10-11 06:59:34.000000000","message":"You can define \u0027dict\u0027 in type. Pl have a look on my comment over L100, for it.","commit_id":"4a063ca2a73fd55a0daaaa6576ae9484ac5f2600"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"0e2160ddf67b63dd7daad8080d90e80734ce1c7a","unresolved":false,"context_lines":[{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        :param rule: The rule to evaluate."},{"line_number":99,"context_line":"        :type rule: string or :class:`BaseCheck`"},{"line_number":100,"context_line":"        :param dict target: As much information about the object being"},{"line_number":101,"context_line":"                            operated on as possible. The target"},{"line_number":102,"context_line":"                            argument should be a dict instance or an"},{"line_number":103,"context_line":"                            instance of a class that fully supports"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_19002703","line":100,"range":{"start_line":100,"start_character":0,"end_line":100,"end_character":70},"updated":"2018-10-11 06:59:34.000000000","message":"Here we can define a separate \u0027type\u0027 for this param target same as for above rule for consistency.","commit_id":"4a063ca2a73fd55a0daaaa6576ae9484ac5f2600"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"0e2160ddf67b63dd7daad8080d90e80734ce1c7a","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                            instance of a class that fully supports"},{"line_number":104,"context_line":"                            the Mapping abstract base class and deep"},{"line_number":105,"context_line":"                            copying."},{"line_number":106,"context_line":"        :param dict creds: As much information about the user performing the"},{"line_number":107,"context_line":"                           action as possible."},{"line_number":108,"context_line":"        :param do_raise: Whether to raise an exception or not if check"},{"line_number":109,"context_line":"                        fails."}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_cb06561c","line":106,"updated":"2018-10-11 06:59:34.000000000","message":"ditto. For below ones too.","commit_id":"4a063ca2a73fd55a0daaaa6576ae9484ac5f2600"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"0e2160ddf67b63dd7daad8080d90e80734ce1c7a","unresolved":false,"context_lines":[{"line_number":136,"context_line":"        if req.status_code !\u003d 200:"},{"line_number":137,"context_line":"            raise RuntimeError(\"Failed calling OPA: %s\", str(req))"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"        answer \u003d req.json()"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"        if \"result\" not in answer:"},{"line_number":142,"context_line":"            raise RuntimeError(\"malformed response\")"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_8b35bedd","line":139,"updated":"2018-10-11 06:59:34.000000000","message":"I think \u0027response\u0027 can be good substitute for \u0027answer\u0027,as request gives response.","commit_id":"4a063ca2a73fd55a0daaaa6576ae9484ac5f2600"}]}
