)]}'
{"oslo/config/cfg.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"bb66cef3a2f5991c74ab6d4238bace144aca9a50","unresolved":false,"context_lines":[{"line_number":1814,"context_line":"        if _is_opt_registered(self._opts, opt):"},{"line_number":1815,"context_line":"            return False"},{"line_number":1816,"context_line":""},{"line_number":1817,"context_line":"        if opt.positional:"},{"line_number":1818,"context_line":"                opt.position \u003d self._pos_counter"},{"line_number":1819,"context_line":"                self._pos_counter +\u003d 1"},{"line_number":1820,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_5f0ee4e5","line":1817,"updated":"2014-11-18 15:45:43.000000000","message":"The same Opt instance can be used in multiple groups and multiple parsers, so I don\u0027t think we want to record the position inside that object.","commit_id":"78c34e92b17c1379723aa4a504735b997390c29b"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"d45bf20a2eb762c8043ed723c47fa9a2a8ce3a75","unresolved":false,"context_lines":[{"line_number":1814,"context_line":"        if _is_opt_registered(self._opts, opt):"},{"line_number":1815,"context_line":"            return False"},{"line_number":1816,"context_line":""},{"line_number":1817,"context_line":"        if opt.positional:"},{"line_number":1818,"context_line":"                opt.position \u003d self._pos_counter"},{"line_number":1819,"context_line":"                self._pos_counter +\u003d 1"},{"line_number":1820,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_35a779be","line":1817,"in_reply_to":"5a890539_5f0ee4e5","updated":"2014-11-18 16:46:14.000000000","message":"Please, correct me if I\u0027m wrong: only cli options can be positional, they are declared once with register_cli_opts call and then they can not be changed, they have no group and used only in one script with single parser.","commit_id":"78c34e92b17c1379723aa4a504735b997390c29b"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"bb66cef3a2f5991c74ab6d4238bace144aca9a50","unresolved":false,"context_lines":[{"line_number":2285,"context_line":"        self._args \u003d args"},{"line_number":2286,"context_line":""},{"line_number":2287,"context_line":"        for opt, group in sorted(self._all_cli_opts(),"},{"line_number":2288,"context_line":"                                 key\u003dlambda x: (x[0].position, x[0].name)):"},{"line_number":2289,"context_line":"            opt._add_to_cli(self._oparser, group)"},{"line_number":2290,"context_line":""},{"line_number":2291,"context_line":"        return self._parse_config_files()"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_5f25045a","line":2288,"updated":"2014-11-18 15:45:43.000000000","message":"Why not just remove the sorted() call here?","commit_id":"78c34e92b17c1379723aa4a504735b997390c29b"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"d45bf20a2eb762c8043ed723c47fa9a2a8ce3a75","unresolved":false,"context_lines":[{"line_number":2285,"context_line":"        self._args \u003d args"},{"line_number":2286,"context_line":""},{"line_number":2287,"context_line":"        for opt, group in sorted(self._all_cli_opts(),"},{"line_number":2288,"context_line":"                                 key\u003dlambda x: (x[0].position, x[0].name)):"},{"line_number":2289,"context_line":"            opt._add_to_cli(self._oparser, group)"},{"line_number":2290,"context_line":""},{"line_number":2291,"context_line":"        return self._parse_config_files()"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a890539_5556c506","line":2288,"in_reply_to":"5a890539_5f25045a","updated":"2014-11-18 16:46:14.000000000","message":"The problem is we put all opts in dictionary (self._opts) which doesn\u0027t support ordering. It leads to the fact that we can\u0027t reproduce the original order of arguments.\nSo we can easily remove sorting by name, but we have to keep the position ordering.","commit_id":"78c34e92b17c1379723aa4a504735b997390c29b"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"88e23076bb69725da5c6f3cd9afef8b44d5837d3","unresolved":false,"context_lines":[{"line_number":1579,"context_line":"            index \u003d 0"},{"line_number":1580,"context_line":"            for argument in values:"},{"line_number":1581,"context_line":"                if not argument[\u0027args\u0027][0].startswith(\u0027--\u0027):"},{"line_number":1582,"context_line":"                    index \u003d values.index(argument)"},{"line_number":1583,"context_line":"                    break"},{"line_number":1584,"context_line":"            values[:index] \u003d sorted(values[:index], key\u003dlambda x: x[\u0027args\u0027])"},{"line_number":1585,"context_line":"            for argument in values:"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_e342c866","line":1582,"updated":"2014-11-25 13:57:32.000000000","message":"If you change this loop to\n\n  for index, argument in enumerate(values):\n\nthen you won\u0027t have to search for argument to find its index. That turns this O(n^2) loop back into an O(n) loop.","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"b05778cd67178c76062e0b6dcd4a073729069d81","unresolved":false,"context_lines":[{"line_number":1579,"context_line":"            index \u003d 0"},{"line_number":1580,"context_line":"            for argument in values:"},{"line_number":1581,"context_line":"                if not argument[\u0027args\u0027][0].startswith(\u0027--\u0027):"},{"line_number":1582,"context_line":"                    index \u003d values.index(argument)"},{"line_number":1583,"context_line":"                    break"},{"line_number":1584,"context_line":"            values[:index] \u003d sorted(values[:index], key\u003dlambda x: x[\u0027args\u0027])"},{"line_number":1585,"context_line":"            for argument in values:"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_85181f1f","line":1582,"in_reply_to":"5a890539_e342c866","updated":"2014-11-25 17:31:17.000000000","message":"Done","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"88e23076bb69725da5c6f3cd9afef8b44d5837d3","unresolved":false,"context_lines":[{"line_number":1839,"context_line":"        if self._args is not None:"},{"line_number":1840,"context_line":"            raise ArgsAlreadyParsedError(\"cannot register CLI option\")"},{"line_number":1841,"context_line":""},{"line_number":1842,"context_line":"        if opt.positional:"},{"line_number":1843,"context_line":"            self._positional_order.append(opt.dest)"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"        return self.register_opt(opt, group, cli\u003dTrue, clear_cache\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_86167247","line":1842,"updated":"2014-11-25 13:57:32.000000000","message":"I suggested moving there here on IRC, but now I think you were right about doing it in register_opt() when the cli argument is True.","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"b05778cd67178c76062e0b6dcd4a073729069d81","unresolved":false,"context_lines":[{"line_number":1839,"context_line":"        if self._args is not None:"},{"line_number":1840,"context_line":"            raise ArgsAlreadyParsedError(\"cannot register CLI option\")"},{"line_number":1841,"context_line":""},{"line_number":1842,"context_line":"        if opt.positional:"},{"line_number":1843,"context_line":"            self._positional_order.append(opt.dest)"},{"line_number":1844,"context_line":""},{"line_number":1845,"context_line":"        return self.register_opt(opt, group, cli\u003dTrue, clear_cache\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_a5135bff","line":1842,"in_reply_to":"5a890539_86167247","updated":"2014-11-25 17:31:17.000000000","message":"Done","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"88e23076bb69725da5c6f3cd9afef8b44d5837d3","unresolved":false,"context_lines":[{"line_number":2292,"context_line":""},{"line_number":2293,"context_line":"        self._args \u003d args"},{"line_number":2294,"context_line":"        for opt, group in sorted(self._all_cli_opts(),"},{"line_number":2295,"context_line":"                                 key\u003dopts_sort):"},{"line_number":2296,"context_line":"            opt._add_to_cli(self._oparser, group)"},{"line_number":2297,"context_line":""},{"line_number":2298,"context_line":"        return self._parse_config_files()"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_03b8b473","line":2295,"updated":"2014-11-25 13:57:32.000000000","message":"Now that self._positional_order is a single list of all of the command line options in order, you could change _all_cli_opts() to use that list to yield the values in the right order. That would let you drop the sort here entirely, instead of building a sort function that reorders the options.","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"b05778cd67178c76062e0b6dcd4a073729069d81","unresolved":false,"context_lines":[{"line_number":2292,"context_line":""},{"line_number":2293,"context_line":"        self._args \u003d args"},{"line_number":2294,"context_line":"        for opt, group in sorted(self._all_cli_opts(),"},{"line_number":2295,"context_line":"                                 key\u003dopts_sort):"},{"line_number":2296,"context_line":"            opt._add_to_cli(self._oparser, group)"},{"line_number":2297,"context_line":""},{"line_number":2298,"context_line":"        return self._parse_config_files()"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a890539_e5d80355","line":2295,"in_reply_to":"5a890539_03b8b473","updated":"2014-11-25 17:31:17.000000000","message":"Done","commit_id":"66e0b2e1dd99eda4900bb0f0a440be6438dd8b66"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"311744d17705fc5eb8a19be6a6d2e76e72ce6f5e","unresolved":false,"context_lines":[{"line_number":1578,"context_line":"        for container, values in six.iteritems(self._args_cache):"},{"line_number":1579,"context_line":"            index \u003d 0"},{"line_number":1580,"context_line":"            for index, argument in enumerate(values):"},{"line_number":1581,"context_line":"                if not argument[\u0027args\u0027][0].startswith(\u0027--\u0027):"},{"line_number":1582,"context_line":"                    break"},{"line_number":1583,"context_line":"            values[:index] \u003d sorted(values[:index], key\u003dlambda x: x[\u0027args\u0027])"},{"line_number":1584,"context_line":"            for argument in values:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a890539_ec0c5a44","line":1581,"updated":"2014-12-04 17:09:02.000000000","message":"It looks like we do support short opts for cli opts too, so I think this should be startswith(\u0027-\u0027).  That should cover both cases.\n\nReference: https://github.com/openstack/oslo.config/blob/master/oslo/config/cfg.py#L761","commit_id":"12afdd0b2cbaf96518be781358406194a78dc5f2"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"0d61369f28df71e5b0391b51b382b766f8101fc7","unresolved":false,"context_lines":[{"line_number":1578,"context_line":"        for container, values in six.iteritems(self._args_cache):"},{"line_number":1579,"context_line":"            index \u003d 0"},{"line_number":1580,"context_line":"            for index, argument in enumerate(values):"},{"line_number":1581,"context_line":"                if not argument[\u0027args\u0027][0].startswith(\u0027--\u0027):"},{"line_number":1582,"context_line":"                    break"},{"line_number":1583,"context_line":"            values[:index] \u003d sorted(values[:index], key\u003dlambda x: x[\u0027args\u0027])"},{"line_number":1584,"context_line":"            for argument in values:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a890539_07226100","line":1581,"in_reply_to":"5a890539_ec0c5a44","updated":"2014-12-04 17:17:57.000000000","message":"Done","commit_id":"12afdd0b2cbaf96518be781358406194a78dc5f2"}]}
