)]}'
{"oslo_messaging/_drivers/impl_rabbit.py":[{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2122185edb13898c0aab033f7e9208f82656c67d","unresolved":false,"context_lines":[{"line_number":1139,"context_line":"    def _publish(self, exchange, msg, routing_key\u003dNone, timeout\u003dNone,"},{"line_number":1140,"context_line":"                 transport_options\u003dNone):"},{"line_number":1141,"context_line":"        \"\"\"Publish a message.\"\"\""},{"line_number":1142,"context_line":"        def is_mandatory(ops):"},{"line_number":1143,"context_line":"            if ops is not None:"},{"line_number":1144,"context_line":"                if isinstance(ops, dict):"},{"line_number":1145,"context_line":"                    if \"mandatory\" in ops:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_fefeb769","line":1142,"updated":"2019-06-19 09:42:22.000000000","message":"Some candies for reviewers \u003d\u003e s/ops/opt/\n\nI have spend some seconds to figure out \"what\u0027s ops? operator?\" \n\n\"opt\" is more closer to the common \"option\" abbreviation.\n\nIn parallel I\u0027m not sure it\u0027s a good idea to declare this as an inner function... the opcode needed for that is inefficient and it\u0027s not a closure due to the fact that this function take a param (ops).\n\nThe goal of this function is really generic and I think we extract it outer of this function.\n\nAlso why not define something like this:\n```\ndef contains(opt, value, default\u003dFalse):\n```\n\ninstead of `is_mandatory`, where we will call it like that:\n```\nmandatory\u003dcontains(opt, \"mandatory\")\n```","commit_id":"1c7afa7bf5f6a79a275c13732dd3accf4a47ec4f"},{"author":{"_account_id":29364,"name":"Gabriele Santomaggio","email":"g.santomaggio@gmail.com","username":"gsantomaggio"},"change_message_id":"2bd0bfdd2723ff9058bba6590e89a7e2346fac51","unresolved":false,"context_lines":[{"line_number":1139,"context_line":"    def _publish(self, exchange, msg, routing_key\u003dNone, timeout\u003dNone,"},{"line_number":1140,"context_line":"                 transport_options\u003dNone):"},{"line_number":1141,"context_line":"        \"\"\"Publish a message.\"\"\""},{"line_number":1142,"context_line":"        def is_mandatory(ops):"},{"line_number":1143,"context_line":"            if ops is not None:"},{"line_number":1144,"context_line":"                if isinstance(ops, dict):"},{"line_number":1145,"context_line":"                    if \"mandatory\" in ops:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_bb191a89","line":1142,"in_reply_to":"9fb8cfa7_fefeb769","updated":"2019-06-20 08:58:03.000000000","message":"Done","commit_id":"1c7afa7bf5f6a79a275c13732dd3accf4a47ec4f"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"9ce974cebc931b9396811be7316cc9ef05cd106e","unresolved":false,"context_lines":[{"line_number":1139,"context_line":"    def _publish(self, exchange, msg, routing_key\u003dNone, timeout\u003dNone,"},{"line_number":1140,"context_line":"                 transport_options\u003dNone):"},{"line_number":1141,"context_line":"        \"\"\"Publish a message.\"\"\""},{"line_number":1142,"context_line":"        def is_mandatory(ops):"},{"line_number":1143,"context_line":"            if ops is not None:"},{"line_number":1144,"context_line":"                if isinstance(ops, dict):"},{"line_number":1145,"context_line":"                    if \"mandatory\" in ops:"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_1e714be1","line":1142,"in_reply_to":"9fb8cfa7_fefeb769","updated":"2019-06-19 09:43:36.000000000","message":"s/we extract/we can extract/","commit_id":"1c7afa7bf5f6a79a275c13732dd3accf4a47ec4f"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2122185edb13898c0aab033f7e9208f82656c67d","unresolved":false,"context_lines":[{"line_number":1140,"context_line":"                 transport_options\u003dNone):"},{"line_number":1141,"context_line":"        \"\"\"Publish a message.\"\"\""},{"line_number":1142,"context_line":"        def is_mandatory(ops):"},{"line_number":1143,"context_line":"            if ops is not None:"},{"line_number":1144,"context_line":"                if isinstance(ops, dict):"},{"line_number":1145,"context_line":"                    if \"mandatory\" in ops:"},{"line_number":1146,"context_line":"                        return ops[\"mandatory\"]"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_9e1d3bbf","line":1143,"updated":"2019-06-19 09:42:22.000000000","message":"You can avoid many tests by using something like this:\n```\ntry:\n    return ops.get(\"mandatory\", False)\nexcept AttributeError:\n    return False\n```","commit_id":"1c7afa7bf5f6a79a275c13732dd3accf4a47ec4f"},{"author":{"_account_id":29364,"name":"Gabriele Santomaggio","email":"g.santomaggio@gmail.com","username":"gsantomaggio"},"change_message_id":"2bd0bfdd2723ff9058bba6590e89a7e2346fac51","unresolved":false,"context_lines":[{"line_number":1140,"context_line":"                 transport_options\u003dNone):"},{"line_number":1141,"context_line":"        \"\"\"Publish a message.\"\"\""},{"line_number":1142,"context_line":"        def is_mandatory(ops):"},{"line_number":1143,"context_line":"            if ops is not None:"},{"line_number":1144,"context_line":"                if isinstance(ops, dict):"},{"line_number":1145,"context_line":"                    if \"mandatory\" in ops:"},{"line_number":1146,"context_line":"                        return ops[\"mandatory\"]"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_db1c0e79","line":1143,"in_reply_to":"9fb8cfa7_9e1d3bbf","updated":"2019-06-20 08:58:03.000000000","message":"Done","commit_id":"1c7afa7bf5f6a79a275c13732dd3accf4a47ec4f"}],"oslo_messaging/_utils.py":[{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"39f8f45d89a7df3f054ada2d7fcebe16d6ae6617","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    if dictionary is None:"},{"line_number":65,"context_line":"        return default"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9fb8cfa7_dbc08ee3","line":64,"updated":"2019-06-20 08:48:24.000000000","message":"You already handle this case in the try/except bellow.","commit_id":"f948ae4a5fc83f279aabbd6aafb339415879a6ca"},{"author":{"_account_id":29364,"name":"Gabriele Santomaggio","email":"g.santomaggio@gmail.com","username":"gsantomaggio"},"change_message_id":"2bd0bfdd2723ff9058bba6590e89a7e2346fac51","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    if dictionary is None:"},{"line_number":65,"context_line":"        return default"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9fb8cfa7_fb2d52a8","line":64,"in_reply_to":"9fb8cfa7_dbc08ee3","updated":"2019-06-20 08:58:03.000000000","message":"Done","commit_id":"f948ae4a5fc83f279aabbd6aafb339415879a6ca"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"9cb4441484518b3021bf922a00453b3871ba951c","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        self.release()"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    try:"},{"line_number":65,"context_line":"        return dictionary.get(key, False)"},{"line_number":66,"context_line":"    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_2ee64a18","line":63,"updated":"2019-06-20 09:22:56.000000000","message":"Maybe we can also add some tests on it on test_utils.py [1]:\n```\nassertFalse(contains(None, \"mandatory\", default\u003dFalse)) \nassertFalse(contains({\"foo\": \"bar\"}, \"mandatory\", default\u003dFalse))\nassertEqual(contains({\"mandatory\": \"mandatory\"}, \"mandatory\", default\u003dFalse), \"mandatory\")\n...\n```\n\n[1] https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/tests/test_utils.py","commit_id":"550d3d0036e82f210e2bba7facbe00b25749656c"},{"author":{"_account_id":29364,"name":"Gabriele Santomaggio","email":"g.santomaggio@gmail.com","username":"gsantomaggio"},"change_message_id":"85faf38c3b94c727ad9764616404c112f4bf2833","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        self.release()"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    try:"},{"line_number":65,"context_line":"        return dictionary.get(key, False)"},{"line_number":66,"context_line":"    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_0e29069a","line":63,"in_reply_to":"9fb8cfa7_2ee64a18","updated":"2019-06-20 09:56:13.000000000","message":"Done","commit_id":"550d3d0036e82f210e2bba7facbe00b25749656c"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"9cb4441484518b3021bf922a00453b3871ba951c","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    try:"},{"line_number":65,"context_line":"        return dictionary.get(key, False)"},{"line_number":66,"context_line":"    except AttributeError:"},{"line_number":67,"context_line":"        return default"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_ce30cea1","line":65,"range":{"start_line":65,"start_character":35,"end_line":65,"end_character":40},"updated":"2019-06-20 09:22:56.000000000","message":"You need to return `default` here too","commit_id":"550d3d0036e82f210e2bba7facbe00b25749656c"},{"author":{"_account_id":29364,"name":"Gabriele Santomaggio","email":"g.santomaggio@gmail.com","username":"gsantomaggio"},"change_message_id":"85faf38c3b94c727ad9764616404c112f4bf2833","unresolved":false,"context_lines":[{"line_number":62,"context_line":""},{"line_number":63,"context_line":"def contains(dictionary, key, default\u003dFalse):"},{"line_number":64,"context_line":"    try:"},{"line_number":65,"context_line":"        return dictionary.get(key, False)"},{"line_number":66,"context_line":"    except AttributeError:"},{"line_number":67,"context_line":"        return default"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_ae19da88","line":65,"range":{"start_line":65,"start_character":35,"end_line":65,"end_character":40},"in_reply_to":"9fb8cfa7_ce30cea1","updated":"2019-06-20 09:56:13.000000000","message":"Done","commit_id":"550d3d0036e82f210e2bba7facbe00b25749656c"}]}
