{"action":"created","comment":{"url":"https://api.github.com/repos/nipy/nibabel/pulls/comments/44006566","id":44006566,"diff_hunk":"@@ -309,64 +321,27 @@ def flush_chardata(self):\n             # update the endianness according to the\n             # current machine setting\n             self.endian = gifti_endian_codes.code[sys.byteorder]\n+\n         elif self.write_to == 'Label':\n             self.label.label = data.strip()\n \n     @property\n     def pending_data(self):\n         \" True if there is character data pending for processing \"\n-        return not self._char_blocks is None\n+        return self._char_blocks is not None\n \n \n-def parse_gifti_file(fname=None, fptr=None, buffer_size=None):\n-    \"\"\" Parse gifti file named `fname`, return image\n-\n-    Parameters\n-    ----------\n-    fname : str\n-        filename of gifti file\n-    buffer_size: None or int, optional\n-        size of read buffer. None gives default of 35000000 unless on python <\n-        2.6, in which case it is read only in the parser.  In that case values\n-        other than None cause a ValueError on execution\n-\n-    Returns\n-    -------\n-    img : gifti image\n-    \"\"\"\n-    assert (fname is not None) + (fptr is not None) == 1, \"Specify only fname or fptr, not both\"\n-\n-    if fptr is None:\n-        with open(fname, 'rb') as datasource:\n-            return parse_gifti_file(fptr=datasource, buffer_size=buffer_size)\n-    else:\n-        datasource = fptr\n+class Outputter(GiftiImageParser):\n+    @np.deprecate_with_doc(\"Use GiftiImageParser instead.\")","path":"nibabel/gifti/parse_gifti_fast.py","position":313,"original_position":313,"commit_id":"5c850da0b1775ca873b5159a49e78c73062d96ff","original_commit_id":"5c850da0b1775ca873b5159a49e78c73062d96ff","user":{"login":"effigies","id":83442,"avatar_url":"https://avatars.githubusercontent.com/u/83442?v=3","gravatar_id":"","url":"https://api.github.com/users/effigies","html_url":"https://github.com/effigies","followers_url":"https://api.github.com/users/effigies/followers","following_url":"https://api.github.com/users/effigies/following{/other_user}","gists_url":"https://api.github.com/users/effigies/gists{/gist_id}","starred_url":"https://api.github.com/users/effigies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/effigies/subscriptions","organizations_url":"https://api.github.com/users/effigies/orgs","repos_url":"https://api.github.com/users/effigies/repos","events_url":"https://api.github.com/users/effigies/events{/privacy}","received_events_url":"https://api.github.com/users/effigies/received_events","type":"User","site_admin":false},"body":"Should this deprecation be on the class instead of `__init__`?","created_at":"2015-11-05T12:35:21Z","updated_at":"2015-11-05T12:35:21Z","html_url":"https://github.com/nipy/nibabel/pull/365#discussion_r44006566","pull_request_url":"https://api.github.com/repos/nipy/nibabel/pulls/365","_links":{"self":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/comments/44006566"},"html":{"href":"https://github.com/nipy/nibabel/pull/365#discussion_r44006566"},"pull_request":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/365"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/nibabel/pulls/365","id":48609139,"html_url":"https://github.com/nipy/nibabel/pull/365","diff_url":"https://github.com/nipy/nibabel/pull/365.diff","patch_url":"https://github.com/nipy/nibabel/pull/365.patch","issue_url":"https://api.github.com/repos/nipy/nibabel/issues/365","number":365,"state":"open","locked":false,"title":"MRG: XmlBasedImage, XmlImageParser","user":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"body":"`CiftiImage` (#249) and `GiftiImage` share a lot of logic. Both have functions for parsing, both will use similar logic for loading and saving. `XmlBasedImage` and `XmlImageParser` encapsulates the shared code, and defines a (hopefully) clean object model for any future images that are defined in XML.\r\n\r\n* `XmlImageParser` - a new abstract class that does most of the work here. Defines a structure for parsing XML files; every xml-based image will have to define one, specific to that image format. This essentially generalizes the object model used in `parse_gifti_fast.py`.\r\n* `XmlBasedImage` - a light wrapper around `FileBasedImage` that calls into the `XmlImageParser` for the image class on read, and takes care of small details on `write` (call into `to_xml()`). New required class property: `parser` (similar usage to `header`)\r\n\r\nThings done:\r\n* [x] Define `XmlImageParser` and `XmlBasedImage`\r\n* [x] Migrate `GiftiImage` to use `XmlBasedImage`, and `parse_gifti_fast` to use `XmlImageParser`\r\n* [x] Deprecate `parse_gifti_file` and related objects.\r\n\r\nThings to do:\r\n* [x] Determine the file structure; there is an unresolvable dependency between `gifti.py` and `parse_gifti_fast.py`; each refers to objects in the other. Perhaps we can simply combine them?\r\n* [x] Write tests\r\n* [x] Migrate `parse_gifti_fast` tests to new object model.\r\n* [x] Add deprecation tests for `parse_gifti_file`\r\n* [x] Add documentation\r\n* [x] Scrub GIFTI parser code\r\n* [x] Add test to test `buffer_size` passing via `nibabel.load()`\r\n\r\nI'm pushing this PR out there now as (1) it seems to pass tests and (2) to get feedback on the object model / design as early in the development process as possible.\r\n\r\nI'm not in a big rush on this; just wanted to get it out there while it was on my mind.","created_at":"2015-10-23T17:48:33Z","updated_at":"2015-11-05T12:35:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee15942cace9f007d77c850838eb96d46b6fcc45","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nipy/nibabel/pulls/365/commits","review_comments_url":"https://api.github.com/repos/nipy/nibabel/pulls/365/comments","review_comment_url":"https://api.github.com/repos/nipy/nibabel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nipy/nibabel/issues/365/comments","statuses_url":"https://api.github.com/repos/nipy/nibabel/statuses/5c850da0b1775ca873b5159a49e78c73062d96ff","head":{"label":"bcipolli:xmlbasedimages","ref":"xmlbasedimages","sha":"5c850da0b1775ca873b5159a49e78c73062d96ff","user":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"repo":{"id":31253147,"name":"nibabel","full_name":"bcipolli/nibabel","owner":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcipolli/nibabel","description":"Python package to access a cacophony of neuro-imaging file formats","fork":true,"url":"https://api.github.com/repos/bcipolli/nibabel","forks_url":"https://api.github.com/repos/bcipolli/nibabel/forks","keys_url":"https://api.github.com/repos/bcipolli/nibabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcipolli/nibabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcipolli/nibabel/teams","hooks_url":"https://api.github.com/repos/bcipolli/nibabel/hooks","issue_events_url":"https://api.github.com/repos/bcipolli/nibabel/issues/events{/number}","events_url":"https://api.github.com/repos/bcipolli/nibabel/events","assignees_url":"https://api.github.com/repos/bcipolli/nibabel/assignees{/user}","branches_url":"https://api.github.com/repos/bcipolli/nibabel/branches{/branch}","tags_url":"https://api.github.com/repos/bcipolli/nibabel/tags","blobs_url":"https://api.github.com/repos/bcipolli/nibabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcipolli/nibabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcipolli/nibabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcipolli/nibabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcipolli/nibabel/statuses/{sha}","languages_url":"https://api.github.com/repos/bcipolli/nibabel/languages","stargazers_url":"https://api.github.com/repos/bcipolli/nibabel/stargazers","contributors_url":"https://api.github.com/repos/bcipolli/nibabel/contributors","subscribers_url":"https://api.github.com/repos/bcipolli/nibabel/subscribers","subscription_url":"https://api.github.com/repos/bcipolli/nibabel/subscription","commits_url":"https://api.github.com/repos/bcipolli/nibabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcipolli/nibabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcipolli/nibabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcipolli/nibabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/bcipolli/nibabel/contents/{+path}","compare_url":"https://api.github.com/repos/bcipolli/nibabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcipolli/nibabel/merges","archive_url":"https://api.github.com/repos/bcipolli/nibabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcipolli/nibabel/downloads","issues_url":"https://api.github.com/repos/bcipolli/nibabel/issues{/number}","pulls_url":"https://api.github.com/repos/bcipolli/nibabel/pulls{/number}","milestones_url":"https://api.github.com/repos/bcipolli/nibabel/milestones{/number}","notifications_url":"https://api.github.com/repos/bcipolli/nibabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcipolli/nibabel/labels{/name}","releases_url":"https://api.github.com/repos/bcipolli/nibabel/releases{/id}","created_at":"2015-02-24T09:35:11Z","updated_at":"2015-02-24T09:35:13Z","pushed_at":"2015-11-05T12:29:08Z","git_url":"git://github.com/bcipolli/nibabel.git","ssh_url":"git@github.com:bcipolli/nibabel.git","clone_url":"https://github.com/bcipolli/nibabel.git","svn_url":"https://github.com/bcipolli/nibabel","homepage":"http://nipy.org/nibabel/","size":8750,"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":"nipy:master","ref":"master","sha":"1478cc9b543fd883ffb5b0d528827471c7957031","user":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"repo":{"id":791352,"name":"nibabel","full_name":"nipy/nibabel","owner":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nipy/nibabel","description":"Python package to access a cacophony of neuro-imaging file formats","fork":false,"url":"https://api.github.com/repos/nipy/nibabel","forks_url":"https://api.github.com/repos/nipy/nibabel/forks","keys_url":"https://api.github.com/repos/nipy/nibabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nipy/nibabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nipy/nibabel/teams","hooks_url":"https://api.github.com/repos/nipy/nibabel/hooks","issue_events_url":"https://api.github.com/repos/nipy/nibabel/issues/events{/number}","events_url":"https://api.github.com/repos/nipy/nibabel/events","assignees_url":"https://api.github.com/repos/nipy/nibabel/assignees{/user}","branches_url":"https://api.github.com/repos/nipy/nibabel/branches{/branch}","tags_url":"https://api.github.com/repos/nipy/nibabel/tags","blobs_url":"https://api.github.com/repos/nipy/nibabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nipy/nibabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nipy/nibabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/nipy/nibabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nipy/nibabel/statuses/{sha}","languages_url":"https://api.github.com/repos/nipy/nibabel/languages","stargazers_url":"https://api.github.com/repos/nipy/nibabel/stargazers","contributors_url":"https://api.github.com/repos/nipy/nibabel/contributors","subscribers_url":"https://api.github.com/repos/nipy/nibabel/subscribers","subscription_url":"https://api.github.com/repos/nipy/nibabel/subscription","commits_url":"https://api.github.com/repos/nipy/nibabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/nipy/nibabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/nipy/nibabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/nipy/nibabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/nipy/nibabel/contents/{+path}","compare_url":"https://api.github.com/repos/nipy/nibabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nipy/nibabel/merges","archive_url":"https://api.github.com/repos/nipy/nibabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nipy/nibabel/downloads","issues_url":"https://api.github.com/repos/nipy/nibabel/issues{/number}","pulls_url":"https://api.github.com/repos/nipy/nibabel/pulls{/number}","milestones_url":"https://api.github.com/repos/nipy/nibabel/milestones{/number}","notifications_url":"https://api.github.com/repos/nipy/nibabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nipy/nibabel/labels{/name}","releases_url":"https://api.github.com/repos/nipy/nibabel/releases{/id}","created_at":"2010-07-22T16:28:30Z","updated_at":"2015-10-25T15:44:03Z","pushed_at":"2015-11-05T12:29:09Z","git_url":"git://github.com/nipy/nibabel.git","ssh_url":"git@github.com:nipy/nibabel.git","clone_url":"https://github.com/nipy/nibabel.git","svn_url":"https://github.com/nipy/nibabel","homepage":"http://nipy.org/nibabel/","size":18114,"stargazers_count":97,"watchers_count":97,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":96,"mirror_url":null,"open_issues_count":61,"forks":96,"open_issues":61,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/365"},"html":{"href":"https://github.com/nipy/nibabel/pull/365"},"issue":{"href":"https://api.github.com/repos/nipy/nibabel/issues/365"},"comments":{"href":"https://api.github.com/repos/nipy/nibabel/issues/365/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/365/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nipy/nibabel/pulls/365/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/nibabel/statuses/5c850da0b1775ca873b5159a49e78c73062d96ff"}}}}