{"action":"created","comment":{"url":"https://api.github.com/repos/superdesk/superdesk/pulls/comments/34247926","id":34247926,"diff_hunk":"@@ -0,0 +1,24 @@\n+#!/usr/bin/env python3\n+\n+import json\n+import requests\n+\n+OS = 'linux'\n+CHANNEL = 'beta'\n+\n+BUILDS_URL = 'https://storage.googleapis.com/chromium-browser-continuous/Linux_x64/{}/chrome-linux.zip'\n+VERSIONS_URL = 'https://omahaproxy.appspot.com/all.json'\n+\n+\n+def get_build_no(data):\n+    for platform in data:\n+        if platform['os'] == OS:\n+            for version in platform['versions']:\n+                if version['channel'] == CHANNEL:\n+                    return version['branch_base_position']","path":"scripts/get_chrome_url","position":18,"original_position":18,"commit_id":"f215ac69d3ff486371d1e6dd34f03bcb622f9bde","original_commit_id":"f215ac69d3ff486371d1e6dd34f03bcb622f9bde","user":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"body":"Ugh, this nesting is kind of hard to read. :smile: Should we perhaps flatten it by converting it to a _collection pipeline_ (as per Martin Fowler in his [artcile](http://martinfowler.com/articles/refactoring-pipelines.html))?\r\n\r\n\r\n```py\r\nfrom functools import partial\r\nfrom operator import itemgetter\r\n...\r\n\r\n# construct mapping and filtering helper functions\r\nvalid_platforms = partial(filter, lambda platform: platform['os'] == OS)\r\nvalid_versions = partial(filter, lambda ver: ver['channel'] == CHANNEL)\r\nplatf_versions = partial(map, itemgetter('versions'))\r\n...\r\n\r\ndef get_build_no(data):\r\n    versions = valid_versions(platf_versions(valid_platforms(data)))  # <-- the pipeline itself\r\n    return next(versions, {}).get('branch_base_position')\r\n```","created_at":"2015-07-09T12:06:06Z","updated_at":"2015-07-09T12:06:06Z","html_url":"https://github.com/superdesk/superdesk/pull/815#discussion_r34247926","pull_request_url":"https://api.github.com/repos/superdesk/superdesk/pulls/815","_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/comments/34247926"},"html":{"href":"https://github.com/superdesk/superdesk/pull/815#discussion_r34247926"},"pull_request":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/815"}}},"pull_request":{"url":"https://api.github.com/repos/superdesk/superdesk/pulls/815","id":39563907,"html_url":"https://github.com/superdesk/superdesk/pull/815","diff_url":"https://github.com/superdesk/superdesk/pull/815.diff","patch_url":"https://github.com/superdesk/superdesk/pull/815.patch","issue_url":"https://api.github.com/repos/superdesk/superdesk/issues/815","number":815,"state":"open","locked":false,"title":"test(travis): use beta chrome for testing","user":{"login":"petrjasek","id":179249,"avatar_url":"https://avatars.githubusercontent.com/u/179249?v=3","gravatar_id":"","url":"https://api.github.com/users/petrjasek","html_url":"https://github.com/petrjasek","followers_url":"https://api.github.com/users/petrjasek/followers","following_url":"https://api.github.com/users/petrjasek/following{/other_user}","gists_url":"https://api.github.com/users/petrjasek/gists{/gist_id}","starred_url":"https://api.github.com/users/petrjasek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrjasek/subscriptions","organizations_url":"https://api.github.com/users/petrjasek/orgs","repos_url":"https://api.github.com/users/petrjasek/repos","events_url":"https://api.github.com/users/petrjasek/events{/privacy}","received_events_url":"https://api.github.com/users/petrjasek/received_events","type":"User","site_admin":false},"body":"instead of hardcoded version use devel channel to stay up to date","created_at":"2015-07-09T09:29:49Z","updated_at":"2015-07-09T12:06:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66ee582d2e87b711e764d45e165dbc47d8062335","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/superdesk/superdesk/pulls/815/commits","review_comments_url":"https://api.github.com/repos/superdesk/superdesk/pulls/815/comments","review_comment_url":"https://api.github.com/repos/superdesk/superdesk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/superdesk/superdesk/issues/815/comments","statuses_url":"https://api.github.com/repos/superdesk/superdesk/statuses/f215ac69d3ff486371d1e6dd34f03bcb622f9bde","head":{"label":"petrjasek:master","ref":"master","sha":"f215ac69d3ff486371d1e6dd34f03bcb622f9bde","user":{"login":"petrjasek","id":179249,"avatar_url":"https://avatars.githubusercontent.com/u/179249?v=3","gravatar_id":"","url":"https://api.github.com/users/petrjasek","html_url":"https://github.com/petrjasek","followers_url":"https://api.github.com/users/petrjasek/followers","following_url":"https://api.github.com/users/petrjasek/following{/other_user}","gists_url":"https://api.github.com/users/petrjasek/gists{/gist_id}","starred_url":"https://api.github.com/users/petrjasek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrjasek/subscriptions","organizations_url":"https://api.github.com/users/petrjasek/orgs","repos_url":"https://api.github.com/users/petrjasek/repos","events_url":"https://api.github.com/users/petrjasek/events{/privacy}","received_events_url":"https://api.github.com/users/petrjasek/received_events","type":"User","site_admin":false},"repo":{"id":23593594,"name":"superdesk","full_name":"petrjasek/superdesk","owner":{"login":"petrjasek","id":179249,"avatar_url":"https://avatars.githubusercontent.com/u/179249?v=3","gravatar_id":"","url":"https://api.github.com/users/petrjasek","html_url":"https://github.com/petrjasek","followers_url":"https://api.github.com/users/petrjasek/followers","following_url":"https://api.github.com/users/petrjasek/following{/other_user}","gists_url":"https://api.github.com/users/petrjasek/gists{/gist_id}","starred_url":"https://api.github.com/users/petrjasek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrjasek/subscriptions","organizations_url":"https://api.github.com/users/petrjasek/orgs","repos_url":"https://api.github.com/users/petrjasek/repos","events_url":"https://api.github.com/users/petrjasek/events{/privacy}","received_events_url":"https://api.github.com/users/petrjasek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petrjasek/superdesk","description":"","fork":true,"url":"https://api.github.com/repos/petrjasek/superdesk","forks_url":"https://api.github.com/repos/petrjasek/superdesk/forks","keys_url":"https://api.github.com/repos/petrjasek/superdesk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petrjasek/superdesk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petrjasek/superdesk/teams","hooks_url":"https://api.github.com/repos/petrjasek/superdesk/hooks","issue_events_url":"https://api.github.com/repos/petrjasek/superdesk/issues/events{/number}","events_url":"https://api.github.com/repos/petrjasek/superdesk/events","assignees_url":"https://api.github.com/repos/petrjasek/superdesk/assignees{/user}","branches_url":"https://api.github.com/repos/petrjasek/superdesk/branches{/branch}","tags_url":"https://api.github.com/repos/petrjasek/superdesk/tags","blobs_url":"https://api.github.com/repos/petrjasek/superdesk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petrjasek/superdesk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petrjasek/superdesk/git/refs{/sha}","trees_url":"https://api.github.com/repos/petrjasek/superdesk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petrjasek/superdesk/statuses/{sha}","languages_url":"https://api.github.com/repos/petrjasek/superdesk/languages","stargazers_url":"https://api.github.com/repos/petrjasek/superdesk/stargazers","contributors_url":"https://api.github.com/repos/petrjasek/superdesk/contributors","subscribers_url":"https://api.github.com/repos/petrjasek/superdesk/subscribers","subscription_url":"https://api.github.com/repos/petrjasek/superdesk/subscription","commits_url":"https://api.github.com/repos/petrjasek/superdesk/commits{/sha}","git_commits_url":"https://api.github.com/repos/petrjasek/superdesk/git/commits{/sha}","comments_url":"https://api.github.com/repos/petrjasek/superdesk/comments{/number}","issue_comment_url":"https://api.github.com/repos/petrjasek/superdesk/issues/comments{/number}","contents_url":"https://api.github.com/repos/petrjasek/superdesk/contents/{+path}","compare_url":"https://api.github.com/repos/petrjasek/superdesk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petrjasek/superdesk/merges","archive_url":"https://api.github.com/repos/petrjasek/superdesk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petrjasek/superdesk/downloads","issues_url":"https://api.github.com/repos/petrjasek/superdesk/issues{/number}","pulls_url":"https://api.github.com/repos/petrjasek/superdesk/pulls{/number}","milestones_url":"https://api.github.com/repos/petrjasek/superdesk/milestones{/number}","notifications_url":"https://api.github.com/repos/petrjasek/superdesk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petrjasek/superdesk/labels{/name}","releases_url":"https://api.github.com/repos/petrjasek/superdesk/releases{/id}","created_at":"2014-09-02T20:00:13Z","updated_at":"2015-05-07T14:00:14Z","pushed_at":"2015-07-09T10:16:51Z","git_url":"git://github.com/petrjasek/superdesk.git","ssh_url":"git@github.com:petrjasek/superdesk.git","clone_url":"https://github.com/petrjasek/superdesk.git","svn_url":"https://github.com/petrjasek/superdesk","homepage":null,"size":55601,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"superdesk:master","ref":"master","sha":"390b9919c255fe2b0337e338e314a94fe80b0ecc","user":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"repo":{"id":23570030,"name":"superdesk","full_name":"superdesk/superdesk","owner":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superdesk/superdesk","description":"The open source end-to-end news platform.","fork":false,"url":"https://api.github.com/repos/superdesk/superdesk","forks_url":"https://api.github.com/repos/superdesk/superdesk/forks","keys_url":"https://api.github.com/repos/superdesk/superdesk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superdesk/superdesk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superdesk/superdesk/teams","hooks_url":"https://api.github.com/repos/superdesk/superdesk/hooks","issue_events_url":"https://api.github.com/repos/superdesk/superdesk/issues/events{/number}","events_url":"https://api.github.com/repos/superdesk/superdesk/events","assignees_url":"https://api.github.com/repos/superdesk/superdesk/assignees{/user}","branches_url":"https://api.github.com/repos/superdesk/superdesk/branches{/branch}","tags_url":"https://api.github.com/repos/superdesk/superdesk/tags","blobs_url":"https://api.github.com/repos/superdesk/superdesk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superdesk/superdesk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superdesk/superdesk/git/refs{/sha}","trees_url":"https://api.github.com/repos/superdesk/superdesk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superdesk/superdesk/statuses/{sha}","languages_url":"https://api.github.com/repos/superdesk/superdesk/languages","stargazers_url":"https://api.github.com/repos/superdesk/superdesk/stargazers","contributors_url":"https://api.github.com/repos/superdesk/superdesk/contributors","subscribers_url":"https://api.github.com/repos/superdesk/superdesk/subscribers","subscription_url":"https://api.github.com/repos/superdesk/superdesk/subscription","commits_url":"https://api.github.com/repos/superdesk/superdesk/commits{/sha}","git_commits_url":"https://api.github.com/repos/superdesk/superdesk/git/commits{/sha}","comments_url":"https://api.github.com/repos/superdesk/superdesk/comments{/number}","issue_comment_url":"https://api.github.com/repos/superdesk/superdesk/issues/comments{/number}","contents_url":"https://api.github.com/repos/superdesk/superdesk/contents/{+path}","compare_url":"https://api.github.com/repos/superdesk/superdesk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superdesk/superdesk/merges","archive_url":"https://api.github.com/repos/superdesk/superdesk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superdesk/superdesk/downloads","issues_url":"https://api.github.com/repos/superdesk/superdesk/issues{/number}","pulls_url":"https://api.github.com/repos/superdesk/superdesk/pulls{/number}","milestones_url":"https://api.github.com/repos/superdesk/superdesk/milestones{/number}","notifications_url":"https://api.github.com/repos/superdesk/superdesk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superdesk/superdesk/labels{/name}","releases_url":"https://api.github.com/repos/superdesk/superdesk/releases{/id}","created_at":"2014-09-02T07:56:17Z","updated_at":"2015-07-05T21:26:56Z","pushed_at":"2015-07-09T10:16:51Z","git_url":"git://github.com/superdesk/superdesk.git","ssh_url":"git@github.com:superdesk/superdesk.git","clone_url":"https://github.com/superdesk/superdesk.git","svn_url":"https://github.com/superdesk/superdesk","homepage":"","size":63571,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":9,"forks":31,"open_issues":9,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/815"},"html":{"href":"https://github.com/superdesk/superdesk/pull/815"},"issue":{"href":"https://api.github.com/repos/superdesk/superdesk/issues/815"},"comments":{"href":"https://api.github.com/repos/superdesk/superdesk/issues/815/comments"},"review_comments":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/815/comments"},"review_comment":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/815/commits"},"statuses":{"href":"https://api.github.com/repos/superdesk/superdesk/statuses/f215ac69d3ff486371d1e6dd34f03bcb622f9bde"}}}}