{"action":"created","comment":{"url":"https://api.github.com/repos/tardis-sn/tardis/pulls/comments/62260524","id":62260524,"diff_hunk":"@@ -331,47 +331,64 @@ def to_type(self, value):\n \n class PropertyTypeQuantity(PropertyType):\n     def check_type(self, value):\n-        try:\n-            quantity_split = value.strip().split()\n-            quantity_value = quantity_split[0]\n-            quantity_unit = ' '.join(quantity_split[1:])\n-            if quantity_unit.strip() == 'log_lsun':\n-                quantity_unit = 'erg/s'\n+        if isinstance(value, units.Quantity):\n+            if self._default is not None:\n+                try:\n+                    self._default.to(value.unit)\n+                except ValueError:\n+                    return False\n+            return True\n+        elif isinstance(value, basestring):\n             try:\n+                quantity_split = value.strip().split()\n+                quantity_value = quantity_split[0]\n+                quantity_unit = ' '.join(quantity_split[1:])\n+                if quantity_unit.strip() == 'log_lsun':\n+                    quantity_unit = 'erg/s'\n+                try:\n+                    float(quantity_value)","path":"tardis/io/config_validator.py","position":25,"original_position":25,"commit_id":"eab7319a94e4cf7ed37c0b576950110115219d09","original_commit_id":"eab7319a94e4cf7ed37c0b576950110115219d09","user":{"login":"wkerzendorf","id":506116,"avatar_url":"https://avatars.githubusercontent.com/u/506116?v=3","gravatar_id":"","url":"https://api.github.com/users/wkerzendorf","html_url":"https://github.com/wkerzendorf","followers_url":"https://api.github.com/users/wkerzendorf/followers","following_url":"https://api.github.com/users/wkerzendorf/following{/other_user}","gists_url":"https://api.github.com/users/wkerzendorf/gists{/gist_id}","starred_url":"https://api.github.com/users/wkerzendorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wkerzendorf/subscriptions","organizations_url":"https://api.github.com/users/wkerzendorf/orgs","repos_url":"https://api.github.com/users/wkerzendorf/repos","events_url":"https://api.github.com/users/wkerzendorf/events{/privacy}","received_events_url":"https://api.github.com/users/wkerzendorf/received_events","type":"User","site_admin":false},"body":"this is a ducktyping thing already. ","created_at":"2016-05-05T21:43:55Z","updated_at":"2016-05-05T21:43:55Z","html_url":"https://github.com/tardis-sn/tardis/pull/515#discussion_r62260524","pull_request_url":"https://api.github.com/repos/tardis-sn/tardis/pulls/515","_links":{"self":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/comments/62260524"},"html":{"href":"https://github.com/tardis-sn/tardis/pull/515#discussion_r62260524"},"pull_request":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/515"}}},"pull_request":{"url":"https://api.github.com/repos/tardis-sn/tardis/pulls/515","id":62244131,"html_url":"https://github.com/tardis-sn/tardis/pull/515","diff_url":"https://github.com/tardis-sn/tardis/pull/515.diff","patch_url":"https://github.com/tardis-sn/tardis/pull/515.patch","issue_url":"https://api.github.com/repos/tardis-sn/tardis/issues/515","number":515,"state":"open","locked":false,"title":"[config-system] Add a custom YAML Loader to parse astropy quantities","user":{"login":"ftsamis","id":87870,"avatar_url":"https://avatars.githubusercontent.com/u/87870?v=3","gravatar_id":"","url":"https://api.github.com/users/ftsamis","html_url":"https://github.com/ftsamis","followers_url":"https://api.github.com/users/ftsamis/followers","following_url":"https://api.github.com/users/ftsamis/following{/other_user}","gists_url":"https://api.github.com/users/ftsamis/gists{/gist_id}","starred_url":"https://api.github.com/users/ftsamis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftsamis/subscriptions","organizations_url":"https://api.github.com/users/ftsamis/orgs","repos_url":"https://api.github.com/users/ftsamis/repos","events_url":"https://api.github.com/users/ftsamis/events{/privacy}","received_events_url":"https://api.github.com/users/ftsamis/received_events","type":"User","site_admin":false},"body":"`pyyaml.loader.Loader` class supports adding constructors and implicit resolvers to parse a YAML scalar as a Python object.\r\n\r\nSubclass the default Loader, add a constructor and an implicit resolver to the subclass and use it when parsing the YAML configuration.\r\n\r\n_This is a demonstration of my approach for the first objective of the config system idea._","created_at":"2016-03-09T15:21:45Z","updated_at":"2016-05-05T21:43:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d8944c357e16d968a85a17c399b2174a388e5dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tardis-sn/tardis/pulls/515/commits","review_comments_url":"https://api.github.com/repos/tardis-sn/tardis/pulls/515/comments","review_comment_url":"https://api.github.com/repos/tardis-sn/tardis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tardis-sn/tardis/issues/515/comments","statuses_url":"https://api.github.com/repos/tardis-sn/tardis/statuses/eab7319a94e4cf7ed37c0b576950110115219d09","head":{"label":"ftsamis:config-system","ref":"config-system","sha":"eab7319a94e4cf7ed37c0b576950110115219d09","user":{"login":"ftsamis","id":87870,"avatar_url":"https://avatars.githubusercontent.com/u/87870?v=3","gravatar_id":"","url":"https://api.github.com/users/ftsamis","html_url":"https://github.com/ftsamis","followers_url":"https://api.github.com/users/ftsamis/followers","following_url":"https://api.github.com/users/ftsamis/following{/other_user}","gists_url":"https://api.github.com/users/ftsamis/gists{/gist_id}","starred_url":"https://api.github.com/users/ftsamis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftsamis/subscriptions","organizations_url":"https://api.github.com/users/ftsamis/orgs","repos_url":"https://api.github.com/users/ftsamis/repos","events_url":"https://api.github.com/users/ftsamis/events{/privacy}","received_events_url":"https://api.github.com/users/ftsamis/received_events","type":"User","site_admin":false},"repo":{"id":53506648,"name":"tardis","full_name":"ftsamis/tardis","owner":{"login":"ftsamis","id":87870,"avatar_url":"https://avatars.githubusercontent.com/u/87870?v=3","gravatar_id":"","url":"https://api.github.com/users/ftsamis","html_url":"https://github.com/ftsamis","followers_url":"https://api.github.com/users/ftsamis/followers","following_url":"https://api.github.com/users/ftsamis/following{/other_user}","gists_url":"https://api.github.com/users/ftsamis/gists{/gist_id}","starred_url":"https://api.github.com/users/ftsamis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftsamis/subscriptions","organizations_url":"https://api.github.com/users/ftsamis/orgs","repos_url":"https://api.github.com/users/ftsamis/repos","events_url":"https://api.github.com/users/ftsamis/events{/privacy}","received_events_url":"https://api.github.com/users/ftsamis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ftsamis/tardis","description":"TARDIS - Temperature And Radiative Diffusion In Supernovae","fork":true,"url":"https://api.github.com/repos/ftsamis/tardis","forks_url":"https://api.github.com/repos/ftsamis/tardis/forks","keys_url":"https://api.github.com/repos/ftsamis/tardis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ftsamis/tardis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ftsamis/tardis/teams","hooks_url":"https://api.github.com/repos/ftsamis/tardis/hooks","issue_events_url":"https://api.github.com/repos/ftsamis/tardis/issues/events{/number}","events_url":"https://api.github.com/repos/ftsamis/tardis/events","assignees_url":"https://api.github.com/repos/ftsamis/tardis/assignees{/user}","branches_url":"https://api.github.com/repos/ftsamis/tardis/branches{/branch}","tags_url":"https://api.github.com/repos/ftsamis/tardis/tags","blobs_url":"https://api.github.com/repos/ftsamis/tardis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ftsamis/tardis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ftsamis/tardis/git/refs{/sha}","trees_url":"https://api.github.com/repos/ftsamis/tardis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ftsamis/tardis/statuses/{sha}","languages_url":"https://api.github.com/repos/ftsamis/tardis/languages","stargazers_url":"https://api.github.com/repos/ftsamis/tardis/stargazers","contributors_url":"https://api.github.com/repos/ftsamis/tardis/contributors","subscribers_url":"https://api.github.com/repos/ftsamis/tardis/subscribers","subscription_url":"https://api.github.com/repos/ftsamis/tardis/subscription","commits_url":"https://api.github.com/repos/ftsamis/tardis/commits{/sha}","git_commits_url":"https://api.github.com/repos/ftsamis/tardis/git/commits{/sha}","comments_url":"https://api.github.com/repos/ftsamis/tardis/comments{/number}","issue_comment_url":"https://api.github.com/repos/ftsamis/tardis/issues/comments{/number}","contents_url":"https://api.github.com/repos/ftsamis/tardis/contents/{+path}","compare_url":"https://api.github.com/repos/ftsamis/tardis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ftsamis/tardis/merges","archive_url":"https://api.github.com/repos/ftsamis/tardis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ftsamis/tardis/downloads","issues_url":"https://api.github.com/repos/ftsamis/tardis/issues{/number}","pulls_url":"https://api.github.com/repos/ftsamis/tardis/pulls{/number}","milestones_url":"https://api.github.com/repos/ftsamis/tardis/milestones{/number}","notifications_url":"https://api.github.com/repos/ftsamis/tardis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ftsamis/tardis/labels{/name}","releases_url":"https://api.github.com/repos/ftsamis/tardis/releases{/id}","deployments_url":"https://api.github.com/repos/ftsamis/tardis/deployments","created_at":"2016-03-09T15:02:56Z","updated_at":"2016-03-09T15:02:58Z","pushed_at":"2016-05-05T02:58:59Z","git_url":"git://github.com/ftsamis/tardis.git","ssh_url":"git@github.com:ftsamis/tardis.git","clone_url":"https://github.com/ftsamis/tardis.git","svn_url":"https://github.com/ftsamis/tardis","homepage":"","size":17645,"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":"tardis-sn:master","ref":"master","sha":"ef235c6ae98c75372440dc7e5a56b837cb6c823d","user":{"login":"tardis-sn","id":6108234,"avatar_url":"https://avatars.githubusercontent.com/u/6108234?v=3","gravatar_id":"","url":"https://api.github.com/users/tardis-sn","html_url":"https://github.com/tardis-sn","followers_url":"https://api.github.com/users/tardis-sn/followers","following_url":"https://api.github.com/users/tardis-sn/following{/other_user}","gists_url":"https://api.github.com/users/tardis-sn/gists{/gist_id}","starred_url":"https://api.github.com/users/tardis-sn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tardis-sn/subscriptions","organizations_url":"https://api.github.com/users/tardis-sn/orgs","repos_url":"https://api.github.com/users/tardis-sn/repos","events_url":"https://api.github.com/users/tardis-sn/events{/privacy}","received_events_url":"https://api.github.com/users/tardis-sn/received_events","type":"Organization","site_admin":false},"repo":{"id":2938270,"name":"tardis","full_name":"tardis-sn/tardis","owner":{"login":"tardis-sn","id":6108234,"avatar_url":"https://avatars.githubusercontent.com/u/6108234?v=3","gravatar_id":"","url":"https://api.github.com/users/tardis-sn","html_url":"https://github.com/tardis-sn","followers_url":"https://api.github.com/users/tardis-sn/followers","following_url":"https://api.github.com/users/tardis-sn/following{/other_user}","gists_url":"https://api.github.com/users/tardis-sn/gists{/gist_id}","starred_url":"https://api.github.com/users/tardis-sn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tardis-sn/subscriptions","organizations_url":"https://api.github.com/users/tardis-sn/orgs","repos_url":"https://api.github.com/users/tardis-sn/repos","events_url":"https://api.github.com/users/tardis-sn/events{/privacy}","received_events_url":"https://api.github.com/users/tardis-sn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tardis-sn/tardis","description":"TARDIS - Temperature And Radiative Diffusion In Supernovae","fork":false,"url":"https://api.github.com/repos/tardis-sn/tardis","forks_url":"https://api.github.com/repos/tardis-sn/tardis/forks","keys_url":"https://api.github.com/repos/tardis-sn/tardis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tardis-sn/tardis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tardis-sn/tardis/teams","hooks_url":"https://api.github.com/repos/tardis-sn/tardis/hooks","issue_events_url":"https://api.github.com/repos/tardis-sn/tardis/issues/events{/number}","events_url":"https://api.github.com/repos/tardis-sn/tardis/events","assignees_url":"https://api.github.com/repos/tardis-sn/tardis/assignees{/user}","branches_url":"https://api.github.com/repos/tardis-sn/tardis/branches{/branch}","tags_url":"https://api.github.com/repos/tardis-sn/tardis/tags","blobs_url":"https://api.github.com/repos/tardis-sn/tardis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tardis-sn/tardis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tardis-sn/tardis/git/refs{/sha}","trees_url":"https://api.github.com/repos/tardis-sn/tardis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tardis-sn/tardis/statuses/{sha}","languages_url":"https://api.github.com/repos/tardis-sn/tardis/languages","stargazers_url":"https://api.github.com/repos/tardis-sn/tardis/stargazers","contributors_url":"https://api.github.com/repos/tardis-sn/tardis/contributors","subscribers_url":"https://api.github.com/repos/tardis-sn/tardis/subscribers","subscription_url":"https://api.github.com/repos/tardis-sn/tardis/subscription","commits_url":"https://api.github.com/repos/tardis-sn/tardis/commits{/sha}","git_commits_url":"https://api.github.com/repos/tardis-sn/tardis/git/commits{/sha}","comments_url":"https://api.github.com/repos/tardis-sn/tardis/comments{/number}","issue_comment_url":"https://api.github.com/repos/tardis-sn/tardis/issues/comments{/number}","contents_url":"https://api.github.com/repos/tardis-sn/tardis/contents/{+path}","compare_url":"https://api.github.com/repos/tardis-sn/tardis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tardis-sn/tardis/merges","archive_url":"https://api.github.com/repos/tardis-sn/tardis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tardis-sn/tardis/downloads","issues_url":"https://api.github.com/repos/tardis-sn/tardis/issues{/number}","pulls_url":"https://api.github.com/repos/tardis-sn/tardis/pulls{/number}","milestones_url":"https://api.github.com/repos/tardis-sn/tardis/milestones{/number}","notifications_url":"https://api.github.com/repos/tardis-sn/tardis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tardis-sn/tardis/labels{/name}","releases_url":"https://api.github.com/repos/tardis-sn/tardis/releases{/id}","deployments_url":"https://api.github.com/repos/tardis-sn/tardis/deployments","created_at":"2011-12-08T06:20:19Z","updated_at":"2016-03-28T13:53:14Z","pushed_at":"2016-05-05T19:51:16Z","git_url":"git://github.com/tardis-sn/tardis.git","ssh_url":"git@github.com:tardis-sn/tardis.git","clone_url":"https://github.com/tardis-sn/tardis.git","svn_url":"https://github.com/tardis-sn/tardis","homepage":"","size":194388,"stargazers_count":30,"watchers_count":30,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":112,"mirror_url":null,"open_issues_count":86,"forks":112,"open_issues":86,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/515"},"html":{"href":"https://github.com/tardis-sn/tardis/pull/515"},"issue":{"href":"https://api.github.com/repos/tardis-sn/tardis/issues/515"},"comments":{"href":"https://api.github.com/repos/tardis-sn/tardis/issues/515/comments"},"review_comments":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/515/comments"},"review_comment":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tardis-sn/tardis/pulls/515/commits"},"statuses":{"href":"https://api.github.com/repos/tardis-sn/tardis/statuses/eab7319a94e4cf7ed37c0b576950110115219d09"}}}}