{"action":"created","issue":{"url":"https://api.github.com/repos/soft-matter/slicerator/issues/5","labels_url":"https://api.github.com/repos/soft-matter/slicerator/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/soft-matter/slicerator/issues/5/comments","events_url":"https://api.github.com/repos/soft-matter/slicerator/issues/5/events","html_url":"https://github.com/soft-matter/slicerator/pull/5","id":107386695,"number":5,"title":"ENH/API Construction with decorator & attribute propagation","user":{"login":"caspervdw","id":8937919,"avatar_url":"https://avatars.githubusercontent.com/u/8937919?v=3","gravatar_id":"","url":"https://api.github.com/users/caspervdw","html_url":"https://github.com/caspervdw","followers_url":"https://api.github.com/users/caspervdw/followers","following_url":"https://api.github.com/users/caspervdw/following{/other_user}","gists_url":"https://api.github.com/users/caspervdw/gists{/gist_id}","starred_url":"https://api.github.com/users/caspervdw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caspervdw/subscriptions","organizations_url":"https://api.github.com/users/caspervdw/orgs","repos_url":"https://api.github.com/users/caspervdw/repos","events_url":"https://api.github.com/users/caspervdw/events{/privacy}","received_events_url":"https://api.github.com/users/caspervdw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-09-20T10:50:06Z","updated_at":"2015-09-23T17:40:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/soft-matter/slicerator/pulls/5","html_url":"https://github.com/soft-matter/slicerator/pull/5","diff_url":"https://github.com/soft-matter/slicerator/pull/5.diff","patch_url":"https://github.com/soft-matter/slicerator/pull/5.patch"},"body":"This continues the work of @danielballan in https://github.com/soft-matter/slicerator/pull/4, it adds a decorator to easily implement `Slicerator` in classes.\r\n\r\nAlso it fixes some issues with attribute propagation. It doesn't work with `__getattr__` anymore; propagated attributes are actually set to the Slicerator with `setattr` at construction. Attributes that are indexed (`slice_attrs`) will be wrapped applying `_map_index` to the index.\r\n\r\n    class Dummy(object):\r\n        def __init__(self):\r\n            self.frame = list('abcdefghij')\r\n            self._time = list(range(len(self.frame)))\r\n            self._filename = 'filename'\r\n\r\n        def __len__(self):\r\n            return len(self.frame)\r\n\r\n        @slicerate(slice_attrs=['time'], expose_attrs=['filename'])\r\n        def __getitem__(self, i):\r\n            return self.frame[i]  # actual code of get_frame\r\n\r\n        def time(self, i):\r\n            return self._time[i]\r\n\r\n        @property\r\n        def filename(self):\r\n            return self._filename"},"comment":{"url":"https://api.github.com/repos/soft-matter/slicerator/issues/comments/142675462","html_url":"https://github.com/soft-matter/slicerator/pull/5#issuecomment-142675462","issue_url":"https://api.github.com/repos/soft-matter/slicerator/issues/5","id":142675462,"user":{"login":"caspervdw","id":8937919,"avatar_url":"https://avatars.githubusercontent.com/u/8937919?v=3","gravatar_id":"","url":"https://api.github.com/users/caspervdw","html_url":"https://github.com/caspervdw","followers_url":"https://api.github.com/users/caspervdw/followers","following_url":"https://api.github.com/users/caspervdw/following{/other_user}","gists_url":"https://api.github.com/users/caspervdw/gists{/gist_id}","starred_url":"https://api.github.com/users/caspervdw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caspervdw/subscriptions","organizations_url":"https://api.github.com/users/caspervdw/orgs","repos_url":"https://api.github.com/users/caspervdw/repos","events_url":"https://api.github.com/users/caspervdw/events{/privacy}","received_events_url":"https://api.github.com/users/caspervdw/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T17:40:53Z","updated_at":"2015-09-23T17:40:53Z","body":"I fixed the last things, additonaly made propagation of attributes possible with pipelines."}}