{"action":"created","comment":{"url":"https://api.github.com/repos/ioerror/blockfinder/pulls/comments/48126254","id":48126254,"diff_hunk":"@@ -967,17 +967,24 @@ class Lookup(object):\n             print(\"AS%s not found!\" % asn)\n \n     def fetch_rir_blocks_by_country(self, request, country):\n+        if request == \"asn\":\n+            return [str(start_num) for (start_num, end_num) in\n+                    self.database_cache.fetch_assignments(request, country)]\n+        if request != \"ipv4\" and request != \"ipv6\":\n+            return []\n+        seen = {}","path":"blockfinder","position":9,"original_position":9,"commit_id":"1f8acd4ce858898a8f1e6e33161cba2268bb6258","original_commit_id":"1f8acd4ce858898a8f1e6e33161cba2268bb6258","user":{"login":"d1b","id":133624,"avatar_url":"https://avatars.githubusercontent.com/u/133624?v=3","gravatar_id":"","url":"https://api.github.com/users/d1b","html_url":"https://github.com/d1b","followers_url":"https://api.github.com/users/d1b/followers","following_url":"https://api.github.com/users/d1b/following{/other_user}","gists_url":"https://api.github.com/users/d1b/gists{/gist_id}","starred_url":"https://api.github.com/users/d1b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d1b/subscriptions","organizations_url":"https://api.github.com/users/d1b/orgs","repos_url":"https://api.github.com/users/d1b/repos","events_url":"https://api.github.com/users/d1b/events{/privacy}","received_events_url":"https://api.github.com/users/d1b/received_events","type":"User","site_admin":false},"body":"Please create the seen set using `set()`","created_at":"2015-12-21T08:53:04Z","updated_at":"2015-12-21T08:53:04Z","html_url":"https://github.com/ioerror/blockfinder/pull/92#discussion_r48126254","pull_request_url":"https://api.github.com/repos/ioerror/blockfinder/pulls/92","_links":{"self":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/comments/48126254"},"html":{"href":"https://github.com/ioerror/blockfinder/pull/92#discussion_r48126254"},"pull_request":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/92"}}},"pull_request":{"url":"https://api.github.com/repos/ioerror/blockfinder/pulls/92","id":54201926,"html_url":"https://github.com/ioerror/blockfinder/pull/92","diff_url":"https://github.com/ioerror/blockfinder/pull/92.diff","patch_url":"https://github.com/ioerror/blockfinder/pull/92.patch","issue_url":"https://api.github.com/repos/ioerror/blockfinder/issues/92","number":92,"state":"open","locked":false,"title":"Discard duplicate per-country IP blocks","user":{"login":"boite","id":989892,"avatar_url":"https://avatars.githubusercontent.com/u/989892?v=3","gravatar_id":"","url":"https://api.github.com/users/boite","html_url":"https://github.com/boite","followers_url":"https://api.github.com/users/boite/followers","following_url":"https://api.github.com/users/boite/following{/other_user}","gists_url":"https://api.github.com/users/boite/gists{/gist_id}","starred_url":"https://api.github.com/users/boite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boite/subscriptions","organizations_url":"https://api.github.com/users/boite/orgs","repos_url":"https://api.github.com/users/boite/repos","events_url":"https://api.github.com/users/boite/events{/privacy}","received_events_url":"https://api.github.com/users/boite/received_events","type":"User","site_admin":false},"body":"Fixes #90 and supersedes PR #91.\r\n\r\nThis handles some corner-cases which would not be caught by the method used in the previous PR for this issue (#91) or by fetching the assignments from the database using a `SELECT DISTINCT`.\r\nThese corner-cases are due to an assignment being stored multiple times in the database, but with differing starting addresses. For example, 1.0.0.0/16 might be stored as two records:-\r\n\r\n    start_hex    | next_start_hex | source_type\r\n    -------------+----------------+-------------\r\n    001000000    | 001010000      | rir\r\n    -------------+----------------+-------------\r\n    001000001    | 001010000      | maxmind\r\n\r\nTherefore the duplicate blocks should be detected after such records are converted into a standard representation of an assignment by the `ipaddr.summarize_address_range` method.","created_at":"2015-12-20T15:48:19Z","updated_at":"2015-12-21T08:53:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad82ae432378527b9b3bda15b491bc7824589855","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ioerror/blockfinder/pulls/92/commits","review_comments_url":"https://api.github.com/repos/ioerror/blockfinder/pulls/92/comments","review_comment_url":"https://api.github.com/repos/ioerror/blockfinder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ioerror/blockfinder/issues/92/comments","statuses_url":"https://api.github.com/repos/ioerror/blockfinder/statuses/1f8acd4ce858898a8f1e6e33161cba2268bb6258","head":{"label":"boite:dupe-blocks-90-v2","ref":"dupe-blocks-90-v2","sha":"1f8acd4ce858898a8f1e6e33161cba2268bb6258","user":{"login":"boite","id":989892,"avatar_url":"https://avatars.githubusercontent.com/u/989892?v=3","gravatar_id":"","url":"https://api.github.com/users/boite","html_url":"https://github.com/boite","followers_url":"https://api.github.com/users/boite/followers","following_url":"https://api.github.com/users/boite/following{/other_user}","gists_url":"https://api.github.com/users/boite/gists{/gist_id}","starred_url":"https://api.github.com/users/boite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boite/subscriptions","organizations_url":"https://api.github.com/users/boite/orgs","repos_url":"https://api.github.com/users/boite/repos","events_url":"https://api.github.com/users/boite/events{/privacy}","received_events_url":"https://api.github.com/users/boite/received_events","type":"User","site_admin":false},"repo":{"id":47939245,"name":"blockfinder","full_name":"boite/blockfinder","owner":{"login":"boite","id":989892,"avatar_url":"https://avatars.githubusercontent.com/u/989892?v=3","gravatar_id":"","url":"https://api.github.com/users/boite","html_url":"https://github.com/boite","followers_url":"https://api.github.com/users/boite/followers","following_url":"https://api.github.com/users/boite/following{/other_user}","gists_url":"https://api.github.com/users/boite/gists{/gist_id}","starred_url":"https://api.github.com/users/boite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boite/subscriptions","organizations_url":"https://api.github.com/users/boite/orgs","repos_url":"https://api.github.com/users/boite/repos","events_url":"https://api.github.com/users/boite/events{/privacy}","received_events_url":"https://api.github.com/users/boite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boite/blockfinder","description":"Blockfinder enumerates network information for countries","fork":true,"url":"https://api.github.com/repos/boite/blockfinder","forks_url":"https://api.github.com/repos/boite/blockfinder/forks","keys_url":"https://api.github.com/repos/boite/blockfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boite/blockfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boite/blockfinder/teams","hooks_url":"https://api.github.com/repos/boite/blockfinder/hooks","issue_events_url":"https://api.github.com/repos/boite/blockfinder/issues/events{/number}","events_url":"https://api.github.com/repos/boite/blockfinder/events","assignees_url":"https://api.github.com/repos/boite/blockfinder/assignees{/user}","branches_url":"https://api.github.com/repos/boite/blockfinder/branches{/branch}","tags_url":"https://api.github.com/repos/boite/blockfinder/tags","blobs_url":"https://api.github.com/repos/boite/blockfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boite/blockfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boite/blockfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/boite/blockfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boite/blockfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/boite/blockfinder/languages","stargazers_url":"https://api.github.com/repos/boite/blockfinder/stargazers","contributors_url":"https://api.github.com/repos/boite/blockfinder/contributors","subscribers_url":"https://api.github.com/repos/boite/blockfinder/subscribers","subscription_url":"https://api.github.com/repos/boite/blockfinder/subscription","commits_url":"https://api.github.com/repos/boite/blockfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/boite/blockfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/boite/blockfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/boite/blockfinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/boite/blockfinder/contents/{+path}","compare_url":"https://api.github.com/repos/boite/blockfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boite/blockfinder/merges","archive_url":"https://api.github.com/repos/boite/blockfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boite/blockfinder/downloads","issues_url":"https://api.github.com/repos/boite/blockfinder/issues{/number}","pulls_url":"https://api.github.com/repos/boite/blockfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/boite/blockfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/boite/blockfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boite/blockfinder/labels{/name}","releases_url":"https://api.github.com/repos/boite/blockfinder/releases{/id}","created_at":"2015-12-13T22:33:40Z","updated_at":"2015-12-13T22:33:41Z","pushed_at":"2015-12-20T15:54:01Z","git_url":"git://github.com/boite/blockfinder.git","ssh_url":"git@github.com:boite/blockfinder.git","clone_url":"https://github.com/boite/blockfinder.git","svn_url":"https://github.com/boite/blockfinder","homepage":"http://github.com/ioerror/blockfinder","size":257,"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":"ioerror:master","ref":"master","sha":"74cabd506153685426b706b29d6c85a5be0287b2","user":{"login":"ioerror","id":145203,"avatar_url":"https://avatars.githubusercontent.com/u/145203?v=3","gravatar_id":"","url":"https://api.github.com/users/ioerror","html_url":"https://github.com/ioerror","followers_url":"https://api.github.com/users/ioerror/followers","following_url":"https://api.github.com/users/ioerror/following{/other_user}","gists_url":"https://api.github.com/users/ioerror/gists{/gist_id}","starred_url":"https://api.github.com/users/ioerror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioerror/subscriptions","organizations_url":"https://api.github.com/users/ioerror/orgs","repos_url":"https://api.github.com/users/ioerror/repos","events_url":"https://api.github.com/users/ioerror/events{/privacy}","received_events_url":"https://api.github.com/users/ioerror/received_events","type":"User","site_admin":false},"repo":{"id":449123,"name":"blockfinder","full_name":"ioerror/blockfinder","owner":{"login":"ioerror","id":145203,"avatar_url":"https://avatars.githubusercontent.com/u/145203?v=3","gravatar_id":"","url":"https://api.github.com/users/ioerror","html_url":"https://github.com/ioerror","followers_url":"https://api.github.com/users/ioerror/followers","following_url":"https://api.github.com/users/ioerror/following{/other_user}","gists_url":"https://api.github.com/users/ioerror/gists{/gist_id}","starred_url":"https://api.github.com/users/ioerror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioerror/subscriptions","organizations_url":"https://api.github.com/users/ioerror/orgs","repos_url":"https://api.github.com/users/ioerror/repos","events_url":"https://api.github.com/users/ioerror/events{/privacy}","received_events_url":"https://api.github.com/users/ioerror/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ioerror/blockfinder","description":"Blockfinder enumerates network information for countries","fork":false,"url":"https://api.github.com/repos/ioerror/blockfinder","forks_url":"https://api.github.com/repos/ioerror/blockfinder/forks","keys_url":"https://api.github.com/repos/ioerror/blockfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ioerror/blockfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ioerror/blockfinder/teams","hooks_url":"https://api.github.com/repos/ioerror/blockfinder/hooks","issue_events_url":"https://api.github.com/repos/ioerror/blockfinder/issues/events{/number}","events_url":"https://api.github.com/repos/ioerror/blockfinder/events","assignees_url":"https://api.github.com/repos/ioerror/blockfinder/assignees{/user}","branches_url":"https://api.github.com/repos/ioerror/blockfinder/branches{/branch}","tags_url":"https://api.github.com/repos/ioerror/blockfinder/tags","blobs_url":"https://api.github.com/repos/ioerror/blockfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ioerror/blockfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ioerror/blockfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/ioerror/blockfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ioerror/blockfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/ioerror/blockfinder/languages","stargazers_url":"https://api.github.com/repos/ioerror/blockfinder/stargazers","contributors_url":"https://api.github.com/repos/ioerror/blockfinder/contributors","subscribers_url":"https://api.github.com/repos/ioerror/blockfinder/subscribers","subscription_url":"https://api.github.com/repos/ioerror/blockfinder/subscription","commits_url":"https://api.github.com/repos/ioerror/blockfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/ioerror/blockfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/ioerror/blockfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/ioerror/blockfinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/ioerror/blockfinder/contents/{+path}","compare_url":"https://api.github.com/repos/ioerror/blockfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ioerror/blockfinder/merges","archive_url":"https://api.github.com/repos/ioerror/blockfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ioerror/blockfinder/downloads","issues_url":"https://api.github.com/repos/ioerror/blockfinder/issues{/number}","pulls_url":"https://api.github.com/repos/ioerror/blockfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/ioerror/blockfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/ioerror/blockfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ioerror/blockfinder/labels{/name}","releases_url":"https://api.github.com/repos/ioerror/blockfinder/releases{/id}","created_at":"2009-12-25T21:11:33Z","updated_at":"2015-11-08T17:09:47Z","pushed_at":"2015-12-20T15:54:02Z","git_url":"git://github.com/ioerror/blockfinder.git","ssh_url":"git@github.com:ioerror/blockfinder.git","clone_url":"https://github.com/ioerror/blockfinder.git","svn_url":"https://github.com/ioerror/blockfinder","homepage":"http://github.com/ioerror/blockfinder","size":531,"stargazers_count":93,"watchers_count":93,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":8,"forks":33,"open_issues":8,"watchers":93,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/92"},"html":{"href":"https://github.com/ioerror/blockfinder/pull/92"},"issue":{"href":"https://api.github.com/repos/ioerror/blockfinder/issues/92"},"comments":{"href":"https://api.github.com/repos/ioerror/blockfinder/issues/92/comments"},"review_comments":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/92/comments"},"review_comment":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ioerror/blockfinder/pulls/92/commits"},"statuses":{"href":"https://api.github.com/repos/ioerror/blockfinder/statuses/1f8acd4ce858898a8f1e6e33161cba2268bb6258"}}}}