)]}'
{"ironic/drivers/modules/drac/management.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"c3f166b4b36f9bfba6c8571d1531f9cc9b61f3a9","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa69d971_c0eafb73","line":260,"updated":"2016-01-05 17:09:01.000000000","message":"nit: even simpler:\n\n try:\n   return node.driver_internal_info[..]\n except KeyError:\n   return _get_boot_device(node)","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":7419,"name":"Imre Farkas","email":"farkas.imre@gmail.com","username":"ifarkas"},"change_message_id":"8869085e780b789d6b667f8712b7303d5a25f470","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_23969993","line":260,"in_reply_to":"5a5ae5dd_1a4d283e","updated":"2016-02-05 09:42:55.000000000","message":"I don\u0027t think it is implemented like that. Catching exception is pretty expensive operation. While it doesn\u0027t really matter from conductor point of view, it would be a poor choice in a standard library.","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":7419,"name":"Imre Farkas","email":"farkas.imre@gmail.com","username":"ifarkas"},"change_message_id":"b18f4e29599b4043a3e0441fa7f48adc520cce1e","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_66a9fe8f","line":260,"in_reply_to":"5a5ae5dd_23969993","updated":"2016-02-05 10:14:43.000000000","message":"So this is an interesting question you brought up, I think I found the code in question: https://hg.python.org/cpython/file/52f68c95e025/Objects/dictobject.c#l1777","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"08386eff388b5849c11f9ae845db982a6b89399d","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_1a4d283e","line":260,"in_reply_to":"5a5ae5dd_4643cc42","updated":"2016-02-04 15:47:05.000000000","message":"not sure what you mean by overusing exceptions, the get() call above it likely to work like I\u0027ve described internally","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"757a5fe791e3f97258aa84b5df7f4ebccdb28021","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_cdfb1d7a","line":260,"in_reply_to":"5a5ae5dd_66a9fe8f","updated":"2016-02-05 17:07:18.000000000","message":"Yeah, as you see both get and contains use lookup internally... actually exceptions are not very expensive and python, and catching an exception is a question of checking if result \u003d\u003d NULL.","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":7419,"name":"Imre Farkas","email":"farkas.imre@gmail.com","username":"ifarkas"},"change_message_id":"1bb6ad4d515d84df969372941e73e235fa5a9af8","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        if boot_device is not None:"},{"line_number":258,"context_line":"            return boot_device"},{"line_number":259,"context_line":""},{"line_number":260,"context_line":"        return _get_boot_device(node)"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"    @task_manager.require_exclusive_lock"},{"line_number":263,"context_line":"    def set_boot_device(self, task, device, persistent\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_4643cc42","line":260,"in_reply_to":"fa69d971_c0eafb73","updated":"2016-02-04 15:45:39.000000000","message":"hmmm, I still prefer the original one and not overusing exceptions...","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"}],"ironic/drivers/modules/drac/power.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"c3f166b4b36f9bfba6c8571d1531f9cc9b61f3a9","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    driver_internal_info \u003d node.driver_internal_info"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    boot_device \u003d node.driver_internal_info.get(\u0027drac_boot_device\u0027)"},{"line_number":70,"context_line":"    if boot_device is not None:"},{"line_number":71,"context_line":"        drac_management.set_boot_device(node, boot_device[\u0027boot_device\u0027],"},{"line_number":72,"context_line":"                                        boot_device[\u0027persistent\u0027])"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"fa69d971_a0e587a4","line":70,"updated":"2016-01-05 17:09:01.000000000","message":"nit: let\u0027s exit early to reduce indentation:\n\n if boot_device is None:\n   return","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"},{"author":{"_account_id":7419,"name":"Imre Farkas","email":"farkas.imre@gmail.com","username":"ifarkas"},"change_message_id":"1bb6ad4d515d84df969372941e73e235fa5a9af8","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    driver_internal_info \u003d node.driver_internal_info"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    boot_device \u003d node.driver_internal_info.get(\u0027drac_boot_device\u0027)"},{"line_number":70,"context_line":"    if boot_device is not None:"},{"line_number":71,"context_line":"        drac_management.set_boot_device(node, boot_device[\u0027boot_device\u0027],"},{"line_number":72,"context_line":"                                        boot_device[\u0027persistent\u0027])"},{"line_number":73,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_abd5a9b9","line":70,"in_reply_to":"fa69d971_a0e587a4","updated":"2016-02-04 15:45:39.000000000","message":"Done","commit_id":"72f64cce2b0879c43cd582107d1347d65ee63f9c"}]}
