{"action":"created","issue":{"url":"https://api.github.com/repos/menpo/menpo/issues/669","repository_url":"https://api.github.com/repos/menpo/menpo","labels_url":"https://api.github.com/repos/menpo/menpo/issues/669/labels{/name}","comments_url":"https://api.github.com/repos/menpo/menpo/issues/669/comments","events_url":"https://api.github.com/repos/menpo/menpo/issues/669/events","html_url":"https://github.com/menpo/menpo/pull/669","id":131719305,"number":669,"title":"BREAKING: Add LazyList - default importing is now Lazy","user":{"login":"patricksnape","id":708474,"avatar_url":"https://avatars.githubusercontent.com/u/708474?v=3","gravatar_id":"","url":"https://api.github.com/users/patricksnape","html_url":"https://github.com/patricksnape","followers_url":"https://api.github.com/users/patricksnape/followers","following_url":"https://api.github.com/users/patricksnape/following{/other_user}","gists_url":"https://api.github.com/users/patricksnape/gists{/gist_id}","starred_url":"https://api.github.com/users/patricksnape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patricksnape/subscriptions","organizations_url":"https://api.github.com/users/patricksnape/orgs","repos_url":"https://api.github.com/users/patricksnape/repos","events_url":"https://api.github.com/users/patricksnape/events{/privacy}","received_events_url":"https://api.github.com/users/patricksnape/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/menpo/menpo/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-05T18:34:07Z","updated_at":"2016-02-07T17:31:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/menpo/menpo/pulls/669","html_url":"https://github.com/menpo/menpo/pull/669","diff_url":"https://github.com/menpo/menpo/pull/669.diff","patch_url":"https://github.com/menpo/menpo/pull/669.patch"},"body":"This adds the concept of an Immutable LazyList class. This\r\nis essentially a very simple class whereby the elements are\r\ncallables that are assumed to do something *on index*. This is\r\nvery useful for importing because we just immediately return\r\na set of partial import methods that wrap the file paths that\r\nneed to be imported. The disadvantage is obviously that if the\r\nfile system changes after the list is constructed then the\r\nimport will fail. However, the low memory and instant access\r\n(think random access) is a great benefit. To allow for backwards\r\ncompatibility there is a new as_generator argument that restores\r\nthe previous behaviour.\r\n\r\nFinally, there is one major change - now, importers that return\r\nlists of assets will not flatten the overall list - for example,\r\nif you import a GIF, previously the frames would be yielded as\r\nseperate images. Instead, the LazyList will not contain a list\r\nthat contains all the frames of the GIF. If this is a serious game\r\nchanger then we can add a helper generator that will flatten\r\nthe lists. Something that neatly wraps\r\n``list(itertools.chain.from_iterable(assets))``.\r\n\r\n@jabooth This one is for you mate!\r\n\r\nBreaking:\r\n\r\n  - Importers now return `LazyList`\r\n  - Landmark resolvers now receive paths rather than objects"},"comment":{"url":"https://api.github.com/repos/menpo/menpo/issues/comments/181057388","html_url":"https://github.com/menpo/menpo/pull/669#issuecomment-181057388","issue_url":"https://api.github.com/repos/menpo/menpo/issues/669","id":181057388,"user":{"login":"jabooth","id":1312873,"avatar_url":"https://avatars.githubusercontent.com/u/1312873?v=3","gravatar_id":"","url":"https://api.github.com/users/jabooth","html_url":"https://github.com/jabooth","followers_url":"https://api.github.com/users/jabooth/followers","following_url":"https://api.github.com/users/jabooth/following{/other_user}","gists_url":"https://api.github.com/users/jabooth/gists{/gist_id}","starred_url":"https://api.github.com/users/jabooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jabooth/subscriptions","organizations_url":"https://api.github.com/users/jabooth/orgs","repos_url":"https://api.github.com/users/jabooth/repos","events_url":"https://api.github.com/users/jabooth/events{/privacy}","received_events_url":"https://api.github.com/users/jabooth/received_events","type":"User","site_admin":false},"created_at":"2016-02-07T17:31:43Z","updated_at":"2016-02-07T17:31:43Z","body":"Hmm an 'as_cached()' method on LazyList would be sweet:\r\n'''\r\nmenpo.io.import_images(...).as_cached()\r\n'''\r\nImplement just as memoise-wrapping 'self._callables' right?"}}