GitHub PullRequestReviewCommentEvent at 2014-09-17 10:06:00
Repository: ubuntu-developer-tools-center
Actor: Tinche
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/comments/17655892","id":17655892,"diff_hunk":"@@ -69,28 +68,28 @@ def __init__(self, urls, on_done, download=True, report=lambda x: None):\n \n         self._download_progress = {}\n \n-        executor = futures.ThreadPoolExecutor(max_workers=3)\n-        for url_request in self._urls:\n-            url, md5sum = (url_request, None)\n-            # grab the md5sum if any\n-            with suppress(ValueError):\n-                (url, md5sum) = url_request\n-            # switch between inline memory and temp file\n-            if download:\n-                # Named because shutils and tarfile library needs a .name property\n-                # http://bugs.python.org/issue21044\n-                # also, ensure we keep the same suffix\n-                path, ext = os.path.splitext(url)\n-                dest = tempfile.NamedTemporaryFile(suffix=ext)\n-                logger.info(\"Start downloading {} as a temporary file\".format(url))\n-            else:\n-                dest = BytesIO()\n-                logger.info(\"Start downloading {} in memory\".format(url))\n-            future = executor.submit(self._fetch, url, md5sum, dest)\n-            future.tag_url = url\n-            future.tag_download = download\n-            future.tag_dest = dest\n-            future.add_done_callback(self._one_done)\n+        with futures.ThreadPoolExecutor(max_workers=3) as executor:","path":"udtc/network/download_center.py","position":45,"original_position":45,"commit_id":"ad9f6488bc8cc2a48fdc3d1bf4e39d69e6e4213a","original_commit_id":"ad9f6488bc8cc2a48fdc3d1bf4e39d69e6e4213a","user":{"login":"Tinche","id":1909233,"avatar_url":"https://avatars.githubusercontent.com/u/1909233?v=2","gravatar_id":"157d1fe48309490ec44a0f75c933839f","url":"https://api.github.com/users/Tinche","html_url":"https://github.com/Tinche","followers_url":"https://api.github.com/users/Tinche/followers","following_url":"https://api.github.com/users/Tinche/following{/other_user}","gists_url":"https://api.github.com/users/Tinche/gists{/gist_id}","starred_url":"https://api.github.com/users/Tinche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tinche/subscriptions","organizations_url":"https://api.github.com/users/Tinche/orgs","repos_url":"https://api.github.com/users/Tinche/repos","events_url":"https://api.github.com/users/Tinche/events{/privacy}","received_events_url":"https://api.github.com/users/Tinche/received_events","type":"User","site_admin":false},"body":"* one less variable to keep track of\r\n* ensures automatic clean up of executor resources when all futures are done - it's equivalent of calling executor.shutdown(wait=True) (http://legacy.python.org/dev/peps/pep-3148/#id22). Nifty ;)","created_at":"2014-09-17T10:06:00Z","updated_at":"2014-09-17T10:06:00Z","html_url":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22#discussion_r17655892","pull_request_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/comments/17655892"},"html":{"href":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22#discussion_r17655892"},"pull_request":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22","id":21331742,"html_url":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22","diff_url":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22.diff","patch_url":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22.patch","issue_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/22","number":22,"state":"open","locked":false,"title":"Requests support","user":{"login":"Tinche","id":1909233,"avatar_url":"https://avatars.githubusercontent.com/u/1909233?v=2","gravatar_id":"157d1fe48309490ec44a0f75c933839f","url":"https://api.github.com/users/Tinche","html_url":"https://github.com/Tinche","followers_url":"https://api.github.com/users/Tinche/followers","following_url":"https://api.github.com/users/Tinche/following{/other_user}","gists_url":"https://api.github.com/users/Tinche/gists{/gist_id}","starred_url":"https://api.github.com/users/Tinche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tinche/subscriptions","organizations_url":"https://api.github.com/users/Tinche/orgs","repos_url":"https://api.github.com/users/Tinche/repos","events_url":"https://api.github.com/users/Tinche/events{/privacy}","received_events_url":"https://api.github.com/users/Tinche/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nas discussed before. Note that I've created a new SSL certificate because requests verifies the host name by default (otherwise a whole aspect of HTTPS is undermined). The certificate included is valid for 'localhost'.\r\n\r\nI've also included tests for redirection (forgot to mention in the commit message).\r\n\r\nThese changesets pass pep8, small and medium tests on my machine.","created_at":"2014-09-16T21:54:32Z","updated_at":"2014-09-17T10:06:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b8f4ae831d4a59836e66a4f49aca8b572dfcb09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22/commits","review_comments_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22/comments","review_comment_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/comments/{number}","comments_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/22/comments","statuses_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/statuses/ad9f6488bc8cc2a48fdc3d1bf4e39d69e6e4213a","head":{"label":"Tinche:master","ref":"master","sha":"ad9f6488bc8cc2a48fdc3d1bf4e39d69e6e4213a","user":{"login":"Tinche","id":1909233,"avatar_url":"https://avatars.githubusercontent.com/u/1909233?v=2","gravatar_id":"157d1fe48309490ec44a0f75c933839f","url":"https://api.github.com/users/Tinche","html_url":"https://github.com/Tinche","followers_url":"https://api.github.com/users/Tinche/followers","following_url":"https://api.github.com/users/Tinche/following{/other_user}","gists_url":"https://api.github.com/users/Tinche/gists{/gist_id}","starred_url":"https://api.github.com/users/Tinche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tinche/subscriptions","organizations_url":"https://api.github.com/users/Tinche/orgs","repos_url":"https://api.github.com/users/Tinche/repos","events_url":"https://api.github.com/users/Tinche/events{/privacy}","received_events_url":"https://api.github.com/users/Tinche/received_events","type":"User","site_admin":false},"repo":{"id":24067990,"name":"ubuntu-developer-tools-center","full_name":"Tinche/ubuntu-developer-tools-center","owner":{"login":"Tinche","id":1909233,"avatar_url":"https://avatars.githubusercontent.com/u/1909233?v=2","gravatar_id":"157d1fe48309490ec44a0f75c933839f","url":"https://api.github.com/users/Tinche","html_url":"https://github.com/Tinche","followers_url":"https://api.github.com/users/Tinche/followers","following_url":"https://api.github.com/users/Tinche/following{/other_user}","gists_url":"https://api.github.com/users/Tinche/gists{/gist_id}","starred_url":"https://api.github.com/users/Tinche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tinche/subscriptions","organizations_url":"https://api.github.com/users/Tinche/orgs","repos_url":"https://api.github.com/users/Tinche/repos","events_url":"https://api.github.com/users/Tinche/events{/privacy}","received_events_url":"https://api.github.com/users/Tinche/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Tinche/ubuntu-developer-tools-center","description":"Ubuntu Developer Tools Center","fork":true,"url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center","forks_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/forks","keys_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/teams","hooks_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/hooks","issue_events_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/issues/events{/number}","events_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/events","assignees_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/assignees{/user}","branches_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/branches{/branch}","tags_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/tags","blobs_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/statuses/{sha}","languages_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/languages","stargazers_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/stargazers","contributors_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/contributors","subscribers_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/subscribers","subscription_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/subscription","commits_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/issues/comments/{number}","contents_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/contents/{+path}","compare_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/merges","archive_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/downloads","issues_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/issues{/number}","pulls_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/pulls{/number}","milestones_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/milestones{/number}","notifications_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/labels{/name}","releases_url":"https://api.github.com/repos/Tinche/ubuntu-developer-tools-center/releases{/id}","created_at":"2014-09-15T18:24:15Z","updated_at":"2014-09-16T21:51:26Z","pushed_at":"2014-09-16T21:51:26Z","git_url":"git://github.com/Tinche/ubuntu-developer-tools-center.git","ssh_url":"git@github.com:Tinche/ubuntu-developer-tools-center.git","clone_url":"https://github.com/Tinche/ubuntu-developer-tools-center.git","svn_url":"https://github.com/Tinche/ubuntu-developer-tools-center","homepage":null,"size":1695,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"didrocks:master","ref":"master","sha":"bfc135af5ccb33f689e4feb4ede90fcf174968f1","user":{"login":"didrocks","id":1823296,"avatar_url":"https://avatars.githubusercontent.com/u/1823296?v=2","gravatar_id":"2907b59ab859523c4638e7b13605b37a","url":"https://api.github.com/users/didrocks","html_url":"https://github.com/didrocks","followers_url":"https://api.github.com/users/didrocks/followers","following_url":"https://api.github.com/users/didrocks/following{/other_user}","gists_url":"https://api.github.com/users/didrocks/gists{/gist_id}","starred_url":"https://api.github.com/users/didrocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/didrocks/subscriptions","organizations_url":"https://api.github.com/users/didrocks/orgs","repos_url":"https://api.github.com/users/didrocks/repos","events_url":"https://api.github.com/users/didrocks/events{/privacy}","received_events_url":"https://api.github.com/users/didrocks/received_events","type":"User","site_admin":false},"repo":{"id":20486912,"name":"ubuntu-developer-tools-center","full_name":"didrocks/ubuntu-developer-tools-center","owner":{"login":"didrocks","id":1823296,"avatar_url":"https://avatars.githubusercontent.com/u/1823296?v=2","gravatar_id":"2907b59ab859523c4638e7b13605b37a","url":"https://api.github.com/users/didrocks","html_url":"https://github.com/didrocks","followers_url":"https://api.github.com/users/didrocks/followers","following_url":"https://api.github.com/users/didrocks/following{/other_user}","gists_url":"https://api.github.com/users/didrocks/gists{/gist_id}","starred_url":"https://api.github.com/users/didrocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/didrocks/subscriptions","organizations_url":"https://api.github.com/users/didrocks/orgs","repos_url":"https://api.github.com/users/didrocks/repos","events_url":"https://api.github.com/users/didrocks/events{/privacy}","received_events_url":"https://api.github.com/users/didrocks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/didrocks/ubuntu-developer-tools-center","description":"Ubuntu Developer Tools Center","fork":false,"url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center","forks_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/forks","keys_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/keys{/key_id}","collaborators_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/teams","hooks_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/hooks","issue_events_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/events{/number}","events_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/events","assignees_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/assignees{/user}","branches_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/branches{/branch}","tags_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/tags","blobs_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/git/refs{/sha}","trees_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/git/trees{/sha}","statuses_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/statuses/{sha}","languages_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/languages","stargazers_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/stargazers","contributors_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/contributors","subscribers_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/subscribers","subscription_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/subscription","commits_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/commits{/sha}","git_commits_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/git/commits{/sha}","comments_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/comments{/number}","issue_comment_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/comments/{number}","contents_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/contents/{+path}","compare_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/compare/{base}...{head}","merges_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/merges","archive_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/downloads","issues_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues{/number}","pulls_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls{/number}","milestones_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/milestones{/number}","notifications_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/labels{/name}","releases_url":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/releases{/id}","created_at":"2014-06-04T14:29:09Z","updated_at":"2014-09-15T16:03:12Z","pushed_at":"2014-09-17T09:14:36Z","git_url":"git://github.com/didrocks/ubuntu-developer-tools-center.git","ssh_url":"git@github.com:didrocks/ubuntu-developer-tools-center.git","clone_url":"https://github.com/didrocks/ubuntu-developer-tools-center.git","svn_url":"https://github.com/didrocks/ubuntu-developer-tools-center","homepage":null,"size":1695,"stargazers_count":27,"watchers_count":27,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":16,"forks":4,"open_issues":16,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22"},"html":{"href":"https://github.com/didrocks/ubuntu-developer-tools-center/pull/22"},"issue":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/22"},"comments":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/didrocks/ubuntu-developer-tools-center/statuses/ad9f6488bc8cc2a48fdc3d1bf4e39d69e6e4213a"}}}}