)]}'
{"nova/scheduler/filters/compute_capabilities_filter.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"d40e64b38e5f10b05ee1accfd46333ca833e4b4f","unresolved":false,"context_lines":[{"line_number":46,"context_line":"                if cap is None:"},{"line_number":47,"context_line":"                    return False"},{"line_number":48,"context_line":"            if isinstance(cap, int):"},{"line_number":49,"context_line":"                cap \u003d str(cap)"},{"line_number":50,"context_line":"            if not extra_specs_ops.match(cap, req):"},{"line_number":51,"context_line":"                return False"},{"line_number":52,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2Frbg%3D","line":49,"updated":"2013-06-12 22:25:41.000000000","message":"I would rather this just unconditionally converts cap to a string.  Calling str() on something that\u0027s already a string will do nothing (just returns the string), and calling str() on anything else will convert it to a string, so there\u0027s no need for the conditional.\n\nThat also lets you fold this into the if below, which would become:\n\n    if not extra_specs_ops.match(str(cap), req):\n        return False","commit_id":"852c939f45771a6f36053d039f9b702c2705bad1"},{"author":{"_account_id":7138,"name":"David Jia","email":"jiataotj@cn.ibm.com","username":"jiataotj"},"change_message_id":"b6962290f4be8fce29449fa46d56ed2c4a2bfcf0","unresolved":false,"context_lines":[{"line_number":46,"context_line":"                if cap is None:"},{"line_number":47,"context_line":"                    return False"},{"line_number":48,"context_line":"            if isinstance(cap, int):"},{"line_number":49,"context_line":"                cap \u003d str(cap)"},{"line_number":50,"context_line":"            if not extra_specs_ops.match(cap, req):"},{"line_number":51,"context_line":"                return False"},{"line_number":52,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2FoBw%3D","line":49,"in_reply_to":"AAAAPX%2F%2Frbg%3D","updated":"2013-06-14 02:33:59.000000000","message":"yes, I know that we can use your code, but I\u0027d like to explain why I use the conditional. Because str() causes ascii encoding error when it converts unicode string, I\u0027m not sure that all user know how to assign right arguments for the API, in case, user may assign unicode string, I add the conditional to avoid the exception which can break the program. I may meet trouble halfway, I\u0027ll remove the conditional.","commit_id":"852c939f45771a6f36053d039f9b702c2705bad1"}],"nova/tests/scheduler/test_host_filters.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"d40e64b38e5f10b05ee1accfd46333ca833e4b4f","unresolved":false,"context_lines":[{"line_number":706,"context_line":""},{"line_number":707,"context_line":"    def _do_test_compute_filter_extra_specs(self, ecaps, especs, passes):"},{"line_number":708,"context_line":"        \"\"\"In real Openstack runtime environment,compute capabilities"},{"line_number":709,"context_line":"           value may be number, so we should use number to do unit test\"\"\""},{"line_number":710,"context_line":"        self._stub_service_is_up(True)"},{"line_number":711,"context_line":"        filt_cls \u003d self.class_map[\u0027ComputeCapabilitiesFilter\u0027]()"},{"line_number":712,"context_line":"        capabilities \u003d {\u0027enabled\u0027: True}"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2FrbY%3D","line":709,"updated":"2013-06-12 22:25:41.000000000","message":"I would just drop the docstring altogether.  If you keep it, please reformat it as follows:\n\n    \"\"\"In real Openstack runtime environment, compute capabilities\n    value may be number, so we should use number to do unit test.\n    \"\"\"\n\nNote specifically the addition of a space after the first comma, the change in indentation on the second line, the addition of a period at the end of the sentence, and the move of the closing triple-quote to a line by itself.","commit_id":"852c939f45771a6f36053d039f9b702c2705bad1"},{"author":{"_account_id":7138,"name":"David Jia","email":"jiataotj@cn.ibm.com","username":"jiataotj"},"change_message_id":"b6962290f4be8fce29449fa46d56ed2c4a2bfcf0","unresolved":false,"context_lines":[{"line_number":706,"context_line":""},{"line_number":707,"context_line":"    def _do_test_compute_filter_extra_specs(self, ecaps, especs, passes):"},{"line_number":708,"context_line":"        \"\"\"In real Openstack runtime environment,compute capabilities"},{"line_number":709,"context_line":"           value may be number, so we should use number to do unit test\"\"\""},{"line_number":710,"context_line":"        self._stub_service_is_up(True)"},{"line_number":711,"context_line":"        filt_cls \u003d self.class_map[\u0027ComputeCapabilitiesFilter\u0027]()"},{"line_number":712,"context_line":"        capabilities \u003d {\u0027enabled\u0027: True}"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPX%2F%2FoCY%3D","line":709,"in_reply_to":"AAAAPX%2F%2FrbY%3D","updated":"2013-06-14 02:33:59.000000000","message":"thanks, I\u0027ll change the doc follow your comments","commit_id":"852c939f45771a6f36053d039f9b702c2705bad1"}]}
