{"comment":{"url":"https://api.github.com/repos/david415/tahoe-lafs/comments/19097366","html_url":"https://github.com/david415/tahoe-lafs/commit/969503eb7fa4f0a11c84bf9a46ffa37bf64c17ee#commitcomment-19097366","id":19097366,"user":{"login":"daira","id":643204,"avatar_url":"https://avatars.githubusercontent.com/u/643204?v=3","gravatar_id":"","url":"https://api.github.com/users/daira","html_url":"https://github.com/daira","followers_url":"https://api.github.com/users/daira/followers","following_url":"https://api.github.com/users/daira/following{/other_user}","gists_url":"https://api.github.com/users/daira/gists{/gist_id}","starred_url":"https://api.github.com/users/daira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daira/subscriptions","organizations_url":"https://api.github.com/users/daira/orgs","repos_url":"https://api.github.com/users/daira/repos","events_url":"https://api.github.com/users/daira/events{/privacy}","received_events_url":"https://api.github.com/users/daira/received_events","type":"User","site_admin":false},"position":42,"line":42,"path":"src/allmydata/tor.py","commit_id":"969503eb7fa4f0a11c84bf9a46ffa37bf64c17ee","created_at":"2016-09-20T14:42:01Z","updated_at":"2016-09-20T14:42:01Z","body":"I would write this as:\r\n{{{\r\nif self.control_endpoint is None:\r\n    config = torconfig.TorConfig()\r\n    d = torconfig.launch_tor(config, reactor, tor_binary=self.tor_binary)\r\n    d.addCallback(lambda result: result.tor_protocol)\r\nelse:\r\n    d = torcontrolprotocol.connect(self.control_endpoint) # XXX use a password_function?\r\n\r\ndef remember_tor_protocol(result):\r\n    self.tor_control_protocol = result\r\n    return result\r\nd.addCallback(remember_tor_protocol)\r\nreturn d\r\n}}}"}}
{"actor":{"display_login":"daira"}}