{"action":"created","comment":{"url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/comments/30846408","id":30846408,"diff_hunk":"@@ -0,0 +1,33 @@\n+# -*- coding: utf-8 -*-\n+\n+from brutal.core.plugin import cmd\n+from datetime import datetime\n+import admanbot.plugins.calendar_sk as calendar_sk\n+\n+\n+@cmd\n+def sup(event):\n+    \"\"\"Inform you about current day\"\"\"\n+    today = datetime.today()\n+\n+    day = today.day\n+    month = today.month\n+\n+    name = calendar_sk.NAMEDAY[month-1][day-1]\n+\n+    try:\n+        hol = calendar_sk.holiday[str(month)][str(day)]\n+    except KeyError:\n+        hol = None\n+\n+    try:\n+        intday = calendar_sk.INTERNATIONAL_DAY[str(month)][str(day)]\n+    except KeyError:\n+        intday = None\n+\n+    name_str = '' if name is None else ', Nameday: {0}'.format(name)\n+    hol_str = '' if hol is None else ', {0}'.format(hol)\n+    intday_str = '' if intday is None else ', {0}'.format(intday)","path":"sup.py","position":30,"original_position":30,"commit_id":"a13a82224cad2fef060d2ad9cfc3f832f191b59f","original_commit_id":"a13a82224cad2fef060d2ad9cfc3f832f191b59f","user":{"login":"pepol","id":198600,"avatar_url":"https://avatars.githubusercontent.com/u/198600?v=3","gravatar_id":"","url":"https://api.github.com/users/pepol","html_url":"https://github.com/pepol","followers_url":"https://api.github.com/users/pepol/followers","following_url":"https://api.github.com/users/pepol/following{/other_user}","gists_url":"https://api.github.com/users/pepol/gists{/gist_id}","starred_url":"https://api.github.com/users/pepol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pepol/subscriptions","organizations_url":"https://api.github.com/users/pepol/orgs","repos_url":"https://api.github.com/users/pepol/repos","events_url":"https://api.github.com/users/pepol/events{/privacy}","received_events_url":"https://api.github.com/users/pepol/received_events","type":"User","site_admin":false},"body":"Wouldn't it be better, instead of `try ... except ...` and these `if`s, to use the `dict.get` method, which takes (optional) second parameter, value to be returned if no such key exists? Also, why not put empty strings to nameday calendar instead of `None`s?","created_at":"2015-05-21T20:53:10Z","updated_at":"2015-05-21T20:53:10Z","html_url":"https://github.com/mrshu/brutal-plugins/pull/103#discussion_r30846408","pull_request_url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/comments/30846408"},"html":{"href":"https://github.com/mrshu/brutal-plugins/pull/103#discussion_r30846408"},"pull_request":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103","id":35975438,"html_url":"https://github.com/mrshu/brutal-plugins/pull/103","diff_url":"https://github.com/mrshu/brutal-plugins/pull/103.diff","patch_url":"https://github.com/mrshu/brutal-plugins/pull/103.patch","issue_url":"https://api.github.com/repos/mrshu/brutal-plugins/issues/103","number":103,"state":"open","locked":false,"title":"sup: know the info about current day","user":{"login":"Adman","id":865063,"avatar_url":"https://avatars.githubusercontent.com/u/865063?v=3","gravatar_id":"","url":"https://api.github.com/users/Adman","html_url":"https://github.com/Adman","followers_url":"https://api.github.com/users/Adman/followers","following_url":"https://api.github.com/users/Adman/following{/other_user}","gists_url":"https://api.github.com/users/Adman/gists{/gist_id}","starred_url":"https://api.github.com/users/Adman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Adman/subscriptions","organizations_url":"https://api.github.com/users/Adman/orgs","repos_url":"https://api.github.com/users/Adman/repos","events_url":"https://api.github.com/users/Adman/events{/privacy}","received_events_url":"https://api.github.com/users/Adman/received_events","type":"User","site_admin":false},"body":"* shows weekday, date, nameday, holiday and\r\n  international day\r\n* possibility to make other countries config\r\n\r\nSigned-off-by: Adrian Matejov <a.matejov@centrum.sk>","created_at":"2015-05-21T20:44:08Z","updated_at":"2015-05-21T20:53:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ecda56f0e8202babd3052d024f7d134bd5dbda5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103/commits","review_comments_url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103/comments","review_comment_url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrshu/brutal-plugins/issues/103/comments","statuses_url":"https://api.github.com/repos/mrshu/brutal-plugins/statuses/a13a82224cad2fef060d2ad9cfc3f832f191b59f","head":{"label":"Adman:sup","ref":"sup","sha":"a13a82224cad2fef060d2ad9cfc3f832f191b59f","user":{"login":"Adman","id":865063,"avatar_url":"https://avatars.githubusercontent.com/u/865063?v=3","gravatar_id":"","url":"https://api.github.com/users/Adman","html_url":"https://github.com/Adman","followers_url":"https://api.github.com/users/Adman/followers","following_url":"https://api.github.com/users/Adman/following{/other_user}","gists_url":"https://api.github.com/users/Adman/gists{/gist_id}","starred_url":"https://api.github.com/users/Adman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Adman/subscriptions","organizations_url":"https://api.github.com/users/Adman/orgs","repos_url":"https://api.github.com/users/Adman/repos","events_url":"https://api.github.com/users/Adman/events{/privacy}","received_events_url":"https://api.github.com/users/Adman/received_events","type":"User","site_admin":false},"repo":{"id":27332225,"name":"brutal-plugins","full_name":"Adman/brutal-plugins","owner":{"login":"Adman","id":865063,"avatar_url":"https://avatars.githubusercontent.com/u/865063?v=3","gravatar_id":"","url":"https://api.github.com/users/Adman","html_url":"https://github.com/Adman","followers_url":"https://api.github.com/users/Adman/followers","following_url":"https://api.github.com/users/Adman/following{/other_user}","gists_url":"https://api.github.com/users/Adman/gists{/gist_id}","starred_url":"https://api.github.com/users/Adman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Adman/subscriptions","organizations_url":"https://api.github.com/users/Adman/orgs","repos_url":"https://api.github.com/users/Adman/repos","events_url":"https://api.github.com/users/Adman/events{/privacy}","received_events_url":"https://api.github.com/users/Adman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Adman/brutal-plugins","description":"A set of plugins for brutal, the mighty chatbot","fork":true,"url":"https://api.github.com/repos/Adman/brutal-plugins","forks_url":"https://api.github.com/repos/Adman/brutal-plugins/forks","keys_url":"https://api.github.com/repos/Adman/brutal-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Adman/brutal-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Adman/brutal-plugins/teams","hooks_url":"https://api.github.com/repos/Adman/brutal-plugins/hooks","issue_events_url":"https://api.github.com/repos/Adman/brutal-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/Adman/brutal-plugins/events","assignees_url":"https://api.github.com/repos/Adman/brutal-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/Adman/brutal-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/Adman/brutal-plugins/tags","blobs_url":"https://api.github.com/repos/Adman/brutal-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Adman/brutal-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Adman/brutal-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/Adman/brutal-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Adman/brutal-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/Adman/brutal-plugins/languages","stargazers_url":"https://api.github.com/repos/Adman/brutal-plugins/stargazers","contributors_url":"https://api.github.com/repos/Adman/brutal-plugins/contributors","subscribers_url":"https://api.github.com/repos/Adman/brutal-plugins/subscribers","subscription_url":"https://api.github.com/repos/Adman/brutal-plugins/subscription","commits_url":"https://api.github.com/repos/Adman/brutal-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/Adman/brutal-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/Adman/brutal-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/Adman/brutal-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/Adman/brutal-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/Adman/brutal-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Adman/brutal-plugins/merges","archive_url":"https://api.github.com/repos/Adman/brutal-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Adman/brutal-plugins/downloads","issues_url":"https://api.github.com/repos/Adman/brutal-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/Adman/brutal-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/Adman/brutal-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/Adman/brutal-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Adman/brutal-plugins/labels{/name}","releases_url":"https://api.github.com/repos/Adman/brutal-plugins/releases{/id}","created_at":"2014-11-30T10:40:37Z","updated_at":"2014-12-08T18:27:58Z","pushed_at":"2015-05-21T20:43:36Z","git_url":"git://github.com/Adman/brutal-plugins.git","ssh_url":"git@github.com:Adman/brutal-plugins.git","clone_url":"https://github.com/Adman/brutal-plugins.git","svn_url":"https://github.com/Adman/brutal-plugins","homepage":null,"size":433,"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":"mrshu:master","ref":"master","sha":"0881e0b64e53bed7d167ef30cb6ee96fa1c928bc","user":{"login":"mrshu","id":461491,"avatar_url":"https://avatars.githubusercontent.com/u/461491?v=3","gravatar_id":"","url":"https://api.github.com/users/mrshu","html_url":"https://github.com/mrshu","followers_url":"https://api.github.com/users/mrshu/followers","following_url":"https://api.github.com/users/mrshu/following{/other_user}","gists_url":"https://api.github.com/users/mrshu/gists{/gist_id}","starred_url":"https://api.github.com/users/mrshu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrshu/subscriptions","organizations_url":"https://api.github.com/users/mrshu/orgs","repos_url":"https://api.github.com/users/mrshu/repos","events_url":"https://api.github.com/users/mrshu/events{/privacy}","received_events_url":"https://api.github.com/users/mrshu/received_events","type":"User","site_admin":false},"repo":{"id":25275383,"name":"brutal-plugins","full_name":"mrshu/brutal-plugins","owner":{"login":"mrshu","id":461491,"avatar_url":"https://avatars.githubusercontent.com/u/461491?v=3","gravatar_id":"","url":"https://api.github.com/users/mrshu","html_url":"https://github.com/mrshu","followers_url":"https://api.github.com/users/mrshu/followers","following_url":"https://api.github.com/users/mrshu/following{/other_user}","gists_url":"https://api.github.com/users/mrshu/gists{/gist_id}","starred_url":"https://api.github.com/users/mrshu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrshu/subscriptions","organizations_url":"https://api.github.com/users/mrshu/orgs","repos_url":"https://api.github.com/users/mrshu/repos","events_url":"https://api.github.com/users/mrshu/events{/privacy}","received_events_url":"https://api.github.com/users/mrshu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrshu/brutal-plugins","description":"A set of plugins for brutal, the mighty chatbot","fork":false,"url":"https://api.github.com/repos/mrshu/brutal-plugins","forks_url":"https://api.github.com/repos/mrshu/brutal-plugins/forks","keys_url":"https://api.github.com/repos/mrshu/brutal-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrshu/brutal-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrshu/brutal-plugins/teams","hooks_url":"https://api.github.com/repos/mrshu/brutal-plugins/hooks","issue_events_url":"https://api.github.com/repos/mrshu/brutal-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/mrshu/brutal-plugins/events","assignees_url":"https://api.github.com/repos/mrshu/brutal-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/mrshu/brutal-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/mrshu/brutal-plugins/tags","blobs_url":"https://api.github.com/repos/mrshu/brutal-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrshu/brutal-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrshu/brutal-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrshu/brutal-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrshu/brutal-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/mrshu/brutal-plugins/languages","stargazers_url":"https://api.github.com/repos/mrshu/brutal-plugins/stargazers","contributors_url":"https://api.github.com/repos/mrshu/brutal-plugins/contributors","subscribers_url":"https://api.github.com/repos/mrshu/brutal-plugins/subscribers","subscription_url":"https://api.github.com/repos/mrshu/brutal-plugins/subscription","commits_url":"https://api.github.com/repos/mrshu/brutal-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrshu/brutal-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrshu/brutal-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrshu/brutal-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrshu/brutal-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/mrshu/brutal-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrshu/brutal-plugins/merges","archive_url":"https://api.github.com/repos/mrshu/brutal-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrshu/brutal-plugins/downloads","issues_url":"https://api.github.com/repos/mrshu/brutal-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/mrshu/brutal-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/mrshu/brutal-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/mrshu/brutal-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrshu/brutal-plugins/labels{/name}","releases_url":"https://api.github.com/repos/mrshu/brutal-plugins/releases{/id}","created_at":"2014-10-15T21:58:44Z","updated_at":"2015-05-04T21:08:27Z","pushed_at":"2015-05-21T20:44:08Z","git_url":"git://github.com/mrshu/brutal-plugins.git","ssh_url":"git@github.com:mrshu/brutal-plugins.git","clone_url":"https://github.com/mrshu/brutal-plugins.git","svn_url":"https://github.com/mrshu/brutal-plugins","homepage":null,"size":1833,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":12,"forks":3,"open_issues":12,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103"},"html":{"href":"https://github.com/mrshu/brutal-plugins/pull/103"},"issue":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/issues/103"},"comments":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/mrshu/brutal-plugins/statuses/a13a82224cad2fef060d2ad9cfc3f832f191b59f"}}}}