payload: {"action":"created","comment":{"url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/comments/262260848","pull_request_review_id":210388477,"id":262260848,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2MjI2MDg0OA==","diff_hunk":"@@ -780,30 +792,79 @@ def latest(self):\n \n         return tuple(latest)\n \n-    def filter(self, start=None, end=None):\n+    def filter(self, start=None, end=None, collection=None, name=None, unit=None,\n+               tags=None, annotations=None):\n         \"\"\"\n-        Stores filtering attributes for queries to be eventually materialized\n-        from the database.  This method will return a new StreamSet instance.\n+        Provides a new StreamSet instance containing stored query parameters and\n+        stream objects that match filtering criteria.\n+\n+        The collection, name, and unit arguments will be used to select streams\n+        from the original StreamSet object based on a case-insensitive regex\n+        search.\n+\n+        The tags and annotations arguments expect dictionaries for the desired\n+        key/value pairs.  Any stream in the original instance that has the exact\n+        key/values will be included in the new StreamSet instance.\n \n         Parameters\n         ----------\n-        start : int\n-            A int indicating the inclusive start of the query\n-        end : int\n-            A int indicating the exclusive end of the query\n+        start : int or datetime like object\n+            the inclusive start of the query (see :meth:`btrdb.utils.timez.to_nanoseconds`\n+            for valid input types)\n+        end : int or datetime like object\n+            the exclusive end of the query (see :func:`btrdb.utils.timez.to_nanoseconds`\n+            for valid input types)\n+        collection : str or regex\n+            pattern (case-insensitive) for filtering streams based on collection\n+        name : str or regex\n+            pattern (case-insensitive) for filtering streams based on name\n+        unit : str or regex\n+            pattern (case-insensitive) for filtering streams based on unit\n+        tags : dict\n+            key/value pairs for filtering streams based on tags\n+        annotations : dict\n+            key/value pairs for filtering streams based on annotations\n \n         Returns\n         -------\n         StreamSet\n-            Returns a new copy of the instance\n+            a new copy of the instance\n \n         \"\"\"\n \n-        if start is None and end is None:\n-            raise ValueError(\"A valid `start` or `end` must be supplied\")\n-\n         obj = self.clone()\n-        obj.filters.append(StreamFilter(start, end))\n+        if start is not None or end is not None:\n+            obj.filters.append(StreamFilter(start, end))\n+\n+        # filter by collection\n+        if collection is not None:\n+            reg = _to_regex(collection, \"collection\")\n+            obj._streams = [s for s in obj._streams for m in [reg.search(s.collection)] if m]","path":"btrdb/stream.py","position":221,"original_position":137,"commit_id":"1800793e9f091d7ba668d41df8486213705301c2","original_commit_id":"8b91d092a1fa66851aba39e3b1a3a900d51c7454","user":{"login":"looselycoupled","id":41358,"node_id":"MDQ6VXNlcjQxMzU4","avatar_url":"https://avatars3.githubusercontent.com/u/41358?v=4","gravatar_id":"","url":"https://api.github.com/users/looselycoupled","html_url":"https://github.com/looselycoupled","followers_url":"https://api.github.com/users/looselycoupled/followers","following_url":"https://api.github.com/users/looselycoupled/following{/other_user}","gists_url":"https://api.github.com/users/looselycoupled/gists{/gist_id}","starred_url":"https://api.github.com/users/looselycoupled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/looselycoupled/subscriptions","organizations_url":"https://api.github.com/users/looselycoupled/orgs","repos_url":"https://api.github.com/users/looselycoupled/repos","events_url":"https://api.github.com/users/looselycoupled/events{/privacy}","received_events_url":"https://api.github.com/users/looselycoupled/received_events","type":"User","site_admin":false},"body":"I did consider it but it seemed better to make the change immediately and I felt we had (implicitly) settled that it should happen right away.  I've actually been kicking around the idea of a new ticket which gets rid of the StreamFilter object as it seems that pattern isn't really going anywhere.\r\n","created_at":"2019-03-04T21:56:14Z","updated_at":"2019-03-04T21:56:15Z","html_url":"https://github.com/BTrDB/btrdb-python/pull/41#discussion_r262260848","pull_request_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/comments/262260848"},"html":{"href":"https://github.com/BTrDB/btrdb-python/pull/41#discussion_r262260848"},"pull_request":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41"}},"in_reply_to_id":261626011},"pull_request":{"url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41","id":257241494,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU3MjQxNDk0","html_url":"https://github.com/BTrDB/btrdb-python/pull/41","diff_url":"https://github.com/BTrDB/btrdb-python/pull/41.diff","patch_url":"https://github.com/BTrDB/btrdb-python/pull/41.patch","issue_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/41","number":41,"state":"open","locked":false,"title":"Adds filtering arguments to StreamSet [ch647]","user":{"login":"looselycoupled","id":41358,"node_id":"MDQ6VXNlcjQxMzU4","avatar_url":"https://avatars3.githubusercontent.com/u/41358?v=4","gravatar_id":"","url":"https://api.github.com/users/looselycoupled","html_url":"https://github.com/looselycoupled","followers_url":"https://api.github.com/users/looselycoupled/followers","following_url":"https://api.github.com/users/looselycoupled/following{/other_user}","gists_url":"https://api.github.com/users/looselycoupled/gists{/gist_id}","starred_url":"https://api.github.com/users/looselycoupled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/looselycoupled/subscriptions","organizations_url":"https://api.github.com/users/looselycoupled/orgs","repos_url":"https://api.github.com/users/looselycoupled/repos","events_url":"https://api.github.com/users/looselycoupled/events{/privacy}","received_events_url":"https://api.github.com/users/looselycoupled/received_events","type":"User","site_admin":false},"body":"Adds filtering options to `StreamSet.filter()` for:\r\n\r\n* collection\r\n* name\r\n* unit\r\n* tags\r\n* annotations\r\n\r\n`collection`, `name`, `unit` perform a case-insensitive regex search to filter out non matching streams.  `tags` and `annotations` get a dict in which the keys/values must exactly match.\r\n\r\nLooking for comments on how `_to_regex` was handled.  Remove func?  Remove exc? traceback?","created_at":"2019-02-28T21:51:30Z","updated_at":"2019-03-04T21:56:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fcd3e99810cd288a3893671f1e66b72e95b0524","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41/commits","review_comments_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41/comments","review_comment_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/41/comments","statuses_url":"https://api.github.com/repos/BTrDB/btrdb-python/statuses/1800793e9f091d7ba668d41df8486213705301c2","head":{"label":"BTrDB:feature-ch647-filter","ref":"feature-ch647-filter","sha":"1800793e9f091d7ba668d41df8486213705301c2","user":{"login":"BTrDB","id":33163835,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTYzODM1","avatar_url":"https://avatars3.githubusercontent.com/u/33163835?v=4","gravatar_id":"","url":"https://api.github.com/users/BTrDB","html_url":"https://github.com/BTrDB","followers_url":"https://api.github.com/users/BTrDB/followers","following_url":"https://api.github.com/users/BTrDB/following{/other_user}","gists_url":"https://api.github.com/users/BTrDB/gists{/gist_id}","starred_url":"https://api.github.com/users/BTrDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BTrDB/subscriptions","organizations_url":"https://api.github.com/users/BTrDB/orgs","repos_url":"https://api.github.com/users/BTrDB/repos","events_url":"https://api.github.com/users/BTrDB/events{/privacy}","received_events_url":"https://api.github.com/users/BTrDB/received_events","type":"Organization","site_admin":false},"repo":{"id":85442092,"node_id":"MDEwOlJlcG9zaXRvcnk4NTQ0MjA5Mg==","name":"btrdb-python","full_name":"BTrDB/btrdb-python","private":false,"owner":{"login":"BTrDB","id":33163835,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTYzODM1","avatar_url":"https://avatars3.githubusercontent.com/u/33163835?v=4","gravatar_id":"","url":"https://api.github.com/users/BTrDB","html_url":"https://github.com/BTrDB","followers_url":"https://api.github.com/users/BTrDB/followers","following_url":"https://api.github.com/users/BTrDB/following{/other_user}","gists_url":"https://api.github.com/users/BTrDB/gists{/gist_id}","starred_url":"https://api.github.com/users/BTrDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BTrDB/subscriptions","organizations_url":"https://api.github.com/users/BTrDB/orgs","repos_url":"https://api.github.com/users/BTrDB/repos","events_url":"https://api.github.com/users/BTrDB/events{/privacy}","received_events_url":"https://api.github.com/users/BTrDB/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/BTrDB/btrdb-python","description":"BTrDB bindings for Python","fork":false,"url":"https://api.github.com/repos/BTrDB/btrdb-python","forks_url":"https://api.github.com/repos/BTrDB/btrdb-python/forks","keys_url":"https://api.github.com/repos/BTrDB/btrdb-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BTrDB/btrdb-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BTrDB/btrdb-python/teams","hooks_url":"https://api.github.com/repos/BTrDB/btrdb-python/hooks","issue_events_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/events{/number}","events_url":"https://api.github.com/repos/BTrDB/btrdb-python/events","assignees_url":"https://api.github.com/repos/BTrDB/btrdb-python/assignees{/user}","branches_url":"https://api.github.com/repos/BTrDB/btrdb-python/branches{/branch}","tags_url":"https://api.github.com/repos/BTrDB/btrdb-python/tags","blobs_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BTrDB/btrdb-python/statuses/{sha}","languages_url":"https://api.github.com/repos/BTrDB/btrdb-python/languages","stargazers_url":"https://api.github.com/repos/BTrDB/btrdb-python/stargazers","contributors_url":"https://api.github.com/repos/BTrDB/btrdb-python/contributors","subscribers_url":"https://api.github.com/repos/BTrDB/btrdb-python/subscribers","subscription_url":"https://api.github.com/repos/BTrDB/btrdb-python/subscription","commits_url":"https://api.github.com/repos/BTrDB/btrdb-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/BTrDB/btrdb-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/BTrDB/btrdb-python/contents/{+path}","compare_url":"https://api.github.com/repos/BTrDB/btrdb-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BTrDB/btrdb-python/merges","archive_url":"https://api.github.com/repos/BTrDB/btrdb-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BTrDB/btrdb-python/downloads","issues_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues{/number}","pulls_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls{/number}","milestones_url":"https://api.github.com/repos/BTrDB/btrdb-python/milestones{/number}","notifications_url":"https://api.github.com/repos/BTrDB/btrdb-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BTrDB/btrdb-python/labels{/name}","releases_url":"https://api.github.com/repos/BTrDB/btrdb-python/releases{/id}","deployments_url":"https://api.github.com/repos/BTrDB/btrdb-python/deployments","created_at":"2017-03-19T00:59:14Z","updated_at":"2019-02-10T18:38:02Z","pushed_at":"2019-03-04T21:55:53Z","git_url":"git://github.com/BTrDB/btrdb-python.git","ssh_url":"git@github.com:BTrDB/btrdb-python.git","clone_url":"https://github.com/BTrDB/btrdb-python.git","svn_url":"https://github.com/BTrDB/btrdb-python","homepage":"https://btrdb.readthedocs.io/en/latest/","size":261,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":2,"watchers":5,"default_branch":"master"}},"base":{"label":"BTrDB:develop","ref":"develop","sha":"6f44d1d4032158a545f94bf5d83cf4e928a8ab85","user":{"login":"BTrDB","id":33163835,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTYzODM1","avatar_url":"https://avatars3.githubusercontent.com/u/33163835?v=4","gravatar_id":"","url":"https://api.github.com/users/BTrDB","html_url":"https://github.com/BTrDB","followers_url":"https://api.github.com/users/BTrDB/followers","following_url":"https://api.github.com/users/BTrDB/following{/other_user}","gists_url":"https://api.github.com/users/BTrDB/gists{/gist_id}","starred_url":"https://api.github.com/users/BTrDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BTrDB/subscriptions","organizations_url":"https://api.github.com/users/BTrDB/orgs","repos_url":"https://api.github.com/users/BTrDB/repos","events_url":"https://api.github.com/users/BTrDB/events{/privacy}","received_events_url":"https://api.github.com/users/BTrDB/received_events","type":"Organization","site_admin":false},"repo":{"id":85442092,"node_id":"MDEwOlJlcG9zaXRvcnk4NTQ0MjA5Mg==","name":"btrdb-python","full_name":"BTrDB/btrdb-python","private":false,"owner":{"login":"BTrDB","id":33163835,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMTYzODM1","avatar_url":"https://avatars3.githubusercontent.com/u/33163835?v=4","gravatar_id":"","url":"https://api.github.com/users/BTrDB","html_url":"https://github.com/BTrDB","followers_url":"https://api.github.com/users/BTrDB/followers","following_url":"https://api.github.com/users/BTrDB/following{/other_user}","gists_url":"https://api.github.com/users/BTrDB/gists{/gist_id}","starred_url":"https://api.github.com/users/BTrDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BTrDB/subscriptions","organizations_url":"https://api.github.com/users/BTrDB/orgs","repos_url":"https://api.github.com/users/BTrDB/repos","events_url":"https://api.github.com/users/BTrDB/events{/privacy}","received_events_url":"https://api.github.com/users/BTrDB/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/BTrDB/btrdb-python","description":"BTrDB bindings for Python","fork":false,"url":"https://api.github.com/repos/BTrDB/btrdb-python","forks_url":"https://api.github.com/repos/BTrDB/btrdb-python/forks","keys_url":"https://api.github.com/repos/BTrDB/btrdb-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BTrDB/btrdb-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BTrDB/btrdb-python/teams","hooks_url":"https://api.github.com/repos/BTrDB/btrdb-python/hooks","issue_events_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/events{/number}","events_url":"https://api.github.com/repos/BTrDB/btrdb-python/events","assignees_url":"https://api.github.com/repos/BTrDB/btrdb-python/assignees{/user}","branches_url":"https://api.github.com/repos/BTrDB/btrdb-python/branches{/branch}","tags_url":"https://api.github.com/repos/BTrDB/btrdb-python/tags","blobs_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BTrDB/btrdb-python/statuses/{sha}","languages_url":"https://api.github.com/repos/BTrDB/btrdb-python/languages","stargazers_url":"https://api.github.com/repos/BTrDB/btrdb-python/stargazers","contributors_url":"https://api.github.com/repos/BTrDB/btrdb-python/contributors","subscribers_url":"https://api.github.com/repos/BTrDB/btrdb-python/subscribers","subscription_url":"https://api.github.com/repos/BTrDB/btrdb-python/subscription","commits_url":"https://api.github.com/repos/BTrDB/btrdb-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/BTrDB/btrdb-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/BTrDB/btrdb-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/BTrDB/btrdb-python/contents/{+path}","compare_url":"https://api.github.com/repos/BTrDB/btrdb-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BTrDB/btrdb-python/merges","archive_url":"https://api.github.com/repos/BTrDB/btrdb-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BTrDB/btrdb-python/downloads","issues_url":"https://api.github.com/repos/BTrDB/btrdb-python/issues{/number}","pulls_url":"https://api.github.com/repos/BTrDB/btrdb-python/pulls{/number}","milestones_url":"https://api.github.com/repos/BTrDB/btrdb-python/milestones{/number}","notifications_url":"https://api.github.com/repos/BTrDB/btrdb-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BTrDB/btrdb-python/labels{/name}","releases_url":"https://api.github.com/repos/BTrDB/btrdb-python/releases{/id}","deployments_url":"https://api.github.com/repos/BTrDB/btrdb-python/deployments","created_at":"2017-03-19T00:59:14Z","updated_at":"2019-02-10T18:38:02Z","pushed_at":"2019-03-04T21:55:53Z","git_url":"git://github.com/BTrDB/btrdb-python.git","ssh_url":"git@github.com:BTrDB/btrdb-python.git","clone_url":"https://github.com/BTrDB/btrdb-python.git","svn_url":"https://github.com/BTrDB/btrdb-python","homepage":"https://btrdb.readthedocs.io/en/latest/","size":261,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41"},"html":{"href":"https://github.com/BTrDB/btrdb-python/pull/41"},"issue":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/issues/41"},"comments":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/BTrDB/btrdb-python/statuses/1800793e9f091d7ba668d41df8486213705301c2"}},"author_association":"COLLABORATOR"}}
other: {"actor":{"display_login":"looselycoupled"}}