{"action":"created","comment":{"url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/comments/84419302","pull_request_review_id":5199356,"id":84419302,"diff_hunk":"@@ -0,0 +1,56 @@\n+import csv\n+from csv import Dialect\n+import sys\n+from hashlib import md5\n+\n+def read_csv(filename):\n+\t'''Reader csv files with header. General function that can be reused'''\n+\twith open(filename, newline='') as csv_file:\n+\t\t# Read the header from first line\n+\t\theader = csv_file.readline().rstrip().split(',')\n+\t\t# Read the csv using the header obtained above\n+\t\tcsv_reader = csv.DictReader(csv_file, delimiter = ',', fieldnames = header)\n+\t\tfor row in csv_reader:\n+\t\t\tyield(row)\n+\n+def generate_md5(*args):\n+\t'''Generate md5 from list of strings. General function that can be reused'''\n+\tm = md5()\n+\tfor i in args:\n+\t\t# Encode first\n+\t\ti_enc = i.encode('utf-8')\n+\t\tm.update(i_enc)\n+\treturn m.digest()\n+\n+def week4_csv_to_dict(csv_rows):\n+\t'''Convert an iterator of rows into dictionary\n+\twith key as hash of the whole row. This function is not generic \n+\tand can be used for week0004 practice only'''\n+\tresult = dict()\n+\tfor row in csv_rows:\n+\t\tmd5_email = generate_md5(row['email'])\n+\t\t#only add into dict if email is not used. Skip those duplicate emails\n+\t\tif not md5_email in list(result.keys()):\n+\t\t\tresult[md5_email] = row\n+\treturn result\n+\n+\n+def week4_match_sources():\n+\t'''Match the 2 input file and return the people\n+\twho subscribe to both'''\n+\tfile1 = sys.argv[1]\n+\tfile2 = sys.argv[2]\n+\tsource1 = week4_csv_to_dict(read_csv(file1))\n+\tsource2 = week4_csv_to_dict(read_csv(file2))\n+\tfor key in set(source1.keys()):\n+\t\tif key in set(source2.keys()):\n+\t\t\tif source1[key]['fname'] == source2[key]['fname'] and source1[key]['lname'] == source2[key]['lname']:\n+\t\t\t\tyield(source1[key])\n+\n+def week4_output():\n+\t'''Outout list of duplicate guests to file'''","path":"week0004/hienhpss/python/week0004.py","position":51,"original_position":51,"commit_id":"2fcc2477f803f0eca83b72fdc78f12a3bd33f322","original_commit_id":"2fcc2477f803f0eca83b72fdc78f12a3bd33f322","user":{"login":"vietlq","id":197199,"avatar_url":"https://avatars.githubusercontent.com/u/197199?v=3","gravatar_id":"","url":"https://api.github.com/users/vietlq","html_url":"https://github.com/vietlq","followers_url":"https://api.github.com/users/vietlq/followers","following_url":"https://api.github.com/users/vietlq/following{/other_user}","gists_url":"https://api.github.com/users/vietlq/gists{/gist_id}","starred_url":"https://api.github.com/users/vietlq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vietlq/subscriptions","organizations_url":"https://api.github.com/users/vietlq/orgs","repos_url":"https://api.github.com/users/vietlq/repos","events_url":"https://api.github.com/users/vietlq/events{/privacy}","received_events_url":"https://api.github.com/users/vietlq/received_events","type":"User","site_admin":false},"body":"Spelling error","created_at":"2016-10-21T05:00:53Z","updated_at":"2016-10-21T05:00:53Z","html_url":"https://github.com/DevVietRaKhoi/weekly/pull/51#discussion_r84419302","pull_request_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/comments/84419302"},"html":{"href":"https://github.com/DevVietRaKhoi/weekly/pull/51#discussion_r84419302"},"pull_request":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51","id":90029583,"html_url":"https://github.com/DevVietRaKhoi/weekly/pull/51","diff_url":"https://github.com/DevVietRaKhoi/weekly/pull/51.diff","patch_url":"https://github.com/DevVietRaKhoi/weekly/pull/51.patch","issue_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/51","number":51,"state":"open","locked":false,"title":"Week4 hienhpss","user":{"login":"hienhpss","id":20580628,"avatar_url":"https://avatars.githubusercontent.com/u/20580628?v=3","gravatar_id":"","url":"https://api.github.com/users/hienhpss","html_url":"https://github.com/hienhpss","followers_url":"https://api.github.com/users/hienhpss/followers","following_url":"https://api.github.com/users/hienhpss/following{/other_user}","gists_url":"https://api.github.com/users/hienhpss/gists{/gist_id}","starred_url":"https://api.github.com/users/hienhpss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hienhpss/subscriptions","organizations_url":"https://api.github.com/users/hienhpss/orgs","repos_url":"https://api.github.com/users/hienhpss/repos","events_url":"https://api.github.com/users/hienhpss/events{/privacy}","received_events_url":"https://api.github.com/users/hienhpss/received_events","type":"User","site_admin":false},"body":"Week 4 solution","created_at":"2016-10-19T15:09:42Z","updated_at":"2016-10-21T05:00:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44b0990c9b8edd681a8e816082d59eda81dd5eab","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51/commits","review_comments_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51/comments","review_comment_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/51/comments","statuses_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/statuses/2fcc2477f803f0eca83b72fdc78f12a3bd33f322","head":{"label":"hienhpss:week4_hienhpss","ref":"week4_hienhpss","sha":"2fcc2477f803f0eca83b72fdc78f12a3bd33f322","user":{"login":"hienhpss","id":20580628,"avatar_url":"https://avatars.githubusercontent.com/u/20580628?v=3","gravatar_id":"","url":"https://api.github.com/users/hienhpss","html_url":"https://github.com/hienhpss","followers_url":"https://api.github.com/users/hienhpss/followers","following_url":"https://api.github.com/users/hienhpss/following{/other_user}","gists_url":"https://api.github.com/users/hienhpss/gists{/gist_id}","starred_url":"https://api.github.com/users/hienhpss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hienhpss/subscriptions","organizations_url":"https://api.github.com/users/hienhpss/orgs","repos_url":"https://api.github.com/users/hienhpss/repos","events_url":"https://api.github.com/users/hienhpss/events{/privacy}","received_events_url":"https://api.github.com/users/hienhpss/received_events","type":"User","site_admin":false},"repo":{"id":69589493,"name":"weekly","full_name":"hienhpss/weekly","owner":{"login":"hienhpss","id":20580628,"avatar_url":"https://avatars.githubusercontent.com/u/20580628?v=3","gravatar_id":"","url":"https://api.github.com/users/hienhpss","html_url":"https://github.com/hienhpss","followers_url":"https://api.github.com/users/hienhpss/followers","following_url":"https://api.github.com/users/hienhpss/following{/other_user}","gists_url":"https://api.github.com/users/hienhpss/gists{/gist_id}","starred_url":"https://api.github.com/users/hienhpss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hienhpss/subscriptions","organizations_url":"https://api.github.com/users/hienhpss/orgs","repos_url":"https://api.github.com/users/hienhpss/repos","events_url":"https://api.github.com/users/hienhpss/events{/privacy}","received_events_url":"https://api.github.com/users/hienhpss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hienhpss/weekly","description":"Repo for weekly quizzes","fork":true,"url":"https://api.github.com/repos/hienhpss/weekly","forks_url":"https://api.github.com/repos/hienhpss/weekly/forks","keys_url":"https://api.github.com/repos/hienhpss/weekly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hienhpss/weekly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hienhpss/weekly/teams","hooks_url":"https://api.github.com/repos/hienhpss/weekly/hooks","issue_events_url":"https://api.github.com/repos/hienhpss/weekly/issues/events{/number}","events_url":"https://api.github.com/repos/hienhpss/weekly/events","assignees_url":"https://api.github.com/repos/hienhpss/weekly/assignees{/user}","branches_url":"https://api.github.com/repos/hienhpss/weekly/branches{/branch}","tags_url":"https://api.github.com/repos/hienhpss/weekly/tags","blobs_url":"https://api.github.com/repos/hienhpss/weekly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hienhpss/weekly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hienhpss/weekly/git/refs{/sha}","trees_url":"https://api.github.com/repos/hienhpss/weekly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hienhpss/weekly/statuses/{sha}","languages_url":"https://api.github.com/repos/hienhpss/weekly/languages","stargazers_url":"https://api.github.com/repos/hienhpss/weekly/stargazers","contributors_url":"https://api.github.com/repos/hienhpss/weekly/contributors","subscribers_url":"https://api.github.com/repos/hienhpss/weekly/subscribers","subscription_url":"https://api.github.com/repos/hienhpss/weekly/subscription","commits_url":"https://api.github.com/repos/hienhpss/weekly/commits{/sha}","git_commits_url":"https://api.github.com/repos/hienhpss/weekly/git/commits{/sha}","comments_url":"https://api.github.com/repos/hienhpss/weekly/comments{/number}","issue_comment_url":"https://api.github.com/repos/hienhpss/weekly/issues/comments{/number}","contents_url":"https://api.github.com/repos/hienhpss/weekly/contents/{+path}","compare_url":"https://api.github.com/repos/hienhpss/weekly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hienhpss/weekly/merges","archive_url":"https://api.github.com/repos/hienhpss/weekly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hienhpss/weekly/downloads","issues_url":"https://api.github.com/repos/hienhpss/weekly/issues{/number}","pulls_url":"https://api.github.com/repos/hienhpss/weekly/pulls{/number}","milestones_url":"https://api.github.com/repos/hienhpss/weekly/milestones{/number}","notifications_url":"https://api.github.com/repos/hienhpss/weekly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hienhpss/weekly/labels{/name}","releases_url":"https://api.github.com/repos/hienhpss/weekly/releases{/id}","deployments_url":"https://api.github.com/repos/hienhpss/weekly/deployments","created_at":"2016-09-29T17:09:27Z","updated_at":"2016-10-06T07:29:56Z","pushed_at":"2016-10-19T15:08:44Z","git_url":"git://github.com/hienhpss/weekly.git","ssh_url":"git@github.com:hienhpss/weekly.git","clone_url":"https://github.com/hienhpss/weekly.git","svn_url":"https://github.com/hienhpss/weekly","homepage":null,"size":72,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"DevVietRaKhoi:master","ref":"master","sha":"c525e9bf0734440c4a1c9d099eb8e44b968c02d7","user":{"login":"DevVietRaKhoi","id":22433432,"avatar_url":"https://avatars.githubusercontent.com/u/22433432?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVietRaKhoi","html_url":"https://github.com/DevVietRaKhoi","followers_url":"https://api.github.com/users/DevVietRaKhoi/followers","following_url":"https://api.github.com/users/DevVietRaKhoi/following{/other_user}","gists_url":"https://api.github.com/users/DevVietRaKhoi/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVietRaKhoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVietRaKhoi/subscriptions","organizations_url":"https://api.github.com/users/DevVietRaKhoi/orgs","repos_url":"https://api.github.com/users/DevVietRaKhoi/repos","events_url":"https://api.github.com/users/DevVietRaKhoi/events{/privacy}","received_events_url":"https://api.github.com/users/DevVietRaKhoi/received_events","type":"Organization","site_admin":false},"repo":{"id":69185033,"name":"weekly","full_name":"DevVietRaKhoi/weekly","owner":{"login":"DevVietRaKhoi","id":22433432,"avatar_url":"https://avatars.githubusercontent.com/u/22433432?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVietRaKhoi","html_url":"https://github.com/DevVietRaKhoi","followers_url":"https://api.github.com/users/DevVietRaKhoi/followers","following_url":"https://api.github.com/users/DevVietRaKhoi/following{/other_user}","gists_url":"https://api.github.com/users/DevVietRaKhoi/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVietRaKhoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVietRaKhoi/subscriptions","organizations_url":"https://api.github.com/users/DevVietRaKhoi/orgs","repos_url":"https://api.github.com/users/DevVietRaKhoi/repos","events_url":"https://api.github.com/users/DevVietRaKhoi/events{/privacy}","received_events_url":"https://api.github.com/users/DevVietRaKhoi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DevVietRaKhoi/weekly","description":"Repo for weekly quizzes","fork":false,"url":"https://api.github.com/repos/DevVietRaKhoi/weekly","forks_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/forks","keys_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/teams","hooks_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/hooks","issue_events_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/events{/number}","events_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/events","assignees_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/assignees{/user}","branches_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/branches{/branch}","tags_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/tags","blobs_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/git/refs{/sha}","trees_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/statuses/{sha}","languages_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/languages","stargazers_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/stargazers","contributors_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/contributors","subscribers_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/subscribers","subscription_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/subscription","commits_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/commits{/sha}","git_commits_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/git/commits{/sha}","comments_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/comments{/number}","issue_comment_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/comments{/number}","contents_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/contents/{+path}","compare_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/merges","archive_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/downloads","issues_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues{/number}","pulls_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls{/number}","milestones_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/milestones{/number}","notifications_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/labels{/name}","releases_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/releases{/id}","deployments_url":"https://api.github.com/repos/DevVietRaKhoi/weekly/deployments","created_at":"2016-09-25T19:14:45Z","updated_at":"2016-10-19T17:23:48Z","pushed_at":"2016-10-21T00:45:37Z","git_url":"git://github.com/DevVietRaKhoi/weekly.git","ssh_url":"git@github.com:DevVietRaKhoi/weekly.git","clone_url":"https://github.com/DevVietRaKhoi/weekly.git","svn_url":"https://github.com/DevVietRaKhoi/weekly","homepage":null,"size":165,"stargazers_count":11,"watchers_count":11,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":7,"forks":28,"open_issues":7,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51"},"html":{"href":"https://github.com/DevVietRaKhoi/weekly/pull/51"},"issue":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/51"},"comments":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/DevVietRaKhoi/weekly/statuses/2fcc2477f803f0eca83b72fdc78f12a3bd33f322"}}}}
{"actor":{"display_login":"vietlq"}}