{"action":"created","comment":{"url":"https://api.github.com/repos/clessor88/mailroom/pulls/comments/74852702","id":74852702,"diff_hunk":"@@ -0,0 +1,121 @@\n+# -*- coding: utf-8 -*-\n+from __future__ import unicode_literals\n+from __future__ import print_function\n+try:\n+    input = raw_input\n+except NameError:\n+    pass\n+\n+donor_list = {\n+    ('lessor', 'crystal'): [10, 40, 25],\n+    ('harrison', 'mike'): [30, 40, 15],\n+    ('smith', 'john'): [10, 25],\n+    ('python', 'monty'): [42],\n+}\n+\n+\n+def sort_donors(lst):\n+    \"\"\"Turn donors into list and sorts in decending order.\"\"\"\n+    sorted_donors = sorted(donor_list, key=lambda x: sum(donor_list[x]), reverse=True)\n+    new_list = []\n+    for k in sorted_donors:\n+        avg = float((sum(donor_list[k])) / len(donor_list[k]))\n+        donor_info = (k, donor_list[k], avg, )\n+        new_list.append(donor_info)\n+    return new_list\n+\n+\n+def prettyfy(lst):\n+    \"\"\"\"Take a list and print out a petty series of strings.\"\"\"\n+    print(('Name' + ' ' * 16)+'||'+('History'+' '*13)+'||'+'Avg Donation')\n+    for item in lst:\n+        name = (\"{}, {}\".format(item[0][0].capitalize(), item[0][1].capitalize())+\" \"*10)[:20]\n+        history = ((str(item[1]))[1:-1] + (' ' * 40))[:20]\n+        avg = str(round(float(item[2]), 2))\n+        print(name + '||' + history + '||' + avg)\n+    welcome_prompt()\n+\n+\n+def get_list():\n+    \"\"\"Loop through dictionary and print names.\"\"\"\n+    for key in donor_list:\n+        print(\"{},{}\".format(key[0], key[1]))\n+    return validate_last_name(get_last_name())\n+\n+\n+def get_first_name():\n+    \"\"\"Get first name.\"\"\"\n+    return input(u\"Please enter first name:\")\n+\n+\n+def validate_first_name(first_name):\n+    \"\"\"Validate first name.\"\"\"\n+    if first_name.isalpha():\n+        return first_name\n+    else:\n+        print(u'Please type only letters')\n+        return validate_first_name(get_first_name())\n+\n+\n+def get_last_name():\n+    \"\"\"Get Last name from input.\"\"\"\n+    return input(u\"Please enter last name, or type list for list of donors:\")\n+\n+\n+def validate_last_name(last_name):\n+    \"\"\"Validate last name to be valid.\"\"\"\n+    if last_name.isalpha():\n+        if last_name.lower() == 'list':\n+            return get_list()\n+        elif last_name.lower() == 'q':\n+            return welcome_prompt()\n+        else:\n+            return last_name\n+    else:\n+        print(u'Please type only letters')\n+        return validate_last_name(get_last_name())\n+\n+\n+def get_amount():\n+    \"\"\"Get amount of donation.\"\"\"\n+    return input(u\"Please enter donation amount:\")\n+\n+\n+def validate_amt(amt):\n+    \"\"\"Validate if amt is a number.\"\"\"\n+    if amt.isdigit():\n+        return int(amt)\n+    else:\n+        print(u'Please enter only numbers')\n+        return validate_amt(get_amount())","path":"src/mailroom.py","position":90,"original_position":90,"commit_id":"1a6a9fac0d2f6b364192ce4b0819e7b0cfca2208","original_commit_id":"1a6a9fac0d2f6b364192ce4b0819e7b0cfca2208","user":{"login":"cewing","id":417109,"avatar_url":"https://avatars.githubusercontent.com/u/417109?v=3","gravatar_id":"","url":"https://api.github.com/users/cewing","html_url":"https://github.com/cewing","followers_url":"https://api.github.com/users/cewing/followers","following_url":"https://api.github.com/users/cewing/following{/other_user}","gists_url":"https://api.github.com/users/cewing/gists{/gist_id}","starred_url":"https://api.github.com/users/cewing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cewing/subscriptions","organizations_url":"https://api.github.com/users/cewing/orgs","repos_url":"https://api.github.com/users/cewing/repos","events_url":"https://api.github.com/users/cewing/events{/privacy}","received_events_url":"https://api.github.com/users/cewing/received_events","type":"User","site_admin":false},"body":"again, because of the recursion here, your function for validating the input from the user is dependent on calling the function that gets input from the user.  This blows the independence from `input`.","created_at":"2016-08-15T23:15:26Z","updated_at":"2016-08-15T23:15:26Z","html_url":"https://github.com/clessor88/mailroom/pull/1#discussion_r74852702","pull_request_url":"https://api.github.com/repos/clessor88/mailroom/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/comments/74852702"},"html":{"href":"https://github.com/clessor88/mailroom/pull/1#discussion_r74852702"},"pull_request":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/clessor88/mailroom/pulls/1","id":81278329,"html_url":"https://github.com/clessor88/mailroom/pull/1","diff_url":"https://github.com/clessor88/mailroom/pull/1.diff","patch_url":"https://github.com/clessor88/mailroom/pull/1.patch","issue_url":"https://api.github.com/repos/clessor88/mailroom/issues/1","number":1,"state":"open","locked":false,"title":"Cleanup","user":{"login":"Mikekh84","id":14828777,"avatar_url":"https://avatars.githubusercontent.com/u/14828777?v=3","gravatar_id":"","url":"https://api.github.com/users/Mikekh84","html_url":"https://github.com/Mikekh84","followers_url":"https://api.github.com/users/Mikekh84/followers","following_url":"https://api.github.com/users/Mikekh84/following{/other_user}","gists_url":"https://api.github.com/users/Mikekh84/gists{/gist_id}","starred_url":"https://api.github.com/users/Mikekh84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mikekh84/subscriptions","organizations_url":"https://api.github.com/users/Mikekh84/orgs","repos_url":"https://api.github.com/users/Mikekh84/repos","events_url":"https://api.github.com/users/Mikekh84/events{/privacy}","received_events_url":"https://api.github.com/users/Mikekh84/received_events","type":"User","site_admin":false},"body":"Tox mostly working. Only a few tests but tests pass python3. Mailroom program works as far as I can tell. \r\n","created_at":"2016-08-15T07:22:46Z","updated_at":"2016-08-15T23:15:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b64ab0d396a89a8aee7f9f7e057091fb1e08c86","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/clessor88/mailroom/pulls/1/commits","review_comments_url":"https://api.github.com/repos/clessor88/mailroom/pulls/1/comments","review_comment_url":"https://api.github.com/repos/clessor88/mailroom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clessor88/mailroom/issues/1/comments","statuses_url":"https://api.github.com/repos/clessor88/mailroom/statuses/1a6a9fac0d2f6b364192ce4b0819e7b0cfca2208","head":{"label":"clessor88:cleanup","ref":"cleanup","sha":"1a6a9fac0d2f6b364192ce4b0819e7b0cfca2208","user":{"login":"clessor88","id":14851569,"avatar_url":"https://avatars.githubusercontent.com/u/14851569?v=3","gravatar_id":"","url":"https://api.github.com/users/clessor88","html_url":"https://github.com/clessor88","followers_url":"https://api.github.com/users/clessor88/followers","following_url":"https://api.github.com/users/clessor88/following{/other_user}","gists_url":"https://api.github.com/users/clessor88/gists{/gist_id}","starred_url":"https://api.github.com/users/clessor88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clessor88/subscriptions","organizations_url":"https://api.github.com/users/clessor88/orgs","repos_url":"https://api.github.com/users/clessor88/repos","events_url":"https://api.github.com/users/clessor88/events{/privacy}","received_events_url":"https://api.github.com/users/clessor88/received_events","type":"User","site_admin":false},"repo":{"id":65499275,"name":"mailroom","full_name":"clessor88/mailroom","owner":{"login":"clessor88","id":14851569,"avatar_url":"https://avatars.githubusercontent.com/u/14851569?v=3","gravatar_id":"","url":"https://api.github.com/users/clessor88","html_url":"https://github.com/clessor88","followers_url":"https://api.github.com/users/clessor88/followers","following_url":"https://api.github.com/users/clessor88/following{/other_user}","gists_url":"https://api.github.com/users/clessor88/gists{/gist_id}","starred_url":"https://api.github.com/users/clessor88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clessor88/subscriptions","organizations_url":"https://api.github.com/users/clessor88/orgs","repos_url":"https://api.github.com/users/clessor88/repos","events_url":"https://api.github.com/users/clessor88/events{/privacy}","received_events_url":"https://api.github.com/users/clessor88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clessor88/mailroom","description":"program to autogenerate email for donors","fork":false,"url":"https://api.github.com/repos/clessor88/mailroom","forks_url":"https://api.github.com/repos/clessor88/mailroom/forks","keys_url":"https://api.github.com/repos/clessor88/mailroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clessor88/mailroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clessor88/mailroom/teams","hooks_url":"https://api.github.com/repos/clessor88/mailroom/hooks","issue_events_url":"https://api.github.com/repos/clessor88/mailroom/issues/events{/number}","events_url":"https://api.github.com/repos/clessor88/mailroom/events","assignees_url":"https://api.github.com/repos/clessor88/mailroom/assignees{/user}","branches_url":"https://api.github.com/repos/clessor88/mailroom/branches{/branch}","tags_url":"https://api.github.com/repos/clessor88/mailroom/tags","blobs_url":"https://api.github.com/repos/clessor88/mailroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clessor88/mailroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clessor88/mailroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/clessor88/mailroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clessor88/mailroom/statuses/{sha}","languages_url":"https://api.github.com/repos/clessor88/mailroom/languages","stargazers_url":"https://api.github.com/repos/clessor88/mailroom/stargazers","contributors_url":"https://api.github.com/repos/clessor88/mailroom/contributors","subscribers_url":"https://api.github.com/repos/clessor88/mailroom/subscribers","subscription_url":"https://api.github.com/repos/clessor88/mailroom/subscription","commits_url":"https://api.github.com/repos/clessor88/mailroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/clessor88/mailroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/clessor88/mailroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/clessor88/mailroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/clessor88/mailroom/contents/{+path}","compare_url":"https://api.github.com/repos/clessor88/mailroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clessor88/mailroom/merges","archive_url":"https://api.github.com/repos/clessor88/mailroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clessor88/mailroom/downloads","issues_url":"https://api.github.com/repos/clessor88/mailroom/issues{/number}","pulls_url":"https://api.github.com/repos/clessor88/mailroom/pulls{/number}","milestones_url":"https://api.github.com/repos/clessor88/mailroom/milestones{/number}","notifications_url":"https://api.github.com/repos/clessor88/mailroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clessor88/mailroom/labels{/name}","releases_url":"https://api.github.com/repos/clessor88/mailroom/releases{/id}","deployments_url":"https://api.github.com/repos/clessor88/mailroom/deployments","created_at":"2016-08-11T20:24:14Z","updated_at":"2016-08-11T20:24:14Z","pushed_at":"2016-08-15T07:22:47Z","git_url":"git://github.com/clessor88/mailroom.git","ssh_url":"git@github.com:clessor88/mailroom.git","clone_url":"https://github.com/clessor88/mailroom.git","svn_url":"https://github.com/clessor88/mailroom","homepage":null,"size":17,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"clessor88:master","ref":"master","sha":"5030fcb85d805878bdbc620304d56f2732032d02","user":{"login":"clessor88","id":14851569,"avatar_url":"https://avatars.githubusercontent.com/u/14851569?v=3","gravatar_id":"","url":"https://api.github.com/users/clessor88","html_url":"https://github.com/clessor88","followers_url":"https://api.github.com/users/clessor88/followers","following_url":"https://api.github.com/users/clessor88/following{/other_user}","gists_url":"https://api.github.com/users/clessor88/gists{/gist_id}","starred_url":"https://api.github.com/users/clessor88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clessor88/subscriptions","organizations_url":"https://api.github.com/users/clessor88/orgs","repos_url":"https://api.github.com/users/clessor88/repos","events_url":"https://api.github.com/users/clessor88/events{/privacy}","received_events_url":"https://api.github.com/users/clessor88/received_events","type":"User","site_admin":false},"repo":{"id":65499275,"name":"mailroom","full_name":"clessor88/mailroom","owner":{"login":"clessor88","id":14851569,"avatar_url":"https://avatars.githubusercontent.com/u/14851569?v=3","gravatar_id":"","url":"https://api.github.com/users/clessor88","html_url":"https://github.com/clessor88","followers_url":"https://api.github.com/users/clessor88/followers","following_url":"https://api.github.com/users/clessor88/following{/other_user}","gists_url":"https://api.github.com/users/clessor88/gists{/gist_id}","starred_url":"https://api.github.com/users/clessor88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clessor88/subscriptions","organizations_url":"https://api.github.com/users/clessor88/orgs","repos_url":"https://api.github.com/users/clessor88/repos","events_url":"https://api.github.com/users/clessor88/events{/privacy}","received_events_url":"https://api.github.com/users/clessor88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clessor88/mailroom","description":"program to autogenerate email for donors","fork":false,"url":"https://api.github.com/repos/clessor88/mailroom","forks_url":"https://api.github.com/repos/clessor88/mailroom/forks","keys_url":"https://api.github.com/repos/clessor88/mailroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clessor88/mailroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clessor88/mailroom/teams","hooks_url":"https://api.github.com/repos/clessor88/mailroom/hooks","issue_events_url":"https://api.github.com/repos/clessor88/mailroom/issues/events{/number}","events_url":"https://api.github.com/repos/clessor88/mailroom/events","assignees_url":"https://api.github.com/repos/clessor88/mailroom/assignees{/user}","branches_url":"https://api.github.com/repos/clessor88/mailroom/branches{/branch}","tags_url":"https://api.github.com/repos/clessor88/mailroom/tags","blobs_url":"https://api.github.com/repos/clessor88/mailroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clessor88/mailroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clessor88/mailroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/clessor88/mailroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clessor88/mailroom/statuses/{sha}","languages_url":"https://api.github.com/repos/clessor88/mailroom/languages","stargazers_url":"https://api.github.com/repos/clessor88/mailroom/stargazers","contributors_url":"https://api.github.com/repos/clessor88/mailroom/contributors","subscribers_url":"https://api.github.com/repos/clessor88/mailroom/subscribers","subscription_url":"https://api.github.com/repos/clessor88/mailroom/subscription","commits_url":"https://api.github.com/repos/clessor88/mailroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/clessor88/mailroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/clessor88/mailroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/clessor88/mailroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/clessor88/mailroom/contents/{+path}","compare_url":"https://api.github.com/repos/clessor88/mailroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clessor88/mailroom/merges","archive_url":"https://api.github.com/repos/clessor88/mailroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clessor88/mailroom/downloads","issues_url":"https://api.github.com/repos/clessor88/mailroom/issues{/number}","pulls_url":"https://api.github.com/repos/clessor88/mailroom/pulls{/number}","milestones_url":"https://api.github.com/repos/clessor88/mailroom/milestones{/number}","notifications_url":"https://api.github.com/repos/clessor88/mailroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clessor88/mailroom/labels{/name}","releases_url":"https://api.github.com/repos/clessor88/mailroom/releases{/id}","deployments_url":"https://api.github.com/repos/clessor88/mailroom/deployments","created_at":"2016-08-11T20:24:14Z","updated_at":"2016-08-11T20:24:14Z","pushed_at":"2016-08-15T07:22:47Z","git_url":"git://github.com/clessor88/mailroom.git","ssh_url":"git@github.com:clessor88/mailroom.git","clone_url":"https://github.com/clessor88/mailroom.git","svn_url":"https://github.com/clessor88/mailroom","homepage":null,"size":17,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/1"},"html":{"href":"https://github.com/clessor88/mailroom/pull/1"},"issue":{"href":"https://api.github.com/repos/clessor88/mailroom/issues/1"},"comments":{"href":"https://api.github.com/repos/clessor88/mailroom/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clessor88/mailroom/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/clessor88/mailroom/statuses/1a6a9fac0d2f6b364192ce4b0819e7b0cfca2208"}}}}
{"actor":{"display_login":"cewing"}}