{"action":"created","comment":{"url":"https://api.github.com/repos/dask/zict/pulls/comments/85197381","pull_request_review_id":5926691,"id":85197381,"diff_hunk":"@@ -0,0 +1,88 @@\n+from __future__ import absolute_import, division, print_function\n+\n+from collections import MutableMapping\n+from itertools import chain\n+import sys\n+\n+\n+class Sieve(MutableMapping):\n+    \"\"\" Store values in different mappings based on their sizes.\n+\n+    This creates a MutableMapping by combining two MutableMappings,\n+    one that stores values strictly smaller (in bytes) than a given\n+    threshold, the other storing the other values.\n+\n+    Only the size of values, not keys, is considered, since keys are\n+    likely kept in memory for bookkeeping purposes anyway.\n+\n+    Parameters\n+    ----------\n+    small: MutableMapping\n+    large: MutableMapping\n+    threshold: int\n+        The number of bytes below which values are stored in the *small*\n+        mapping.\n+\n+    Examples\n+    --------\n+    >>> small = {}\n+    >>> large = Func(dumps, loads, File('storage/'))  # doctest: +SKIP\n+    >>> store = Sieve(small, large, threshold=1024 ** 2)  # doctest: +SKIP\n+\n+    See Also\n+    --------\n+    Buffer\n+    \"\"\"\n+    def __init__(self, small, large, threshold):","path":"zict/sieve.py","position":36,"original_position":36,"commit_id":"f77b18c43020dfc4f7dd0a82477eecdc4264fd43","original_commit_id":"f77b18c43020dfc4f7dd0a82477eecdc4264fd43","user":{"login":"gdementen","id":832092,"avatar_url":"https://avatars.githubusercontent.com/u/832092?v=3","gravatar_id":"","url":"https://api.github.com/users/gdementen","html_url":"https://github.com/gdementen","followers_url":"https://api.github.com/users/gdementen/followers","following_url":"https://api.github.com/users/gdementen/following{/other_user}","gists_url":"https://api.github.com/users/gdementen/gists{/gist_id}","starred_url":"https://api.github.com/users/gdementen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdementen/subscriptions","organizations_url":"https://api.github.com/users/gdementen/orgs","repos_url":"https://api.github.com/users/gdementen/repos","events_url":"https://api.github.com/users/gdementen/events{/privacy}","received_events_url":"https://api.github.com/users/gdementen/received_events","type":"User","site_admin":false},"body":"In that case, why not simply let the whole decision up to the function? ie make it return True/False for small/large. Personally, I would even generalize this into a collection (list or dict, whatever the user passes) of zict and a decision function which returns the indexer of the zict to use, so that you can have sharding!","created_at":"2016-10-26T19:09:21Z","updated_at":"2016-10-26T19:09:21Z","html_url":"https://github.com/dask/zict/pull/5#discussion_r85197381","pull_request_url":"https://api.github.com/repos/dask/zict/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/dask/zict/pulls/comments/85197381"},"html":{"href":"https://github.com/dask/zict/pull/5#discussion_r85197381"},"pull_request":{"href":"https://api.github.com/repos/dask/zict/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/dask/zict/pulls/5","id":91010670,"html_url":"https://github.com/dask/zict/pull/5","diff_url":"https://github.com/dask/zict/pull/5.diff","patch_url":"https://github.com/dask/zict/pull/5.patch","issue_url":"https://api.github.com/repos/dask/zict/issues/5","number":5,"state":"open","locked":false,"title":"Add a Sieve mapping","user":{"login":"pitrou","id":1721820,"avatar_url":"https://avatars.githubusercontent.com/u/1721820?v=3","gravatar_id":"","url":"https://api.github.com/users/pitrou","html_url":"https://github.com/pitrou","followers_url":"https://api.github.com/users/pitrou/followers","following_url":"https://api.github.com/users/pitrou/following{/other_user}","gists_url":"https://api.github.com/users/pitrou/gists{/gist_id}","starred_url":"https://api.github.com/users/pitrou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitrou/subscriptions","organizations_url":"https://api.github.com/users/pitrou/orgs","repos_url":"https://api.github.com/users/pitrou/repos","events_url":"https://api.github.com/users/pitrou/events{/privacy}","received_events_url":"https://api.github.com/users/pitrou/received_events","type":"User","site_admin":false},"body":"The Sieve object stores small enough values in a mapping and large values in another. It allows implementing storage strategies such as \"store large values in individual files, but small values in a key-value store\".\r\n\r\nBased on PR #4.","created_at":"2016-10-26T14:02:48Z","updated_at":"2016-10-26T19:09:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2976f7ad34a663100ca5267c501bf5ca349f9776","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dask/zict/pulls/5/commits","review_comments_url":"https://api.github.com/repos/dask/zict/pulls/5/comments","review_comment_url":"https://api.github.com/repos/dask/zict/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dask/zict/issues/5/comments","statuses_url":"https://api.github.com/repos/dask/zict/statuses/f77b18c43020dfc4f7dd0a82477eecdc4264fd43","head":{"label":"pitrou:sieve","ref":"sieve","sha":"f77b18c43020dfc4f7dd0a82477eecdc4264fd43","user":{"login":"pitrou","id":1721820,"avatar_url":"https://avatars.githubusercontent.com/u/1721820?v=3","gravatar_id":"","url":"https://api.github.com/users/pitrou","html_url":"https://github.com/pitrou","followers_url":"https://api.github.com/users/pitrou/followers","following_url":"https://api.github.com/users/pitrou/following{/other_user}","gists_url":"https://api.github.com/users/pitrou/gists{/gist_id}","starred_url":"https://api.github.com/users/pitrou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitrou/subscriptions","organizations_url":"https://api.github.com/users/pitrou/orgs","repos_url":"https://api.github.com/users/pitrou/repos","events_url":"https://api.github.com/users/pitrou/events{/privacy}","received_events_url":"https://api.github.com/users/pitrou/received_events","type":"User","site_admin":false},"repo":{"id":71915374,"name":"zict","full_name":"pitrou/zict","owner":{"login":"pitrou","id":1721820,"avatar_url":"https://avatars.githubusercontent.com/u/1721820?v=3","gravatar_id":"","url":"https://api.github.com/users/pitrou","html_url":"https://github.com/pitrou","followers_url":"https://api.github.com/users/pitrou/followers","following_url":"https://api.github.com/users/pitrou/following{/other_user}","gists_url":"https://api.github.com/users/pitrou/gists{/gist_id}","starred_url":"https://api.github.com/users/pitrou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitrou/subscriptions","organizations_url":"https://api.github.com/users/pitrou/orgs","repos_url":"https://api.github.com/users/pitrou/repos","events_url":"https://api.github.com/users/pitrou/events{/privacy}","received_events_url":"https://api.github.com/users/pitrou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pitrou/zict","description":"Useful Mutable Mappings","fork":true,"url":"https://api.github.com/repos/pitrou/zict","forks_url":"https://api.github.com/repos/pitrou/zict/forks","keys_url":"https://api.github.com/repos/pitrou/zict/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pitrou/zict/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pitrou/zict/teams","hooks_url":"https://api.github.com/repos/pitrou/zict/hooks","issue_events_url":"https://api.github.com/repos/pitrou/zict/issues/events{/number}","events_url":"https://api.github.com/repos/pitrou/zict/events","assignees_url":"https://api.github.com/repos/pitrou/zict/assignees{/user}","branches_url":"https://api.github.com/repos/pitrou/zict/branches{/branch}","tags_url":"https://api.github.com/repos/pitrou/zict/tags","blobs_url":"https://api.github.com/repos/pitrou/zict/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pitrou/zict/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pitrou/zict/git/refs{/sha}","trees_url":"https://api.github.com/repos/pitrou/zict/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pitrou/zict/statuses/{sha}","languages_url":"https://api.github.com/repos/pitrou/zict/languages","stargazers_url":"https://api.github.com/repos/pitrou/zict/stargazers","contributors_url":"https://api.github.com/repos/pitrou/zict/contributors","subscribers_url":"https://api.github.com/repos/pitrou/zict/subscribers","subscription_url":"https://api.github.com/repos/pitrou/zict/subscription","commits_url":"https://api.github.com/repos/pitrou/zict/commits{/sha}","git_commits_url":"https://api.github.com/repos/pitrou/zict/git/commits{/sha}","comments_url":"https://api.github.com/repos/pitrou/zict/comments{/number}","issue_comment_url":"https://api.github.com/repos/pitrou/zict/issues/comments{/number}","contents_url":"https://api.github.com/repos/pitrou/zict/contents/{+path}","compare_url":"https://api.github.com/repos/pitrou/zict/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pitrou/zict/merges","archive_url":"https://api.github.com/repos/pitrou/zict/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pitrou/zict/downloads","issues_url":"https://api.github.com/repos/pitrou/zict/issues{/number}","pulls_url":"https://api.github.com/repos/pitrou/zict/pulls{/number}","milestones_url":"https://api.github.com/repos/pitrou/zict/milestones{/number}","notifications_url":"https://api.github.com/repos/pitrou/zict/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pitrou/zict/labels{/name}","releases_url":"https://api.github.com/repos/pitrou/zict/releases{/id}","deployments_url":"https://api.github.com/repos/pitrou/zict/deployments","created_at":"2016-10-25T16:12:01Z","updated_at":"2016-10-25T16:12:02Z","pushed_at":"2016-10-26T14:00:42Z","git_url":"git://github.com/pitrou/zict.git","ssh_url":"git@github.com:pitrou/zict.git","clone_url":"https://github.com/pitrou/zict.git","svn_url":"https://github.com/pitrou/zict","homepage":null,"size":46,"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":"dask:master","ref":"master","sha":"f44c5c2df1d7309521f6d0d5a2b06fbd58bdf4ed","user":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"repo":{"id":55317082,"name":"zict","full_name":"dask/zict","owner":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dask/zict","description":"Useful Mutable Mappings","fork":false,"url":"https://api.github.com/repos/dask/zict","forks_url":"https://api.github.com/repos/dask/zict/forks","keys_url":"https://api.github.com/repos/dask/zict/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dask/zict/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dask/zict/teams","hooks_url":"https://api.github.com/repos/dask/zict/hooks","issue_events_url":"https://api.github.com/repos/dask/zict/issues/events{/number}","events_url":"https://api.github.com/repos/dask/zict/events","assignees_url":"https://api.github.com/repos/dask/zict/assignees{/user}","branches_url":"https://api.github.com/repos/dask/zict/branches{/branch}","tags_url":"https://api.github.com/repos/dask/zict/tags","blobs_url":"https://api.github.com/repos/dask/zict/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dask/zict/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dask/zict/git/refs{/sha}","trees_url":"https://api.github.com/repos/dask/zict/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dask/zict/statuses/{sha}","languages_url":"https://api.github.com/repos/dask/zict/languages","stargazers_url":"https://api.github.com/repos/dask/zict/stargazers","contributors_url":"https://api.github.com/repos/dask/zict/contributors","subscribers_url":"https://api.github.com/repos/dask/zict/subscribers","subscription_url":"https://api.github.com/repos/dask/zict/subscription","commits_url":"https://api.github.com/repos/dask/zict/commits{/sha}","git_commits_url":"https://api.github.com/repos/dask/zict/git/commits{/sha}","comments_url":"https://api.github.com/repos/dask/zict/comments{/number}","issue_comment_url":"https://api.github.com/repos/dask/zict/issues/comments{/number}","contents_url":"https://api.github.com/repos/dask/zict/contents/{+path}","compare_url":"https://api.github.com/repos/dask/zict/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dask/zict/merges","archive_url":"https://api.github.com/repos/dask/zict/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dask/zict/downloads","issues_url":"https://api.github.com/repos/dask/zict/issues{/number}","pulls_url":"https://api.github.com/repos/dask/zict/pulls{/number}","milestones_url":"https://api.github.com/repos/dask/zict/milestones{/number}","notifications_url":"https://api.github.com/repos/dask/zict/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dask/zict/labels{/name}","releases_url":"https://api.github.com/repos/dask/zict/releases{/id}","deployments_url":"https://api.github.com/repos/dask/zict/deployments","created_at":"2016-04-02T21:30:07Z","updated_at":"2016-10-26T02:39:16Z","pushed_at":"2016-10-26T14:02:48Z","git_url":"git://github.com/dask/zict.git","ssh_url":"git@github.com:dask/zict.git","clone_url":"https://github.com/dask/zict.git","svn_url":"https://github.com/dask/zict","homepage":null,"size":33,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dask/zict/pulls/5"},"html":{"href":"https://github.com/dask/zict/pull/5"},"issue":{"href":"https://api.github.com/repos/dask/zict/issues/5"},"comments":{"href":"https://api.github.com/repos/dask/zict/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/dask/zict/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/dask/zict/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dask/zict/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/dask/zict/statuses/f77b18c43020dfc4f7dd0a82477eecdc4264fd43"}}}}
{"actor":{"display_login":"gdementen"}}