)]}'
{"ovsdbapp/schema/ovn_northbound/commands.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"9e828ac492df039dcdde3e4d2f7f1fc66ac14af5","unresolved":false,"context_lines":[{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def run_idl(self, txn):"},{"line_number":249,"context_line":"        ls \u003d self.api.lookup(\u0027Logical_Switch\u0027, self.switch)"},{"line_number":250,"context_line":"        try:"},{"line_number":251,"context_line":"            qos_rule \u003d next(iter(r for r in ls.qos_rules if self.qos_match(r)))"},{"line_number":252,"context_line":"            if self.may_exist:"},{"line_number":253,"context_line":"                self.result \u003d rowview.RowView(qos_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_4ddcf317","line":250,"updated":"2020-04-07 17:36:13.000000000","message":"Instead of controlling the code with exceptions, maybe you can use directly the iterator:\n\nfor qos_rule in iter(...):\n  if self.may_exist:\n  ...","commit_id":"81396283ac81cb03dd0961f1131a6af070fd5d08"},{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"451cfb6465494344f12c023b0be61c10d83b4f2c","unresolved":false,"context_lines":[{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def run_idl(self, txn):"},{"line_number":249,"context_line":"        ls \u003d self.api.lookup(\u0027Logical_Switch\u0027, self.switch)"},{"line_number":250,"context_line":"        try:"},{"line_number":251,"context_line":"            qos_rule \u003d next(iter(r for r in ls.qos_rules if self.qos_match(r)))"},{"line_number":252,"context_line":"            if self.may_exist:"},{"line_number":253,"context_line":"                self.result \u003d rowview.RowView(qos_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_dbdefdd8","line":250,"in_reply_to":"df33271e_4ddcf317","updated":"2020-04-07 19:07:36.000000000","message":"I\u0027m not sure I understand why one would want to not use Exceptions. EAFP is the Python Way :) https://docs.python.org/3/glossary.html#term-eafp\n\nAlso, no reason to check self.may_exist on every iteration. I could pass a default\u003dNone to next() and then check if qos_rule:, but that would violate EAFP.","commit_id":"81396283ac81cb03dd0961f1131a6af070fd5d08"},{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"a3114baf02f5a867542932e4baef4a63e98fe341","unresolved":false,"context_lines":[{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def run_idl(self, txn):"},{"line_number":249,"context_line":"        ls \u003d self.api.lookup(\u0027Logical_Switch\u0027, self.switch)"},{"line_number":250,"context_line":"        try:"},{"line_number":251,"context_line":"            qos_rule \u003d next(iter(r for r in ls.qos_rules if self.qos_match(r)))"},{"line_number":252,"context_line":"            if self.may_exist:"},{"line_number":253,"context_line":"                self.result \u003d rowview.RowView(qos_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_d6ea54d6","line":250,"in_reply_to":"df33271e_dbdefdd8","updated":"2020-04-07 19:37:08.000000000","message":"Just realized that self.may_exist check would only happen once since the check was in the iter(). So yeah, doing the for loop would be fine--no having to ask forgiveness at all by returning on first match. My bad!","commit_id":"81396283ac81cb03dd0961f1131a6af070fd5d08"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"5e8117b2f0aca7bbf25ee09c52014eaf617320e9","unresolved":false,"context_lines":[{"line_number":247,"context_line":""},{"line_number":248,"context_line":"    def run_idl(self, txn):"},{"line_number":249,"context_line":"        ls \u003d self.api.lookup(\u0027Logical_Switch\u0027, self.switch)"},{"line_number":250,"context_line":"        try:"},{"line_number":251,"context_line":"            qos_rule \u003d next(iter(r for r in ls.qos_rules if self.qos_match(r)))"},{"line_number":252,"context_line":"            if self.may_exist:"},{"line_number":253,"context_line":"                self.result \u003d rowview.RowView(qos_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_360460c6","line":250,"in_reply_to":"df33271e_dbdefdd8","updated":"2020-04-07 19:34:35.000000000","message":"hehehe I know, exceptions are \"cheap\" in Python, that was just a suggestion. The code is OK.\n\nYes, the \"self.may_exist\" was unintentional, just to represent the following code","commit_id":"81396283ac81cb03dd0961f1131a6af070fd5d08"}]}
