{"action":"created","comment":{"url":"https://api.github.com/repos/SciTools/biggus/pulls/comments/26566001","id":26566001,"diff_hunk":"@@ -824,6 +832,47 @@ def masked_array(self):\n         return array\n \n \n+def _use_indexed_array(keys):\n+    return ((isinstance(keys, tuple) and any(key is None for key in keys)) or\n+            keys is None)\n+\n+\n+class IndexedArray(Array):\n+    def __init__(self, array, keys):\n+        self.array = array\n+        if not isinstance(keys, tuple):\n+            keys = (keys,)\n+        self.keys = tuple(keys)\n+\n+    @property\n+    def dtype(self):\n+        return self.array.dtype\n+\n+    @property\n+    def shape(self):\n+        return _sliced_shape(self.array.shape, self.keys)\n+\n+    def __getitem__(self, keys):\n+        raise RuntimeError('unsupported operation')","path":"biggus/__init__.py","position":54,"original_position":54,"commit_id":"036b2f1687fc88a287952f2334393599f98aba69","original_commit_id":"036b2f1687fc88a287952f2334393599f98aba69","user":{"login":"bjlittle","id":2051656,"avatar_url":"https://avatars.githubusercontent.com/u/2051656?v=3","gravatar_id":"","url":"https://api.github.com/users/bjlittle","html_url":"https://github.com/bjlittle","followers_url":"https://api.github.com/users/bjlittle/followers","following_url":"https://api.github.com/users/bjlittle/following{/other_user}","gists_url":"https://api.github.com/users/bjlittle/gists{/gist_id}","starred_url":"https://api.github.com/users/bjlittle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjlittle/subscriptions","organizations_url":"https://api.github.com/users/bjlittle/orgs","repos_url":"https://api.github.com/users/bjlittle/repos","events_url":"https://api.github.com/users/bjlittle/events{/privacy}","received_events_url":"https://api.github.com/users/bjlittle/received_events","type":"User","site_admin":false},"body":"Hmmm ... users might hit this brick wall pretty darn quick ...\r\n```\r\n>>> from biggus import NumpyArrayAdapter\r\n>>> a = NumpyArrayAdapter(np.arange(20).reshape(4, 5))\r\n>>> a\r\n<NumpyArrayAdapter shape=(4, 5) dtype=dtype('int64')>\r\n>>> b = a[:, None, :]\r\n>>> b\r\n<IndexedArray shape=(4, 1, 5) dtype=dtype('int64')>\r\n>>> b[0]\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/home/h05/itwl/projects/git/biggus/biggus/__init__.py\", line 856, in __getitem__\r\n    raise RuntimeError('unsupported operation')\r\nRuntimeError: unsupported operation\r\n```\r\nThoughts ... ?","created_at":"2015-03-17T11:49:15Z","updated_at":"2015-03-17T11:49:15Z","html_url":"https://github.com/SciTools/biggus/pull/116#discussion_r26566001","pull_request_url":"https://api.github.com/repos/SciTools/biggus/pulls/116","_links":{"self":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/comments/26566001"},"html":{"href":"https://github.com/SciTools/biggus/pull/116#discussion_r26566001"},"pull_request":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/116"}}},"pull_request":{"url":"https://api.github.com/repos/SciTools/biggus/pulls/116","id":30959974,"html_url":"https://github.com/SciTools/biggus/pull/116","diff_url":"https://github.com/SciTools/biggus/pull/116.diff","patch_url":"https://github.com/SciTools/biggus/pull/116.patch","issue_url":"https://api.github.com/repos/SciTools/biggus/issues/116","number":116,"state":"open","locked":false,"title":"Support np.newaxis and __array__ protocol.","user":{"login":"rhattersley","id":917914,"avatar_url":"https://avatars.githubusercontent.com/u/917914?v=3","gravatar_id":"","url":"https://api.github.com/users/rhattersley","html_url":"https://github.com/rhattersley","followers_url":"https://api.github.com/users/rhattersley/followers","following_url":"https://api.github.com/users/rhattersley/following{/other_user}","gists_url":"https://api.github.com/users/rhattersley/gists{/gist_id}","starred_url":"https://api.github.com/users/rhattersley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhattersley/subscriptions","organizations_url":"https://api.github.com/users/rhattersley/orgs","repos_url":"https://api.github.com/users/rhattersley/repos","events_url":"https://api.github.com/users/rhattersley/events{/privacy}","received_events_url":"https://api.github.com/users/rhattersley/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-11T16:28:31Z","updated_at":"2015-03-17T11:49:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77a3cf63740ce767fad697ba00a7e711352e6033","assignee":{"login":"bjlittle","id":2051656,"avatar_url":"https://avatars.githubusercontent.com/u/2051656?v=3","gravatar_id":"","url":"https://api.github.com/users/bjlittle","html_url":"https://github.com/bjlittle","followers_url":"https://api.github.com/users/bjlittle/followers","following_url":"https://api.github.com/users/bjlittle/following{/other_user}","gists_url":"https://api.github.com/users/bjlittle/gists{/gist_id}","starred_url":"https://api.github.com/users/bjlittle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjlittle/subscriptions","organizations_url":"https://api.github.com/users/bjlittle/orgs","repos_url":"https://api.github.com/users/bjlittle/repos","events_url":"https://api.github.com/users/bjlittle/events{/privacy}","received_events_url":"https://api.github.com/users/bjlittle/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SciTools/biggus/pulls/116/commits","review_comments_url":"https://api.github.com/repos/SciTools/biggus/pulls/116/comments","review_comment_url":"https://api.github.com/repos/SciTools/biggus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SciTools/biggus/issues/116/comments","statuses_url":"https://api.github.com/repos/SciTools/biggus/statuses/036b2f1687fc88a287952f2334393599f98aba69","head":{"label":"rhattersley:newaxis","ref":"newaxis","sha":"036b2f1687fc88a287952f2334393599f98aba69","user":{"login":"rhattersley","id":917914,"avatar_url":"https://avatars.githubusercontent.com/u/917914?v=3","gravatar_id":"","url":"https://api.github.com/users/rhattersley","html_url":"https://github.com/rhattersley","followers_url":"https://api.github.com/users/rhattersley/followers","following_url":"https://api.github.com/users/rhattersley/following{/other_user}","gists_url":"https://api.github.com/users/rhattersley/gists{/gist_id}","starred_url":"https://api.github.com/users/rhattersley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhattersley/subscriptions","organizations_url":"https://api.github.com/users/rhattersley/orgs","repos_url":"https://api.github.com/users/rhattersley/repos","events_url":"https://api.github.com/users/rhattersley/events{/privacy}","received_events_url":"https://api.github.com/users/rhattersley/received_events","type":"User","site_admin":false},"repo":{"id":5305943,"name":"biggus","full_name":"rhattersley/biggus","owner":{"login":"rhattersley","id":917914,"avatar_url":"https://avatars.githubusercontent.com/u/917914?v=3","gravatar_id":"","url":"https://api.github.com/users/rhattersley","html_url":"https://github.com/rhattersley","followers_url":"https://api.github.com/users/rhattersley/followers","following_url":"https://api.github.com/users/rhattersley/following{/other_user}","gists_url":"https://api.github.com/users/rhattersley/gists{/gist_id}","starred_url":"https://api.github.com/users/rhattersley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhattersley/subscriptions","organizations_url":"https://api.github.com/users/rhattersley/orgs","repos_url":"https://api.github.com/users/rhattersley/repos","events_url":"https://api.github.com/users/rhattersley/events{/privacy}","received_events_url":"https://api.github.com/users/rhattersley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhattersley/biggus","description":"Virtual large arrays and lazy evaluation.","fork":true,"url":"https://api.github.com/repos/rhattersley/biggus","forks_url":"https://api.github.com/repos/rhattersley/biggus/forks","keys_url":"https://api.github.com/repos/rhattersley/biggus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhattersley/biggus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhattersley/biggus/teams","hooks_url":"https://api.github.com/repos/rhattersley/biggus/hooks","issue_events_url":"https://api.github.com/repos/rhattersley/biggus/issues/events{/number}","events_url":"https://api.github.com/repos/rhattersley/biggus/events","assignees_url":"https://api.github.com/repos/rhattersley/biggus/assignees{/user}","branches_url":"https://api.github.com/repos/rhattersley/biggus/branches{/branch}","tags_url":"https://api.github.com/repos/rhattersley/biggus/tags","blobs_url":"https://api.github.com/repos/rhattersley/biggus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhattersley/biggus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhattersley/biggus/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhattersley/biggus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhattersley/biggus/statuses/{sha}","languages_url":"https://api.github.com/repos/rhattersley/biggus/languages","stargazers_url":"https://api.github.com/repos/rhattersley/biggus/stargazers","contributors_url":"https://api.github.com/repos/rhattersley/biggus/contributors","subscribers_url":"https://api.github.com/repos/rhattersley/biggus/subscribers","subscription_url":"https://api.github.com/repos/rhattersley/biggus/subscription","commits_url":"https://api.github.com/repos/rhattersley/biggus/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhattersley/biggus/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhattersley/biggus/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhattersley/biggus/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhattersley/biggus/contents/{+path}","compare_url":"https://api.github.com/repos/rhattersley/biggus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhattersley/biggus/merges","archive_url":"https://api.github.com/repos/rhattersley/biggus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhattersley/biggus/downloads","issues_url":"https://api.github.com/repos/rhattersley/biggus/issues{/number}","pulls_url":"https://api.github.com/repos/rhattersley/biggus/pulls{/number}","milestones_url":"https://api.github.com/repos/rhattersley/biggus/milestones{/number}","notifications_url":"https://api.github.com/repos/rhattersley/biggus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhattersley/biggus/labels{/name}","releases_url":"https://api.github.com/repos/rhattersley/biggus/releases{/id}","created_at":"2012-08-05T18:43:01Z","updated_at":"2014-06-23T09:09:28Z","pushed_at":"2015-03-11T17:10:35Z","git_url":"git://github.com/rhattersley/biggus.git","ssh_url":"git@github.com:rhattersley/biggus.git","clone_url":"https://github.com/rhattersley/biggus.git","svn_url":"https://github.com/rhattersley/biggus","homepage":"","size":829,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"dummy"}},"base":{"label":"SciTools:master","ref":"master","sha":"5625040b63cd942775d6a0e1c81221a5684fc333","user":{"login":"SciTools","id":1391487,"avatar_url":"https://avatars.githubusercontent.com/u/1391487?v=3","gravatar_id":"","url":"https://api.github.com/users/SciTools","html_url":"https://github.com/SciTools","followers_url":"https://api.github.com/users/SciTools/followers","following_url":"https://api.github.com/users/SciTools/following{/other_user}","gists_url":"https://api.github.com/users/SciTools/gists{/gist_id}","starred_url":"https://api.github.com/users/SciTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciTools/subscriptions","organizations_url":"https://api.github.com/users/SciTools/orgs","repos_url":"https://api.github.com/users/SciTools/repos","events_url":"https://api.github.com/users/SciTools/events{/privacy}","received_events_url":"https://api.github.com/users/SciTools/received_events","type":"Organization","site_admin":false},"repo":{"id":5265623,"name":"biggus","full_name":"SciTools/biggus","owner":{"login":"SciTools","id":1391487,"avatar_url":"https://avatars.githubusercontent.com/u/1391487?v=3","gravatar_id":"","url":"https://api.github.com/users/SciTools","html_url":"https://github.com/SciTools","followers_url":"https://api.github.com/users/SciTools/followers","following_url":"https://api.github.com/users/SciTools/following{/other_user}","gists_url":"https://api.github.com/users/SciTools/gists{/gist_id}","starred_url":"https://api.github.com/users/SciTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciTools/subscriptions","organizations_url":"https://api.github.com/users/SciTools/orgs","repos_url":"https://api.github.com/users/SciTools/repos","events_url":"https://api.github.com/users/SciTools/events{/privacy}","received_events_url":"https://api.github.com/users/SciTools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SciTools/biggus","description":"Virtual large arrays and lazy evaluation.","fork":false,"url":"https://api.github.com/repos/SciTools/biggus","forks_url":"https://api.github.com/repos/SciTools/biggus/forks","keys_url":"https://api.github.com/repos/SciTools/biggus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SciTools/biggus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SciTools/biggus/teams","hooks_url":"https://api.github.com/repos/SciTools/biggus/hooks","issue_events_url":"https://api.github.com/repos/SciTools/biggus/issues/events{/number}","events_url":"https://api.github.com/repos/SciTools/biggus/events","assignees_url":"https://api.github.com/repos/SciTools/biggus/assignees{/user}","branches_url":"https://api.github.com/repos/SciTools/biggus/branches{/branch}","tags_url":"https://api.github.com/repos/SciTools/biggus/tags","blobs_url":"https://api.github.com/repos/SciTools/biggus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SciTools/biggus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SciTools/biggus/git/refs{/sha}","trees_url":"https://api.github.com/repos/SciTools/biggus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SciTools/biggus/statuses/{sha}","languages_url":"https://api.github.com/repos/SciTools/biggus/languages","stargazers_url":"https://api.github.com/repos/SciTools/biggus/stargazers","contributors_url":"https://api.github.com/repos/SciTools/biggus/contributors","subscribers_url":"https://api.github.com/repos/SciTools/biggus/subscribers","subscription_url":"https://api.github.com/repos/SciTools/biggus/subscription","commits_url":"https://api.github.com/repos/SciTools/biggus/commits{/sha}","git_commits_url":"https://api.github.com/repos/SciTools/biggus/git/commits{/sha}","comments_url":"https://api.github.com/repos/SciTools/biggus/comments{/number}","issue_comment_url":"https://api.github.com/repos/SciTools/biggus/issues/comments{/number}","contents_url":"https://api.github.com/repos/SciTools/biggus/contents/{+path}","compare_url":"https://api.github.com/repos/SciTools/biggus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SciTools/biggus/merges","archive_url":"https://api.github.com/repos/SciTools/biggus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SciTools/biggus/downloads","issues_url":"https://api.github.com/repos/SciTools/biggus/issues{/number}","pulls_url":"https://api.github.com/repos/SciTools/biggus/pulls{/number}","milestones_url":"https://api.github.com/repos/SciTools/biggus/milestones{/number}","notifications_url":"https://api.github.com/repos/SciTools/biggus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SciTools/biggus/labels{/name}","releases_url":"https://api.github.com/repos/SciTools/biggus/releases{/id}","created_at":"2012-08-01T22:26:06Z","updated_at":"2015-03-07T07:02:58Z","pushed_at":"2015-01-06T15:30:43Z","git_url":"git://github.com/SciTools/biggus.git","ssh_url":"git@github.com:SciTools/biggus.git","clone_url":"https://github.com/SciTools/biggus.git","svn_url":"https://github.com/SciTools/biggus","homepage":"http://biggus.readthedocs.org/","size":1147,"stargazers_count":32,"watchers_count":32,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":23,"forks":22,"open_issues":23,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/116"},"html":{"href":"https://github.com/SciTools/biggus/pull/116"},"issue":{"href":"https://api.github.com/repos/SciTools/biggus/issues/116"},"comments":{"href":"https://api.github.com/repos/SciTools/biggus/issues/116/comments"},"review_comments":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/116/comments"},"review_comment":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SciTools/biggus/pulls/116/commits"},"statuses":{"href":"https://api.github.com/repos/SciTools/biggus/statuses/036b2f1687fc88a287952f2334393599f98aba69"}}}}