{"action":"created","comment":{"url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/comments/36546567","id":36546567,"diff_hunk":"@@ -0,0 +1,58 @@\n+from __future__ import unicode_literals\n+import sys\n+\n+\n+def radix_sort(list_, radix=10):\n+    buckets = []\n+    divisor = 1\n+\n+    negatives = []\n+    positives = []\n+\n+    for i in list_:\n+        if i < 0:\n+            negatives.append(i)\n+        else:\n+            positives.append(i)\n+\n+    if len(negatives) > 0 and len(positives) > 0:\n+        list_ = radix_sort(negatives, radix * -1)[::-1] + radix_sort(positives)\n+    else:\n+        found_max_length = False\n+        while not found_max_length:\n+            found_max_length = True\n+            buckets = []\n+            for _ in range(abs(radix)):\n+                buckets.append([])\n+\n+            for i in list_:\n+                divided = i // divisor\n+                if found_max_length and abs(divided) > 0:\n+                    found_max_length = False\n+                buckets[abs(divided % radix)].append(i)\n+\n+            list_ = []\n+            for bucket in buckets:\n+                list_.extend(bucket)\n+\n+            divisor *= radix\n+    return list_","path":"radix-sort/radix_sort.py","position":39,"original_position":39,"commit_id":"aff102298952715a9ad717dbc32ec98d92216f15","original_commit_id":"aff102298952715a9ad717dbc32ec98d92216f15","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":"This is a pretty deeply nested function.  Can you identify distinct sub-routines within the larger function that could be broken out into helper functions?\r\n\r\n","created_at":"2015-08-07T18:24:08Z","updated_at":"2015-08-07T18:24:08Z","html_url":"https://github.com/MigrantJ/data-structures/pull/18#discussion_r36546567","pull_request_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/comments/36546567"},"html":{"href":"https://github.com/MigrantJ/data-structures/pull/18#discussion_r36546567"},"pull_request":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18","id":41831557,"html_url":"https://github.com/MigrantJ/data-structures/pull/18","diff_url":"https://github.com/MigrantJ/data-structures/pull/18.diff","patch_url":"https://github.com/MigrantJ/data-structures/pull/18.patch","issue_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/18","number":18,"state":"open","locked":false,"title":"Radix sort","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-06T20:35:24Z","updated_at":"2015-08-07T18:24:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18/commits","review_comments_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18/comments","review_comment_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/18/comments","statuses_url":"https://api.github.com/repos/MigrantJ/data-structures/statuses/aff102298952715a9ad717dbc32ec98d92216f15","head":{"label":"MigrantJ:radix-sort","ref":"radix-sort","sha":"aff102298952715a9ad717dbc32ec98d92216f15","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"repo":{"id":38007587,"name":"data-structures","full_name":"MigrantJ/data-structures","owner":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MigrantJ/data-structures","description":"Sample code for a number of classic data structures implemented in Python","fork":false,"url":"https://api.github.com/repos/MigrantJ/data-structures","forks_url":"https://api.github.com/repos/MigrantJ/data-structures/forks","keys_url":"https://api.github.com/repos/MigrantJ/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MigrantJ/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MigrantJ/data-structures/teams","hooks_url":"https://api.github.com/repos/MigrantJ/data-structures/hooks","issue_events_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/MigrantJ/data-structures/events","assignees_url":"https://api.github.com/repos/MigrantJ/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/MigrantJ/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/MigrantJ/data-structures/tags","blobs_url":"https://api.github.com/repos/MigrantJ/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MigrantJ/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MigrantJ/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/MigrantJ/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MigrantJ/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/MigrantJ/data-structures/languages","stargazers_url":"https://api.github.com/repos/MigrantJ/data-structures/stargazers","contributors_url":"https://api.github.com/repos/MigrantJ/data-structures/contributors","subscribers_url":"https://api.github.com/repos/MigrantJ/data-structures/subscribers","subscription_url":"https://api.github.com/repos/MigrantJ/data-structures/subscription","commits_url":"https://api.github.com/repos/MigrantJ/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/MigrantJ/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/MigrantJ/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/MigrantJ/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/MigrantJ/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MigrantJ/data-structures/merges","archive_url":"https://api.github.com/repos/MigrantJ/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MigrantJ/data-structures/downloads","issues_url":"https://api.github.com/repos/MigrantJ/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/MigrantJ/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/MigrantJ/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MigrantJ/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/MigrantJ/data-structures/releases{/id}","created_at":"2015-06-24T19:54:21Z","updated_at":"2015-06-25T20:57:12Z","pushed_at":"2015-08-06T20:35:24Z","git_url":"git://github.com/MigrantJ/data-structures.git","ssh_url":"git@github.com:MigrantJ/data-structures.git","clone_url":"https://github.com/MigrantJ/data-structures.git","svn_url":"https://github.com/MigrantJ/data-structures","homepage":null,"size":548,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"MigrantJ:master","ref":"master","sha":"5cbc9eb816ee1d11c3187928c3cd1078a37ffafc","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"repo":{"id":38007587,"name":"data-structures","full_name":"MigrantJ/data-structures","owner":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MigrantJ/data-structures","description":"Sample code for a number of classic data structures implemented in Python","fork":false,"url":"https://api.github.com/repos/MigrantJ/data-structures","forks_url":"https://api.github.com/repos/MigrantJ/data-structures/forks","keys_url":"https://api.github.com/repos/MigrantJ/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MigrantJ/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MigrantJ/data-structures/teams","hooks_url":"https://api.github.com/repos/MigrantJ/data-structures/hooks","issue_events_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/MigrantJ/data-structures/events","assignees_url":"https://api.github.com/repos/MigrantJ/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/MigrantJ/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/MigrantJ/data-structures/tags","blobs_url":"https://api.github.com/repos/MigrantJ/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MigrantJ/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MigrantJ/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/MigrantJ/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MigrantJ/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/MigrantJ/data-structures/languages","stargazers_url":"https://api.github.com/repos/MigrantJ/data-structures/stargazers","contributors_url":"https://api.github.com/repos/MigrantJ/data-structures/contributors","subscribers_url":"https://api.github.com/repos/MigrantJ/data-structures/subscribers","subscription_url":"https://api.github.com/repos/MigrantJ/data-structures/subscription","commits_url":"https://api.github.com/repos/MigrantJ/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/MigrantJ/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/MigrantJ/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/MigrantJ/data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/MigrantJ/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/MigrantJ/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MigrantJ/data-structures/merges","archive_url":"https://api.github.com/repos/MigrantJ/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MigrantJ/data-structures/downloads","issues_url":"https://api.github.com/repos/MigrantJ/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/MigrantJ/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/MigrantJ/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/MigrantJ/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MigrantJ/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/MigrantJ/data-structures/releases{/id}","created_at":"2015-06-24T19:54:21Z","updated_at":"2015-06-25T20:57:12Z","pushed_at":"2015-08-06T20:35:24Z","git_url":"git://github.com/MigrantJ/data-structures.git","ssh_url":"git@github.com:MigrantJ/data-structures.git","clone_url":"https://github.com/MigrantJ/data-structures.git","svn_url":"https://github.com/MigrantJ/data-structures","homepage":null,"size":548,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18"},"html":{"href":"https://github.com/MigrantJ/data-structures/pull/18"},"issue":{"href":"https://api.github.com/repos/MigrantJ/data-structures/issues/18"},"comments":{"href":"https://api.github.com/repos/MigrantJ/data-structures/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MigrantJ/data-structures/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/MigrantJ/data-structures/statuses/aff102298952715a9ad717dbc32ec98d92216f15"}}}}