{"action":"created","comment":{"url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/comments/197199114","pull_request_review_id":130893876,"id":197199114,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzE5OTExNA==","diff_hunk":"@@ -0,0 +1,48 @@\n+from urllib import parse\n+\n+from typing import List\n+\n+from ethpm.exceptions import UriNotSupportedError\n+\n+from ethpm.validation import (\n+    validate_package_name,\n+    validate_registry_uri_authority,\n+    validate_registry_uri_scheme,\n+    validate_registry_uri_version,\n+)\n+\n+\n+def is_ens_domain(auth: str) -> bool:\n+    \"\"\"\n+    Returns false if URI authority is not a valid ENS domain.\n+    \"\"\"\n+    if auth[-4:] != '.eth' or len(auth.split('.')) not in [2, 3]:\n+        return False\n+    return True\n+\n+\n+def is_registry_uri(uri: str) -> bool:\n+    \"\"\"\n+    Returns True if URI is a valid registry URI.\n+    Raises UriNotSupportedError if URI is an invalid URI.\n+    \"\"\"\n+    parsed_uri = parse.urlparse(uri)\n+    scheme, authority, path = parsed_uri.scheme, parsed_uri.netloc, parsed_uri.path\n+\n+    validate_registry_uri_scheme(scheme)\n+    pkg_name, pkg_version = parse_path(path)\n+    validate_registry_uri_authority(authority)\n+    validate_registry_uri_version(pkg_version)\n+    validate_package_name(pkg_name)\n+\n+    return True\n+\n+\n+def parse_path(path: str) -> List[str]:\n+    \"\"\"\n+    Raises exception if path is empty string.\n+    If path is valid, return the name and version\n+    \"\"\"\n+    if len(path.split('/')) not in [2, 3, 4]:\n+        raise UriNotSupportedError('{0} is not a valid registry URI path.'.format(path))\n+    return path.split('/')[1:3]","path":"ethpm/utils/registry.py","position":48,"original_position":48,"commit_id":"5d9c857736204bf047985b7f602f6dcedcfe6321","original_commit_id":"5d9c857736204bf047985b7f602f6dcedcfe6321","user":{"login":"pipermerriam","id":824194,"node_id":"MDQ6VXNlcjgyNDE5NA==","avatar_url":"https://avatars3.githubusercontent.com/u/824194?v=4","gravatar_id":"","url":"https://api.github.com/users/pipermerriam","html_url":"https://github.com/pipermerriam","followers_url":"https://api.github.com/users/pipermerriam/followers","following_url":"https://api.github.com/users/pipermerriam/following{/other_user}","gists_url":"https://api.github.com/users/pipermerriam/gists{/gist_id}","starred_url":"https://api.github.com/users/pipermerriam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pipermerriam/subscriptions","organizations_url":"https://api.github.com/users/pipermerriam/orgs","repos_url":"https://api.github.com/users/pipermerriam/repos","events_url":"https://api.github.com/users/pipermerriam/events{/privacy}","received_events_url":"https://api.github.com/users/pipermerriam/received_events","type":"User","site_admin":false},"body":"The `version` part should be unescaped before returning it as it could contain escaped characters (though I think it's better for us to find an existing RFC for version strings and use that to inform our decisions here.","created_at":"2018-06-21T16:32:04Z","updated_at":"2018-06-21T16:38:40Z","html_url":"https://github.com/ethpm/py-ethpm/pull/45#discussion_r197199114","pull_request_url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/comments/197199114"},"html":{"href":"https://github.com/ethpm/py-ethpm/pull/45#discussion_r197199114"},"pull_request":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45","id":196296889,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2Mjk2ODg5","html_url":"https://github.com/ethpm/py-ethpm/pull/45","diff_url":"https://github.com/ethpm/py-ethpm/pull/45.diff","patch_url":"https://github.com/ethpm/py-ethpm/pull/45.patch","issue_url":"https://api.github.com/repos/ethpm/py-ethpm/issues/45","number":45,"state":"open","locked":false,"title":"Write registry uri validation utils","user":{"login":"njgheorghita","id":9753150,"node_id":"MDQ6VXNlcjk3NTMxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/9753150?v=4","gravatar_id":"","url":"https://api.github.com/users/njgheorghita","html_url":"https://github.com/njgheorghita","followers_url":"https://api.github.com/users/njgheorghita/followers","following_url":"https://api.github.com/users/njgheorghita/following{/other_user}","gists_url":"https://api.github.com/users/njgheorghita/gists{/gist_id}","starred_url":"https://api.github.com/users/njgheorghita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njgheorghita/subscriptions","organizations_url":"https://api.github.com/users/njgheorghita/orgs","repos_url":"https://api.github.com/users/njgheorghita/repos","events_url":"https://api.github.com/users/njgheorghita/events{/privacy}","received_events_url":"https://api.github.com/users/njgheorghita/received_events","type":"User","site_admin":false},"body":"### What was wrong?\r\nFetching a manifest content-addressed URI from a package requires a registry URI scheme. These are the utils to validate whether or not a URI has been properly formatted. \r\n\r\n### How was it fixed?\r\nA lot of the rules imposed here are followed by convention set by the dependent libraries. \r\ni.e.\r\n- enforcing \"://\" to follow the `scheme` is convention set in `urllib`\r\n\r\n* Using `ercxxx` as the scheme will be updated once the registry contract standard makes it's way through the ERC process\r\n\r\n\r\n#### Cute Animal Picture\r\n![image](https://user-images.githubusercontent.com/9753150/41689296-2ac5d420-74ad-11e8-885a-747076946e8b.png)\r\n","created_at":"2018-06-20T23:14:01Z","updated_at":"2018-06-21T16:38:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2945775e22c1bcf4a4c812b77fa3d38477b6b22e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"davesque","id":791437,"node_id":"MDQ6VXNlcjc5MTQzNw==","avatar_url":"https://avatars2.githubusercontent.com/u/791437?v=4","gravatar_id":"","url":"https://api.github.com/users/davesque","html_url":"https://github.com/davesque","followers_url":"https://api.github.com/users/davesque/followers","following_url":"https://api.github.com/users/davesque/following{/other_user}","gists_url":"https://api.github.com/users/davesque/gists{/gist_id}","starred_url":"https://api.github.com/users/davesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davesque/subscriptions","organizations_url":"https://api.github.com/users/davesque/orgs","repos_url":"https://api.github.com/users/davesque/repos","events_url":"https://api.github.com/users/davesque/events{/privacy}","received_events_url":"https://api.github.com/users/davesque/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45/commits","review_comments_url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45/comments","review_comment_url":"https://api.github.com/repos/ethpm/py-ethpm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethpm/py-ethpm/issues/45/comments","statuses_url":"https://api.github.com/repos/ethpm/py-ethpm/statuses/5d9c857736204bf047985b7f602f6dcedcfe6321","head":{"label":"njgheorghita:registry-uri-utils","ref":"registry-uri-utils","sha":"5d9c857736204bf047985b7f602f6dcedcfe6321","user":{"login":"njgheorghita","id":9753150,"node_id":"MDQ6VXNlcjk3NTMxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/9753150?v=4","gravatar_id":"","url":"https://api.github.com/users/njgheorghita","html_url":"https://github.com/njgheorghita","followers_url":"https://api.github.com/users/njgheorghita/followers","following_url":"https://api.github.com/users/njgheorghita/following{/other_user}","gists_url":"https://api.github.com/users/njgheorghita/gists{/gist_id}","starred_url":"https://api.github.com/users/njgheorghita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njgheorghita/subscriptions","organizations_url":"https://api.github.com/users/njgheorghita/orgs","repos_url":"https://api.github.com/users/njgheorghita/repos","events_url":"https://api.github.com/users/njgheorghita/events{/privacy}","received_events_url":"https://api.github.com/users/njgheorghita/received_events","type":"User","site_admin":false},"repo":{"id":111157447,"node_id":"MDEwOlJlcG9zaXRvcnkxMTExNTc0NDc=","name":"py-ethpm","full_name":"njgheorghita/py-ethpm","owner":{"login":"njgheorghita","id":9753150,"node_id":"MDQ6VXNlcjk3NTMxNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/9753150?v=4","gravatar_id":"","url":"https://api.github.com/users/njgheorghita","html_url":"https://github.com/njgheorghita","followers_url":"https://api.github.com/users/njgheorghita/followers","following_url":"https://api.github.com/users/njgheorghita/following{/other_user}","gists_url":"https://api.github.com/users/njgheorghita/gists{/gist_id}","starred_url":"https://api.github.com/users/njgheorghita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njgheorghita/subscriptions","organizations_url":"https://api.github.com/users/njgheorghita/orgs","repos_url":"https://api.github.com/users/njgheorghita/repos","events_url":"https://api.github.com/users/njgheorghita/events{/privacy}","received_events_url":"https://api.github.com/users/njgheorghita/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/njgheorghita/py-ethpm","description":"ERC190 package abstraction for python","fork":true,"url":"https://api.github.com/repos/njgheorghita/py-ethpm","forks_url":"https://api.github.com/repos/njgheorghita/py-ethpm/forks","keys_url":"https://api.github.com/repos/njgheorghita/py-ethpm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njgheorghita/py-ethpm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njgheorghita/py-ethpm/teams","hooks_url":"https://api.github.com/repos/njgheorghita/py-ethpm/hooks","issue_events_url":"https://api.github.com/repos/njgheorghita/py-ethpm/issues/events{/number}","events_url":"https://api.github.com/repos/njgheorghita/py-ethpm/events","assignees_url":"https://api.github.com/repos/njgheorghita/py-ethpm/assignees{/user}","branches_url":"https://api.github.com/repos/njgheorghita/py-ethpm/branches{/branch}","tags_url":"https://api.github.com/repos/njgheorghita/py-ethpm/tags","blobs_url":"https://api.github.com/repos/njgheorghita/py-ethpm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njgheorghita/py-ethpm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njgheorghita/py-ethpm/git/refs{/sha}","trees_url":"https://api.github.com/repos/njgheorghita/py-ethpm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njgheorghita/py-ethpm/statuses/{sha}","languages_url":"https://api.github.com/repos/njgheorghita/py-ethpm/languages","stargazers_url":"https://api.github.com/repos/njgheorghita/py-ethpm/stargazers","contributors_url":"https://api.github.com/repos/njgheorghita/py-ethpm/contributors","subscribers_url":"https://api.github.com/repos/njgheorghita/py-ethpm/subscribers","subscription_url":"https://api.github.com/repos/njgheorghita/py-ethpm/subscription","commits_url":"https://api.github.com/repos/njgheorghita/py-ethpm/commits{/sha}","git_commits_url":"https://api.github.com/repos/njgheorghita/py-ethpm/git/commits{/sha}","comments_url":"https://api.github.com/repos/njgheorghita/py-ethpm/comments{/number}","issue_comment_url":"https://api.github.com/repos/njgheorghita/py-ethpm/issues/comments{/number}","contents_url":"https://api.github.com/repos/njgheorghita/py-ethpm/contents/{+path}","compare_url":"https://api.github.com/repos/njgheorghita/py-ethpm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njgheorghita/py-ethpm/merges","archive_url":"https://api.github.com/repos/njgheorghita/py-ethpm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njgheorghita/py-ethpm/downloads","issues_url":"https://api.github.com/repos/njgheorghita/py-ethpm/issues{/number}","pulls_url":"https://api.github.com/repos/njgheorghita/py-ethpm/pulls{/number}","milestones_url":"https://api.github.com/repos/njgheorghita/py-ethpm/milestones{/number}","notifications_url":"https://api.github.com/repos/njgheorghita/py-ethpm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njgheorghita/py-ethpm/labels{/name}","releases_url":"https://api.github.com/repos/njgheorghita/py-ethpm/releases{/id}","deployments_url":"https://api.github.com/repos/njgheorghita/py-ethpm/deployments","created_at":"2017-11-17T22:40:00Z","updated_at":"2018-06-20T23:15:16Z","pushed_at":"2018-06-21T16:18:24Z","git_url":"git://github.com/njgheorghita/py-ethpm.git","ssh_url":"git@github.com:njgheorghita/py-ethpm.git","clone_url":"https://github.com/njgheorghita/py-ethpm.git","svn_url":"https://github.com/njgheorghita/py-ethpm","homepage":null,"size":161,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ethpm:master","ref":"master","sha":"5ecb13cf330d41303f5e1a9f5b673659e5ed637c","user":{"login":"ethpm","id":19231566,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjMxNTY2","avatar_url":"https://avatars2.githubusercontent.com/u/19231566?v=4","gravatar_id":"","url":"https://api.github.com/users/ethpm","html_url":"https://github.com/ethpm","followers_url":"https://api.github.com/users/ethpm/followers","following_url":"https://api.github.com/users/ethpm/following{/other_user}","gists_url":"https://api.github.com/users/ethpm/gists{/gist_id}","starred_url":"https://api.github.com/users/ethpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethpm/subscriptions","organizations_url":"https://api.github.com/users/ethpm/orgs","repos_url":"https://api.github.com/users/ethpm/repos","events_url":"https://api.github.com/users/ethpm/events{/privacy}","received_events_url":"https://api.github.com/users/ethpm/received_events","type":"Organization","site_admin":false},"repo":{"id":104602324,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ2MDIzMjQ=","name":"py-ethpm","full_name":"ethpm/py-ethpm","owner":{"login":"ethpm","id":19231566,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjMxNTY2","avatar_url":"https://avatars2.githubusercontent.com/u/19231566?v=4","gravatar_id":"","url":"https://api.github.com/users/ethpm","html_url":"https://github.com/ethpm","followers_url":"https://api.github.com/users/ethpm/followers","following_url":"https://api.github.com/users/ethpm/following{/other_user}","gists_url":"https://api.github.com/users/ethpm/gists{/gist_id}","starred_url":"https://api.github.com/users/ethpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethpm/subscriptions","organizations_url":"https://api.github.com/users/ethpm/orgs","repos_url":"https://api.github.com/users/ethpm/repos","events_url":"https://api.github.com/users/ethpm/events{/privacy}","received_events_url":"https://api.github.com/users/ethpm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethpm/py-ethpm","description":"ERC190 package abstraction for python","fork":false,"url":"https://api.github.com/repos/ethpm/py-ethpm","forks_url":"https://api.github.com/repos/ethpm/py-ethpm/forks","keys_url":"https://api.github.com/repos/ethpm/py-ethpm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethpm/py-ethpm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethpm/py-ethpm/teams","hooks_url":"https://api.github.com/repos/ethpm/py-ethpm/hooks","issue_events_url":"https://api.github.com/repos/ethpm/py-ethpm/issues/events{/number}","events_url":"https://api.github.com/repos/ethpm/py-ethpm/events","assignees_url":"https://api.github.com/repos/ethpm/py-ethpm/assignees{/user}","branches_url":"https://api.github.com/repos/ethpm/py-ethpm/branches{/branch}","tags_url":"https://api.github.com/repos/ethpm/py-ethpm/tags","blobs_url":"https://api.github.com/repos/ethpm/py-ethpm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethpm/py-ethpm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethpm/py-ethpm/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethpm/py-ethpm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethpm/py-ethpm/statuses/{sha}","languages_url":"https://api.github.com/repos/ethpm/py-ethpm/languages","stargazers_url":"https://api.github.com/repos/ethpm/py-ethpm/stargazers","contributors_url":"https://api.github.com/repos/ethpm/py-ethpm/contributors","subscribers_url":"https://api.github.com/repos/ethpm/py-ethpm/subscribers","subscription_url":"https://api.github.com/repos/ethpm/py-ethpm/subscription","commits_url":"https://api.github.com/repos/ethpm/py-ethpm/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethpm/py-ethpm/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethpm/py-ethpm/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethpm/py-ethpm/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethpm/py-ethpm/contents/{+path}","compare_url":"https://api.github.com/repos/ethpm/py-ethpm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethpm/py-ethpm/merges","archive_url":"https://api.github.com/repos/ethpm/py-ethpm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethpm/py-ethpm/downloads","issues_url":"https://api.github.com/repos/ethpm/py-ethpm/issues{/number}","pulls_url":"https://api.github.com/repos/ethpm/py-ethpm/pulls{/number}","milestones_url":"https://api.github.com/repos/ethpm/py-ethpm/milestones{/number}","notifications_url":"https://api.github.com/repos/ethpm/py-ethpm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethpm/py-ethpm/labels{/name}","releases_url":"https://api.github.com/repos/ethpm/py-ethpm/releases{/id}","deployments_url":"https://api.github.com/repos/ethpm/py-ethpm/deployments","created_at":"2017-09-23T22:12:00Z","updated_at":"2018-06-21T14:04:49Z","pushed_at":"2018-06-21T16:18:25Z","git_url":"git://github.com/ethpm/py-ethpm.git","ssh_url":"git@github.com:ethpm/py-ethpm.git","clone_url":"https://github.com/ethpm/py-ethpm.git","svn_url":"https://github.com/ethpm/py-ethpm","homepage":null,"size":144,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":8,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45"},"html":{"href":"https://github.com/ethpm/py-ethpm/pull/45"},"issue":{"href":"https://api.github.com/repos/ethpm/py-ethpm/issues/45"},"comments":{"href":"https://api.github.com/repos/ethpm/py-ethpm/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethpm/py-ethpm/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/ethpm/py-ethpm/statuses/5d9c857736204bf047985b7f602f6dcedcfe6321"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pipermerriam"}}