{"action":"created","comment":{"url":"https://api.github.com/repos/coala-analyzer/coala/pulls/comments/57517188","id":57517188,"diff_hunk":"@@ -0,0 +1,44 @@\n+\n+\n+def typechain(*args):\n+    \"\"\"\n+    Returns function which applies the first transformation it can from args\n+    and returns transformed value, raises ValueError when cannot apply none.\n+\n+    >>> function = typechain(int, ord, None)\n+    >>> function(\"10\")\n+    10\n+    >>> function(\"a\")\n+    97\n+    >>> function(int)\n+    <class 'int'>\n+    >>> function(None) is None\n+    True\n+    >>> function(\"str\")\n+    Traceback (most recent call last):\n+        ...\n+    ValueError: Couldn't convert to any specified type value 'str'.\n+\n+    :raises TypeError:  Raises when either no functions are specified for\n+                        checking or one or more object isn't callable and not\n+                        None.\n+    \"\"\"\n+    if len(args) == 0:\n+        raise TypeError(\"No arguments were provided.\")\n+    if not all(arg is None or getattr(arg, '__call__', False) for arg in args):\n+        raise TypeError(\"One of the provided argument is not callable.\")","path":"coalib/misc/Annotations.py","position":29,"original_position":29,"commit_id":"ce0e5931dde9e6f0a36239384efb004bb038e6cb","original_commit_id":"ce0e5931dde9e6f0a36239384efb004bb038e6cb","user":{"login":"sils1297","id":5716520,"avatar_url":"https://avatars.githubusercontent.com/u/5716520?v=3","gravatar_id":"","url":"https://api.github.com/users/sils1297","html_url":"https://github.com/sils1297","followers_url":"https://api.github.com/users/sils1297/followers","following_url":"https://api.github.com/users/sils1297/following{/other_user}","gists_url":"https://api.github.com/users/sils1297/gists{/gist_id}","starred_url":"https://api.github.com/users/sils1297/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sils1297/subscriptions","organizations_url":"https://api.github.com/users/sils1297/orgs","repos_url":"https://api.github.com/users/sils1297/repos","events_url":"https://api.github.com/users/sils1297/events{/privacy}","received_events_url":"https://api.github.com/users/sils1297/received_events","type":"User","site_admin":false},"body":"not sure I agree, say I want to allow 3, 4 and None I'd probably do something like `typechain(3, 4, None)` right? Why limit the type matching to None?","created_at":"2016-03-26T18:13:29Z","updated_at":"2016-03-26T18:13:29Z","html_url":"https://github.com/coala-analyzer/coala/pull/1964#discussion_r57517188","pull_request_url":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964","_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/comments/57517188"},"html":{"href":"https://github.com/coala-analyzer/coala/pull/1964#discussion_r57517188"},"pull_request":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964"}}},"pull_request":{"url":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964","id":64233202,"html_url":"https://github.com/coala-analyzer/coala/pull/1964","diff_url":"https://github.com/coala-analyzer/coala/pull/1964.diff","patch_url":"https://github.com/coala-analyzer/coala/pull/1964.patch","issue_url":"https://api.github.com/repos/coala-analyzer/coala/issues/1964","number":1964,"state":"open","locked":false,"title":"Annotations: Add function for chaining annotations","user":{"login":"Uran198","id":3969221,"avatar_url":"https://avatars.githubusercontent.com/u/3969221?v=3","gravatar_id":"","url":"https://api.github.com/users/Uran198","html_url":"https://github.com/Uran198","followers_url":"https://api.github.com/users/Uran198/followers","following_url":"https://api.github.com/users/Uran198/following{/other_user}","gists_url":"https://api.github.com/users/Uran198/gists{/gist_id}","starred_url":"https://api.github.com/users/Uran198/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uran198/subscriptions","organizations_url":"https://api.github.com/users/Uran198/orgs","repos_url":"https://api.github.com/users/Uran198/repos","events_url":"https://api.github.com/users/Uran198/events{/privacy}","received_events_url":"https://api.github.com/users/Uran198/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/coala-analyzer/coala/issues/1859","created_at":"2016-03-26T08:46:58Z","updated_at":"2016-03-26T18:13:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40cdcd70b3386ed6365f3036ac8280b2dddf25af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964/commits","review_comments_url":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964/comments","review_comment_url":"https://api.github.com/repos/coala-analyzer/coala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coala-analyzer/coala/issues/1964/comments","statuses_url":"https://api.github.com/repos/coala-analyzer/coala/statuses/ce0e5931dde9e6f0a36239384efb004bb038e6cb","head":{"label":"Uran198:typechain","ref":"typechain","sha":"ce0e5931dde9e6f0a36239384efb004bb038e6cb","user":{"login":"Uran198","id":3969221,"avatar_url":"https://avatars.githubusercontent.com/u/3969221?v=3","gravatar_id":"","url":"https://api.github.com/users/Uran198","html_url":"https://github.com/Uran198","followers_url":"https://api.github.com/users/Uran198/followers","following_url":"https://api.github.com/users/Uran198/following{/other_user}","gists_url":"https://api.github.com/users/Uran198/gists{/gist_id}","starred_url":"https://api.github.com/users/Uran198/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uran198/subscriptions","organizations_url":"https://api.github.com/users/Uran198/orgs","repos_url":"https://api.github.com/users/Uran198/repos","events_url":"https://api.github.com/users/Uran198/events{/privacy}","received_events_url":"https://api.github.com/users/Uran198/received_events","type":"User","site_admin":false},"repo":{"id":49705626,"name":"coala","full_name":"Uran198/coala","owner":{"login":"Uran198","id":3969221,"avatar_url":"https://avatars.githubusercontent.com/u/3969221?v=3","gravatar_id":"","url":"https://api.github.com/users/Uran198","html_url":"https://github.com/Uran198","followers_url":"https://api.github.com/users/Uran198/followers","following_url":"https://api.github.com/users/Uran198/following{/other_user}","gists_url":"https://api.github.com/users/Uran198/gists{/gist_id}","starred_url":"https://api.github.com/users/Uran198/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Uran198/subscriptions","organizations_url":"https://api.github.com/users/Uran198/orgs","repos_url":"https://api.github.com/users/Uran198/repos","events_url":"https://api.github.com/users/Uran198/events{/privacy}","received_events_url":"https://api.github.com/users/Uran198/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Uran198/coala","description":"Easy to use COde AnaLysis Application","fork":true,"url":"https://api.github.com/repos/Uran198/coala","forks_url":"https://api.github.com/repos/Uran198/coala/forks","keys_url":"https://api.github.com/repos/Uran198/coala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Uran198/coala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Uran198/coala/teams","hooks_url":"https://api.github.com/repos/Uran198/coala/hooks","issue_events_url":"https://api.github.com/repos/Uran198/coala/issues/events{/number}","events_url":"https://api.github.com/repos/Uran198/coala/events","assignees_url":"https://api.github.com/repos/Uran198/coala/assignees{/user}","branches_url":"https://api.github.com/repos/Uran198/coala/branches{/branch}","tags_url":"https://api.github.com/repos/Uran198/coala/tags","blobs_url":"https://api.github.com/repos/Uran198/coala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Uran198/coala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Uran198/coala/git/refs{/sha}","trees_url":"https://api.github.com/repos/Uran198/coala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Uran198/coala/statuses/{sha}","languages_url":"https://api.github.com/repos/Uran198/coala/languages","stargazers_url":"https://api.github.com/repos/Uran198/coala/stargazers","contributors_url":"https://api.github.com/repos/Uran198/coala/contributors","subscribers_url":"https://api.github.com/repos/Uran198/coala/subscribers","subscription_url":"https://api.github.com/repos/Uran198/coala/subscription","commits_url":"https://api.github.com/repos/Uran198/coala/commits{/sha}","git_commits_url":"https://api.github.com/repos/Uran198/coala/git/commits{/sha}","comments_url":"https://api.github.com/repos/Uran198/coala/comments{/number}","issue_comment_url":"https://api.github.com/repos/Uran198/coala/issues/comments{/number}","contents_url":"https://api.github.com/repos/Uran198/coala/contents/{+path}","compare_url":"https://api.github.com/repos/Uran198/coala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Uran198/coala/merges","archive_url":"https://api.github.com/repos/Uran198/coala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Uran198/coala/downloads","issues_url":"https://api.github.com/repos/Uran198/coala/issues{/number}","pulls_url":"https://api.github.com/repos/Uran198/coala/pulls{/number}","milestones_url":"https://api.github.com/repos/Uran198/coala/milestones{/number}","notifications_url":"https://api.github.com/repos/Uran198/coala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Uran198/coala/labels{/name}","releases_url":"https://api.github.com/repos/Uran198/coala/releases{/id}","deployments_url":"https://api.github.com/repos/Uran198/coala/deployments","created_at":"2016-01-15T08:11:15Z","updated_at":"2016-01-15T08:11:17Z","pushed_at":"2016-03-26T16:53:30Z","git_url":"git://github.com/Uran198/coala.git","ssh_url":"git@github.com:Uran198/coala.git","clone_url":"https://github.com/Uran198/coala.git","svn_url":"https://github.com/Uran198/coala","homepage":"http://coala-analyzer.org/","size":9260,"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":"coala-analyzer:master","ref":"master","sha":"e4bb09ee5a53587ca14e14c3affd9665dbf91bb0","user":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"repo":{"id":19816973,"name":"coala","full_name":"coala-analyzer/coala","owner":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coala-analyzer/coala","description":"Easy to use COde AnaLysis Application - yes! For all languages!","fork":false,"url":"https://api.github.com/repos/coala-analyzer/coala","forks_url":"https://api.github.com/repos/coala-analyzer/coala/forks","keys_url":"https://api.github.com/repos/coala-analyzer/coala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coala-analyzer/coala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coala-analyzer/coala/teams","hooks_url":"https://api.github.com/repos/coala-analyzer/coala/hooks","issue_events_url":"https://api.github.com/repos/coala-analyzer/coala/issues/events{/number}","events_url":"https://api.github.com/repos/coala-analyzer/coala/events","assignees_url":"https://api.github.com/repos/coala-analyzer/coala/assignees{/user}","branches_url":"https://api.github.com/repos/coala-analyzer/coala/branches{/branch}","tags_url":"https://api.github.com/repos/coala-analyzer/coala/tags","blobs_url":"https://api.github.com/repos/coala-analyzer/coala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coala-analyzer/coala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coala-analyzer/coala/git/refs{/sha}","trees_url":"https://api.github.com/repos/coala-analyzer/coala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coala-analyzer/coala/statuses/{sha}","languages_url":"https://api.github.com/repos/coala-analyzer/coala/languages","stargazers_url":"https://api.github.com/repos/coala-analyzer/coala/stargazers","contributors_url":"https://api.github.com/repos/coala-analyzer/coala/contributors","subscribers_url":"https://api.github.com/repos/coala-analyzer/coala/subscribers","subscription_url":"https://api.github.com/repos/coala-analyzer/coala/subscription","commits_url":"https://api.github.com/repos/coala-analyzer/coala/commits{/sha}","git_commits_url":"https://api.github.com/repos/coala-analyzer/coala/git/commits{/sha}","comments_url":"https://api.github.com/repos/coala-analyzer/coala/comments{/number}","issue_comment_url":"https://api.github.com/repos/coala-analyzer/coala/issues/comments{/number}","contents_url":"https://api.github.com/repos/coala-analyzer/coala/contents/{+path}","compare_url":"https://api.github.com/repos/coala-analyzer/coala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coala-analyzer/coala/merges","archive_url":"https://api.github.com/repos/coala-analyzer/coala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coala-analyzer/coala/downloads","issues_url":"https://api.github.com/repos/coala-analyzer/coala/issues{/number}","pulls_url":"https://api.github.com/repos/coala-analyzer/coala/pulls{/number}","milestones_url":"https://api.github.com/repos/coala-analyzer/coala/milestones{/number}","notifications_url":"https://api.github.com/repos/coala-analyzer/coala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coala-analyzer/coala/labels{/name}","releases_url":"https://api.github.com/repos/coala-analyzer/coala/releases{/id}","deployments_url":"https://api.github.com/repos/coala-analyzer/coala/deployments","created_at":"2014-05-15T11:35:34Z","updated_at":"2016-03-25T07:16:56Z","pushed_at":"2016-03-26T16:53:30Z","git_url":"git://github.com/coala-analyzer/coala.git","ssh_url":"git@github.com:coala-analyzer/coala.git","clone_url":"https://github.com/coala-analyzer/coala.git","svn_url":"https://github.com/coala-analyzer/coala","homepage":"http://coala-analyzer.org/","size":11293,"stargazers_count":92,"watchers_count":92,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":106,"mirror_url":null,"open_issues_count":125,"forks":106,"open_issues":125,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964"},"html":{"href":"https://github.com/coala-analyzer/coala/pull/1964"},"issue":{"href":"https://api.github.com/repos/coala-analyzer/coala/issues/1964"},"comments":{"href":"https://api.github.com/repos/coala-analyzer/coala/issues/1964/comments"},"review_comments":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964/comments"},"review_comment":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coala-analyzer/coala/pulls/1964/commits"},"statuses":{"href":"https://api.github.com/repos/coala-analyzer/coala/statuses/ce0e5931dde9e6f0a36239384efb004bb038e6cb"}}}}