)]}'
{"keystone/manage2/__init__.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"0246ffe38883d8a58f961966136b3531f36897e2","unresolved":false,"context_lines":[{"line_number":18,"context_line":""},{"line_number":19,"context_line":"def load_module(module_name):"},{"line_number":20,"context_line":"    \"\"\"Effectively imports a module given the module name\"\"\""},{"line_number":21,"context_line":"    # TODO(dolph): there\u0027s probably a way to do this without a loop"},{"line_number":22,"context_line":"    for module_loader, name, is_package in MODULES:"},{"line_number":23,"context_line":"        if name \u003d\u003d module_name:"},{"line_number":24,"context_line":"            loader \u003d module_loader.find_module(name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAC3%2F%2F7Bo%3D","line":21,"updated":"2011-12-22 17:51:22.000000000","message":"Here\u0027s a loopless version that also raises an exception with information rather than just a plain assertion failure.\n\ntry:\n    module_loader, name, is_package \u003d [md for md in MODULES\n            if md[1] \u003d\u003d module_name][0]\nexcept IndexError:\n    raise ValueError(\"No module found named \u0027%s\u0027\" % module_name)\nloader \u003d module_loader.find_module(name)\nmodule \u003d loader.load_module(name)\nreturn module","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"44f93f8d8e4b5595ed8d51902a0fc400032186a2","unresolved":false,"context_lines":[{"line_number":18,"context_line":""},{"line_number":19,"context_line":"def load_module(module_name):"},{"line_number":20,"context_line":"    \"\"\"Effectively imports a module given the module name\"\"\""},{"line_number":21,"context_line":"    # TODO(dolph): there\u0027s probably a way to do this without a loop"},{"line_number":22,"context_line":"    for module_loader, name, is_package in MODULES:"},{"line_number":23,"context_line":"        if name \u003d\u003d module_name:"},{"line_number":24,"context_line":"            loader \u003d module_loader.find_module(name)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2FAM%3D","line":21,"in_reply_to":"AAAAC3%2F%2F7Bo%3D","updated":"2012-01-03 20:25:30.000000000","message":"I wouldn\u0027t call that loopless ;) but it\u0027s definitely cleaner.","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"0246ffe38883d8a58f961966136b3531f36897e2","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    module_names.sort()"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    # we need the name of the command before hitting argparse"},{"line_number":39,"context_line":"    command \u003d None"},{"line_number":40,"context_line":"    i \u003d 0"},{"line_number":41,"context_line":"    for arg in sys.argv:"},{"line_number":42,"context_line":"        if arg in module_names:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAC3%2F%2F7Bk%3D","line":39,"updated":"2011-12-22 17:51:22.000000000","message":"Use enumerate() for this sort of iteration:\n\nfor pos, arg in enumerate(sys.argv):\n    if arg in module_names:\n        command \u003d sys.argv.pop(pos)\n        break","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"44f93f8d8e4b5595ed8d51902a0fc400032186a2","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    module_names.sort()"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    # we need the name of the command before hitting argparse"},{"line_number":39,"context_line":"    command \u003d None"},{"line_number":40,"context_line":"    i \u003d 0"},{"line_number":41,"context_line":"    for arg in sys.argv:"},{"line_number":42,"context_line":"        if arg in module_names:"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2FAI%3D","line":39,"in_reply_to":"AAAAC3%2F%2F7Bk%3D","updated":"2012-01-03 20:25:30.000000000","message":"Done","commit_id":"f462608072df101460f886f2b58d9028c108a671"}],"keystone/test/unit/test_buffout.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"0246ffe38883d8a58f961966136b3531f36897e2","unresolved":false,"context_lines":[{"line_number":5,"context_line":""},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"class TestStdoutIdentity(unittest.TestCase):"},{"line_number":8,"context_line":"    \"\"\"Tests buffout\u0027s manipulation of the stdout pointer\"\"\""},{"line_number":9,"context_line":"    def test_stdout_after_init(self):"},{"line_number":10,"context_line":"        stdout \u003d sys.stdout"},{"line_number":11,"context_line":"        buffout.OutputBuffer()"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAC3%2F%2F7A8%3D","line":8,"updated":"2011-12-22 17:51:22.000000000","message":"Could this be simplified/sped up with a single method instead of the three separate methods? E.g.:\n\n    def test_stdout(self):\n        stdout \u003d sys.stdout\n        ob \u003d buffout.OutputBuffer()\n        self.assertTrue(sys.stdout is stdout,\n                \"sys.stdout was replaced\")\n        ob.start()\n        self.assertTrue(sys.stdout is not stdout,\n                \"sys.stdout not replaced\")\n        ob.stop()\n        self.assertTrue(sys.stdout is stdout,\n                \"sys.stdout not restored\")","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"44f93f8d8e4b5595ed8d51902a0fc400032186a2","unresolved":false,"context_lines":[{"line_number":5,"context_line":""},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"class TestStdoutIdentity(unittest.TestCase):"},{"line_number":8,"context_line":"    \"\"\"Tests buffout\u0027s manipulation of the stdout pointer\"\"\""},{"line_number":9,"context_line":"    def test_stdout_after_init(self):"},{"line_number":10,"context_line":"        stdout \u003d sys.stdout"},{"line_number":11,"context_line":"        buffout.OutputBuffer()"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2B%2FU%3D","line":8,"in_reply_to":"AAAAC3%2F%2F7A8%3D","updated":"2012-01-03 20:25:30.000000000","message":"That\u0027s how I wrote it at first, and then expanded it... I don\u0027t have a preference between the two.","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"49946be30d718f0b30ef77652aa164dba52675d4","unresolved":false,"context_lines":[{"line_number":5,"context_line":""},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"class TestStdoutIdentity(unittest.TestCase):"},{"line_number":8,"context_line":"    \"\"\"Tests buffout\u0027s manipulation of the stdout pointer\"\"\""},{"line_number":9,"context_line":"    def test_stdout_after_init(self):"},{"line_number":10,"context_line":"        stdout \u003d sys.stdout"},{"line_number":11,"context_line":"        buffout.OutputBuffer()"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2B1k%3D","line":8,"in_reply_to":"AAAADH%2F%2F%2B%2FU%3D","updated":"2012-01-03 21:18:36.000000000","message":"It just seems like running setUp/tearDown 3 times instead of one would be slower. But it\u0027s really NBD.","commit_id":"f462608072df101460f886f2b58d9028c108a671"}],"keystone/tools/buffout.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"0246ffe38883d8a58f961966136b3531f36897e2","unresolved":false,"context_lines":[{"line_number":13,"context_line":""},{"line_number":14,"context_line":"        self.buffering \u003d True"},{"line_number":15,"context_line":"        self.old_stdout \u003d sys.stdout"},{"line_number":16,"context_line":"        sys.stdout \u003d StringIO.StringIO()"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"    def read(self):"},{"line_number":19,"context_line":"        \"\"\"Read the current buffer\"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAC3%2F%2F7Aw%3D","line":16,"updated":"2011-12-22 17:51:22.000000000","message":"Is the goal of this class to wipe out any data every time the start() method is called? Or would it make more sense to have the buffered content preserved, and add a clear() method to wipe the content?","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"44f93f8d8e4b5595ed8d51902a0fc400032186a2","unresolved":false,"context_lines":[{"line_number":13,"context_line":""},{"line_number":14,"context_line":"        self.buffering \u003d True"},{"line_number":15,"context_line":"        self.old_stdout \u003d sys.stdout"},{"line_number":16,"context_line":"        sys.stdout \u003d StringIO.StringIO()"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"    def read(self):"},{"line_number":19,"context_line":"        \"\"\"Read the current buffer\"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2B%2Fc%3D","line":16,"in_reply_to":"AAAAC3%2F%2F7Aw%3D","updated":"2012-01-03 20:25:30.000000000","message":"I\u0027m not clear on what is (at risk for?) being wiped out when start() is called... are you suggesting the buffered content should be preserved within this class after stop() is called?","commit_id":"f462608072df101460f886f2b58d9028c108a671"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"49946be30d718f0b30ef77652aa164dba52675d4","unresolved":false,"context_lines":[{"line_number":13,"context_line":""},{"line_number":14,"context_line":"        self.buffering \u003d True"},{"line_number":15,"context_line":"        self.old_stdout \u003d sys.stdout"},{"line_number":16,"context_line":"        sys.stdout \u003d StringIO.StringIO()"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"    def read(self):"},{"line_number":19,"context_line":"        \"\"\"Read the current buffer\"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAADH%2F%2F%2B1w%3D","line":16,"in_reply_to":"AAAADH%2F%2F%2B%2Fc%3D","updated":"2012-01-03 21:18:36.000000000","message":"Yes. start() and stop() would simply control if output was captured or not; read() would return the content, and clear() would reset. Maybe I\u0027m just thinking of some general-purpose output buffer classes I\u0027ve worked with. These could be swapped in and out as needed, so that the output was directed to the appropriate object as needed. \n\nThis code is fine as it is as long as you don\u0027t need to maintain content between start() calls.","commit_id":"f462608072df101460f886f2b58d9028c108a671"}]}
