)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"a9b85c5a73ca6d77b229d20ccaab60569bb8498a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"5aefa9c8_38233632","updated":"2022-07-29 17:29:22.000000000","message":"Looks good. Thanks!","commit_id":"e1cbe84fa0b80086a999fdcf5d76621221356308"}],"ovsdbapp/schema/ovn_northbound/commands.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"dee8c03131434df45858a58b75776f489850837c","unresolved":true,"context_lines":[{"line_number":1018,"context_line":"    def __init__(self, api, port, networks):"},{"line_number":1019,"context_line":"        super().__init__(api)"},{"line_number":1020,"context_line":"        self.port \u003d port"},{"line_number":1021,"context_line":"        if isinstance(networks, (str, bytes)):"},{"line_number":1022,"context_line":"            networks \u003d [networks]"},{"line_number":1023,"context_line":"        self.networks \u003d [str(netaddr.IPNetwork(network))"},{"line_number":1024,"context_line":"                         for network in networks]"}],"source_content_type":"text/x-python","patch_set":4,"id":"50ae7e6a_b20d9108","line":1021,"range":{"start_line":1021,"start_character":8,"end_line":1021,"end_character":46},"updated":"2022-07-12 11:35:09.000000000","message":"Instead of this, I would check if the parameter is iterable or not:\n\nfrom collections import abc\n\nif isinstance(networks, abc.Iterable):\n  networks \u003d list(networks)  # networks could be a set or a tuple, for example\nelse:\n  networks \u003d [networks]","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":33871,"name":"Anton Vazhnetsov","display_name":"Anton Vazhnetsov","email":"dragen15051@gmail.com","username":"0x5b"},"change_message_id":"c54a23af1487728595ba9aa89af521657c810c2a","unresolved":true,"context_lines":[{"line_number":1018,"context_line":"    def __init__(self, api, port, networks):"},{"line_number":1019,"context_line":"        super().__init__(api)"},{"line_number":1020,"context_line":"        self.port \u003d port"},{"line_number":1021,"context_line":"        if isinstance(networks, (str, bytes)):"},{"line_number":1022,"context_line":"            networks \u003d [networks]"},{"line_number":1023,"context_line":"        self.networks \u003d [str(netaddr.IPNetwork(network))"},{"line_number":1024,"context_line":"                         for network in networks]"}],"source_content_type":"text/x-python","patch_set":4,"id":"f77d6d60_23514c6f","line":1021,"range":{"start_line":1021,"start_character":8,"end_line":1021,"end_character":46},"in_reply_to":"3e544011_92b3d3cb","updated":"2022-07-12 15:56:44.000000000","message":"I just wanted to ease the usage in case of single network, same as: https://opendev.org/openstack/ovsdbapp/src/branch/master/ovsdbapp/schema/ovn_northbound/commands.py#L279 . Other iterable types (set, tuple...) are converted into list via comprehension, other types will result in an error.","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":33871,"name":"Anton Vazhnetsov","display_name":"Anton Vazhnetsov","email":"dragen15051@gmail.com","username":"0x5b"},"change_message_id":"7689f338aa5225d79e88b284dd8a52847cddf848","unresolved":true,"context_lines":[{"line_number":1018,"context_line":"    def __init__(self, api, port, networks):"},{"line_number":1019,"context_line":"        super().__init__(api)"},{"line_number":1020,"context_line":"        self.port \u003d port"},{"line_number":1021,"context_line":"        if isinstance(networks, (str, bytes)):"},{"line_number":1022,"context_line":"            networks \u003d [networks]"},{"line_number":1023,"context_line":"        self.networks \u003d [str(netaddr.IPNetwork(network))"},{"line_number":1024,"context_line":"                         for network in networks]"}],"source_content_type":"text/x-python","patch_set":4,"id":"5e0682a8_c4bfc9fb","line":1021,"range":{"start_line":1021,"start_character":8,"end_line":1021,"end_character":46},"in_reply_to":"50ae7e6a_b20d9108","updated":"2022-07-12 15:00:14.000000000","message":"\u0027str\u0027 and \u0027bytes\u0027 are iterables too, so we can not use such instance check","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"041d20ab2eeeb106f6a5d0679be480691bc01472","unresolved":true,"context_lines":[{"line_number":1018,"context_line":"    def __init__(self, api, port, networks):"},{"line_number":1019,"context_line":"        super().__init__(api)"},{"line_number":1020,"context_line":"        self.port \u003d port"},{"line_number":1021,"context_line":"        if isinstance(networks, (str, bytes)):"},{"line_number":1022,"context_line":"            networks \u003d [networks]"},{"line_number":1023,"context_line":"        self.networks \u003d [str(netaddr.IPNetwork(network))"},{"line_number":1024,"context_line":"                         for network in networks]"}],"source_content_type":"text/x-python","patch_set":4,"id":"3e544011_92b3d3cb","line":1021,"range":{"start_line":1021,"start_character":8,"end_line":1021,"end_character":46},"in_reply_to":"5e0682a8_c4bfc9fb","updated":"2022-07-12 15:11:06.000000000","message":"right! maybe you can check if a is list, set or tuple. But I think this check (str, bytes) is not enough. Is it possible that networks is netaddr.IPNetwork?","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":33871,"name":"Anton Vazhnetsov","display_name":"Anton Vazhnetsov","email":"dragen15051@gmail.com","username":"0x5b"},"change_message_id":"a2849b6b03a6e7aa48d751a1e678cc0997f586e5","unresolved":false,"context_lines":[{"line_number":1018,"context_line":"    def __init__(self, api, port, networks):"},{"line_number":1019,"context_line":"        super().__init__(api)"},{"line_number":1020,"context_line":"        self.port \u003d port"},{"line_number":1021,"context_line":"        if isinstance(networks, (str, bytes)):"},{"line_number":1022,"context_line":"            networks \u003d [networks]"},{"line_number":1023,"context_line":"        self.networks \u003d [str(netaddr.IPNetwork(network))"},{"line_number":1024,"context_line":"                         for network in networks]"}],"source_content_type":"text/x-python","patch_set":4,"id":"a6325c21_2ecb631e","line":1021,"range":{"start_line":1021,"start_character":8,"end_line":1021,"end_character":46},"in_reply_to":"f77d6d60_23514c6f","updated":"2022-07-13 09:38:29.000000000","message":"Done","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"dee8c03131434df45858a58b75776f489850837c","unresolved":true,"context_lines":[{"line_number":1028,"context_line":"    def run_idl(self, txn):"},{"line_number":1029,"context_line":"        lrp \u003d self.api.lookup(self.table, self.port)"},{"line_number":1030,"context_line":"        for network in self.networks:"},{"line_number":1031,"context_line":"            lrp.addvalue(\u0027networks\u0027, network)"},{"line_number":1032,"context_line":""},{"line_number":1033,"context_line":""},{"line_number":1034,"context_line":"class LrpDelNetworksCommand(_LrpNetworksCommand):"}],"source_content_type":"text/x-python","patch_set":4,"id":"a5db7870_0239b797","line":1031,"range":{"start_line":1031,"start_character":12,"end_line":1031,"end_character":45},"updated":"2022-07-12 11:35:09.000000000","message":"You should check if this network is already present in the LRP.","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":33871,"name":"Anton Vazhnetsov","display_name":"Anton Vazhnetsov","email":"dragen15051@gmail.com","username":"0x5b"},"change_message_id":"5023dd359b2dd37e419fd8437e25d200a6227441","unresolved":false,"context_lines":[{"line_number":1028,"context_line":"    def run_idl(self, txn):"},{"line_number":1029,"context_line":"        lrp \u003d self.api.lookup(self.table, self.port)"},{"line_number":1030,"context_line":"        for network in self.networks:"},{"line_number":1031,"context_line":"            lrp.addvalue(\u0027networks\u0027, network)"},{"line_number":1032,"context_line":""},{"line_number":1033,"context_line":""},{"line_number":1034,"context_line":"class LrpDelNetworksCommand(_LrpNetworksCommand):"}],"source_content_type":"text/x-python","patch_set":4,"id":"67a065c8_949ca1b6","line":1031,"range":{"start_line":1031,"start_character":12,"end_line":1031,"end_character":45},"in_reply_to":"a5db7870_0239b797","updated":"2022-07-12 15:58:22.000000000","message":"Done","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"dee8c03131434df45858a58b75776f489850837c","unresolved":true,"context_lines":[{"line_number":1035,"context_line":"    def run_idl(self, txn):"},{"line_number":1036,"context_line":"        lrp \u003d self.api.lookup(self.table, self.port)"},{"line_number":1037,"context_line":"        for network in self.networks:"},{"line_number":1038,"context_line":"            lrp.delvalue(\u0027networks\u0027, network)"},{"line_number":1039,"context_line":""},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"class LrRouteAddCommand(cmd.BaseCommand):"}],"source_content_type":"text/x-python","patch_set":4,"id":"ca737be6_d5daee6b","line":1038,"range":{"start_line":1038,"start_character":12,"end_line":1038,"end_character":45},"updated":"2022-07-12 11:35:09.000000000","message":"You should check if this network is present first. If not, raise an exception or print an error.","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"},{"author":{"_account_id":33871,"name":"Anton Vazhnetsov","display_name":"Anton Vazhnetsov","email":"dragen15051@gmail.com","username":"0x5b"},"change_message_id":"5023dd359b2dd37e419fd8437e25d200a6227441","unresolved":false,"context_lines":[{"line_number":1035,"context_line":"    def run_idl(self, txn):"},{"line_number":1036,"context_line":"        lrp \u003d self.api.lookup(self.table, self.port)"},{"line_number":1037,"context_line":"        for network in self.networks:"},{"line_number":1038,"context_line":"            lrp.delvalue(\u0027networks\u0027, network)"},{"line_number":1039,"context_line":""},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"class LrRouteAddCommand(cmd.BaseCommand):"}],"source_content_type":"text/x-python","patch_set":4,"id":"78c0ca6e_ee46e8e2","line":1038,"range":{"start_line":1038,"start_character":12,"end_line":1038,"end_character":45},"in_reply_to":"ca737be6_d5daee6b","updated":"2022-07-12 15:58:22.000000000","message":"Done","commit_id":"a3c5c4fea5ff9bf49fd139ee2219a1ea5be777a6"}]}
