{"action":"created","comment":{"url":"https://api.github.com/repos/pazz/alot/pulls/comments/98333798","pull_request_review_id":18976056,"id":98333798,"diff_hunk":"@@ -0,0 +1,113 @@\n+# Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>\n+# This file is released under the GNU GPL, version 3 or a later revision.\n+# For further details see the COPYING file\n+\n+import urwid\n+\n+\n+class ANSIText(urwid.WidgetWrap):\n+\n+    \"\"\"Selectable Text widget that interprets ANSI color codes\"\"\"\n+\n+    def __init__(self, txt,\n+                 default_attr=None,\n+                 default_attr_focus=None,\n+                 ansi_background=True, **kwds):\n+        ct, focus_map = parse_escapes_to_urwid(txt, default_attr,\n+                                               default_attr_focus,\n+                                               ansi_background)\n+        t = urwid.Text(ct, **kwds)\n+        attr_map = { default_attr.background: ''}\n+        w = urwid.AttrMap(t, attr_map, focus_map)\n+        urwid.WidgetWrap.__init__(self, w)\n+\n+    def selectable(self):\n+        return True\n+\n+    def keypress(self, size, key):","path":"alot/widgets/ansi.py","position":27,"original_position":27,"commit_id":"cdf30c2c35503cfd6f549fb2d007dd09514b47da","original_commit_id":"cdf30c2c35503cfd6f549fb2d007dd09514b47da","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Method could be a function](https://www.codacy.com/app/patricktotzke/alot/pullRequest?prid=495910)","created_at":"2017-01-28T16:17:12Z","updated_at":"2017-01-28T16:17:12Z","html_url":"https://github.com/pazz/alot/pull/1015#discussion_r98333798","pull_request_url":"https://api.github.com/repos/pazz/alot/pulls/1015","_links":{"self":{"href":"https://api.github.com/repos/pazz/alot/pulls/comments/98333798"},"html":{"href":"https://github.com/pazz/alot/pull/1015#discussion_r98333798"},"pull_request":{"href":"https://api.github.com/repos/pazz/alot/pulls/1015"}}},"pull_request":{"url":"https://api.github.com/repos/pazz/alot/pulls/1015","id":103615538,"html_url":"https://github.com/pazz/alot/pull/1015","diff_url":"https://github.com/pazz/alot/pull/1015.diff","patch_url":"https://github.com/pazz/alot/pull/1015.patch","issue_url":"https://api.github.com/repos/pazz/alot/issues/1015","number":1015,"state":"open","locked":false,"title":"ANSI-escape codes for colourful HTML mails","user":{"login":"pazz","id":628455,"avatar_url":"https://avatars.githubusercontent.com/u/628455?v=3","gravatar_id":"","url":"https://api.github.com/users/pazz","html_url":"https://github.com/pazz","followers_url":"https://api.github.com/users/pazz/followers","following_url":"https://api.github.com/users/pazz/following{/other_user}","gists_url":"https://api.github.com/users/pazz/gists{/gist_id}","starred_url":"https://api.github.com/users/pazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pazz/subscriptions","organizations_url":"https://api.github.com/users/pazz/orgs","repos_url":"https://api.github.com/users/pazz/repos","events_url":"https://api.github.com/users/pazz/events{/privacy}","received_events_url":"https://api.github.com/users/pazz/received_events","type":"User","site_admin":false},"body":"This is a rebase of an old branch \"0.3.6-feature-color-wip\", which I will retire now, and ultimately passes on a proof-of-concept implementation of TextWidgets that interprets [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors).\r\n\r\nThe aim is to let the html renderer interpret colours from html mails and translate them to ANSI escapes. For instance, elinks can do this:\r\n\r\n```\r\ntext/html; elinks -force-html -dump -dump-color-mode 3 -dump-charset utf8 -eval 'set document.codepage.assume = \"%{charset}\"' %s; copiousoutput\r\n```\r\n\r\nThis feature can be enabled simply by configuring your mailcap as above and should not have any effect\r\nif the browser does not produce these characters.\r\nThe boolean config setting can be used to disable interpretation of a subset of escape codes,\r\nthose which change the background colour of text (on top of say, changing foreground or character weights).\r\n\r\nThis is intended as a RFC and is not at all ready to go live!\r\n\r\nI'll retire the related issue #612 because that PR is outdated.","created_at":"2017-01-28T16:03:52Z","updated_at":"2017-01-28T16:17:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1480d774a90cd24a7d0a4b4b7373a90cb7fa21a0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pazz/alot/pulls/1015/commits","review_comments_url":"https://api.github.com/repos/pazz/alot/pulls/1015/comments","review_comment_url":"https://api.github.com/repos/pazz/alot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pazz/alot/issues/1015/comments","statuses_url":"https://api.github.com/repos/pazz/alot/statuses/cdf30c2c35503cfd6f549fb2d007dd09514b47da","head":{"label":"pazz:feature-ANSI-colour-interpretation","ref":"feature-ANSI-colour-interpretation","sha":"cdf30c2c35503cfd6f549fb2d007dd09514b47da","user":{"login":"pazz","id":628455,"avatar_url":"https://avatars.githubusercontent.com/u/628455?v=3","gravatar_id":"","url":"https://api.github.com/users/pazz","html_url":"https://github.com/pazz","followers_url":"https://api.github.com/users/pazz/followers","following_url":"https://api.github.com/users/pazz/following{/other_user}","gists_url":"https://api.github.com/users/pazz/gists{/gist_id}","starred_url":"https://api.github.com/users/pazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pazz/subscriptions","organizations_url":"https://api.github.com/users/pazz/orgs","repos_url":"https://api.github.com/users/pazz/repos","events_url":"https://api.github.com/users/pazz/events{/privacy}","received_events_url":"https://api.github.com/users/pazz/received_events","type":"User","site_admin":false},"repo":{"id":2197977,"name":"alot","full_name":"pazz/alot","owner":{"login":"pazz","id":628455,"avatar_url":"https://avatars.githubusercontent.com/u/628455?v=3","gravatar_id":"","url":"https://api.github.com/users/pazz","html_url":"https://github.com/pazz","followers_url":"https://api.github.com/users/pazz/followers","following_url":"https://api.github.com/users/pazz/following{/other_user}","gists_url":"https://api.github.com/users/pazz/gists{/gist_id}","starred_url":"https://api.github.com/users/pazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pazz/subscriptions","organizations_url":"https://api.github.com/users/pazz/orgs","repos_url":"https://api.github.com/users/pazz/repos","events_url":"https://api.github.com/users/pazz/events{/privacy}","received_events_url":"https://api.github.com/users/pazz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pazz/alot","description":"commandline MUA based on notmuch and urwid","fork":false,"url":"https://api.github.com/repos/pazz/alot","forks_url":"https://api.github.com/repos/pazz/alot/forks","keys_url":"https://api.github.com/repos/pazz/alot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pazz/alot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pazz/alot/teams","hooks_url":"https://api.github.com/repos/pazz/alot/hooks","issue_events_url":"https://api.github.com/repos/pazz/alot/issues/events{/number}","events_url":"https://api.github.com/repos/pazz/alot/events","assignees_url":"https://api.github.com/repos/pazz/alot/assignees{/user}","branches_url":"https://api.github.com/repos/pazz/alot/branches{/branch}","tags_url":"https://api.github.com/repos/pazz/alot/tags","blobs_url":"https://api.github.com/repos/pazz/alot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pazz/alot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pazz/alot/git/refs{/sha}","trees_url":"https://api.github.com/repos/pazz/alot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pazz/alot/statuses/{sha}","languages_url":"https://api.github.com/repos/pazz/alot/languages","stargazers_url":"https://api.github.com/repos/pazz/alot/stargazers","contributors_url":"https://api.github.com/repos/pazz/alot/contributors","subscribers_url":"https://api.github.com/repos/pazz/alot/subscribers","subscription_url":"https://api.github.com/repos/pazz/alot/subscription","commits_url":"https://api.github.com/repos/pazz/alot/commits{/sha}","git_commits_url":"https://api.github.com/repos/pazz/alot/git/commits{/sha}","comments_url":"https://api.github.com/repos/pazz/alot/comments{/number}","issue_comment_url":"https://api.github.com/repos/pazz/alot/issues/comments{/number}","contents_url":"https://api.github.com/repos/pazz/alot/contents/{+path}","compare_url":"https://api.github.com/repos/pazz/alot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pazz/alot/merges","archive_url":"https://api.github.com/repos/pazz/alot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pazz/alot/downloads","issues_url":"https://api.github.com/repos/pazz/alot/issues{/number}","pulls_url":"https://api.github.com/repos/pazz/alot/pulls{/number}","milestones_url":"https://api.github.com/repos/pazz/alot/milestones{/number}","notifications_url":"https://api.github.com/repos/pazz/alot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pazz/alot/labels{/name}","releases_url":"https://api.github.com/repos/pazz/alot/releases{/id}","deployments_url":"https://api.github.com/repos/pazz/alot/deployments","created_at":"2011-08-12T16:22:37Z","updated_at":"2017-01-26T13:15:10Z","pushed_at":"2017-01-28T16:13:44Z","git_url":"git://github.com/pazz/alot.git","ssh_url":"git@github.com:pazz/alot.git","clone_url":"https://github.com/pazz/alot.git","svn_url":"https://github.com/pazz/alot","homepage":"","size":7057,"stargazers_count":311,"watchers_count":311,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":89,"mirror_url":null,"open_issues_count":165,"forks":89,"open_issues":165,"watchers":311,"default_branch":"master"}},"base":{"label":"pazz:master","ref":"master","sha":"c564aea04c434620876d370c77ba25e742c47c10","user":{"login":"pazz","id":628455,"avatar_url":"https://avatars.githubusercontent.com/u/628455?v=3","gravatar_id":"","url":"https://api.github.com/users/pazz","html_url":"https://github.com/pazz","followers_url":"https://api.github.com/users/pazz/followers","following_url":"https://api.github.com/users/pazz/following{/other_user}","gists_url":"https://api.github.com/users/pazz/gists{/gist_id}","starred_url":"https://api.github.com/users/pazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pazz/subscriptions","organizations_url":"https://api.github.com/users/pazz/orgs","repos_url":"https://api.github.com/users/pazz/repos","events_url":"https://api.github.com/users/pazz/events{/privacy}","received_events_url":"https://api.github.com/users/pazz/received_events","type":"User","site_admin":false},"repo":{"id":2197977,"name":"alot","full_name":"pazz/alot","owner":{"login":"pazz","id":628455,"avatar_url":"https://avatars.githubusercontent.com/u/628455?v=3","gravatar_id":"","url":"https://api.github.com/users/pazz","html_url":"https://github.com/pazz","followers_url":"https://api.github.com/users/pazz/followers","following_url":"https://api.github.com/users/pazz/following{/other_user}","gists_url":"https://api.github.com/users/pazz/gists{/gist_id}","starred_url":"https://api.github.com/users/pazz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pazz/subscriptions","organizations_url":"https://api.github.com/users/pazz/orgs","repos_url":"https://api.github.com/users/pazz/repos","events_url":"https://api.github.com/users/pazz/events{/privacy}","received_events_url":"https://api.github.com/users/pazz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pazz/alot","description":"commandline MUA based on notmuch and urwid","fork":false,"url":"https://api.github.com/repos/pazz/alot","forks_url":"https://api.github.com/repos/pazz/alot/forks","keys_url":"https://api.github.com/repos/pazz/alot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pazz/alot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pazz/alot/teams","hooks_url":"https://api.github.com/repos/pazz/alot/hooks","issue_events_url":"https://api.github.com/repos/pazz/alot/issues/events{/number}","events_url":"https://api.github.com/repos/pazz/alot/events","assignees_url":"https://api.github.com/repos/pazz/alot/assignees{/user}","branches_url":"https://api.github.com/repos/pazz/alot/branches{/branch}","tags_url":"https://api.github.com/repos/pazz/alot/tags","blobs_url":"https://api.github.com/repos/pazz/alot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pazz/alot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pazz/alot/git/refs{/sha}","trees_url":"https://api.github.com/repos/pazz/alot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pazz/alot/statuses/{sha}","languages_url":"https://api.github.com/repos/pazz/alot/languages","stargazers_url":"https://api.github.com/repos/pazz/alot/stargazers","contributors_url":"https://api.github.com/repos/pazz/alot/contributors","subscribers_url":"https://api.github.com/repos/pazz/alot/subscribers","subscription_url":"https://api.github.com/repos/pazz/alot/subscription","commits_url":"https://api.github.com/repos/pazz/alot/commits{/sha}","git_commits_url":"https://api.github.com/repos/pazz/alot/git/commits{/sha}","comments_url":"https://api.github.com/repos/pazz/alot/comments{/number}","issue_comment_url":"https://api.github.com/repos/pazz/alot/issues/comments{/number}","contents_url":"https://api.github.com/repos/pazz/alot/contents/{+path}","compare_url":"https://api.github.com/repos/pazz/alot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pazz/alot/merges","archive_url":"https://api.github.com/repos/pazz/alot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pazz/alot/downloads","issues_url":"https://api.github.com/repos/pazz/alot/issues{/number}","pulls_url":"https://api.github.com/repos/pazz/alot/pulls{/number}","milestones_url":"https://api.github.com/repos/pazz/alot/milestones{/number}","notifications_url":"https://api.github.com/repos/pazz/alot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pazz/alot/labels{/name}","releases_url":"https://api.github.com/repos/pazz/alot/releases{/id}","deployments_url":"https://api.github.com/repos/pazz/alot/deployments","created_at":"2011-08-12T16:22:37Z","updated_at":"2017-01-26T13:15:10Z","pushed_at":"2017-01-28T16:13:44Z","git_url":"git://github.com/pazz/alot.git","ssh_url":"git@github.com:pazz/alot.git","clone_url":"https://github.com/pazz/alot.git","svn_url":"https://github.com/pazz/alot","homepage":"","size":7057,"stargazers_count":311,"watchers_count":311,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":89,"mirror_url":null,"open_issues_count":165,"forks":89,"open_issues":165,"watchers":311,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pazz/alot/pulls/1015"},"html":{"href":"https://github.com/pazz/alot/pull/1015"},"issue":{"href":"https://api.github.com/repos/pazz/alot/issues/1015"},"comments":{"href":"https://api.github.com/repos/pazz/alot/issues/1015/comments"},"review_comments":{"href":"https://api.github.com/repos/pazz/alot/pulls/1015/comments"},"review_comment":{"href":"https://api.github.com/repos/pazz/alot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pazz/alot/pulls/1015/commits"},"statuses":{"href":"https://api.github.com/repos/pazz/alot/statuses/cdf30c2c35503cfd6f549fb2d007dd09514b47da"}}}}
{"actor":{"display_login":"codacy-bot"}}