{"action":"created","comment":{"url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/comments/92057567","pull_request_review_id":12567546,"id":92057567,"diff_hunk":"@@ -0,0 +1,70 @@\n+from enum import Enum\n+\n+from nio.signal.base import Signal\n+from nio.block.base import Block\n+from nio.properties import VersionProperty, SelectProperty, ListProperty\n+from nio.types import StringType\n+\n+\n+class Behavior(Enum):\n+    BLACKLIST = False\n+    WHITELIST = True\n+\n+\n+class AttributeSelector(Block):\n+    \"\"\"\n+    A block for whitelisting or blacklisting incoming signals and notifying\n+    the rest.\n+\n+    Properties:\n+    specify_behavior(select): select either whitelist or blacklist behavior\n+    specify_attributes(list): list of incoming signal attributes to blacklist\n+                              or whitelist\n+    \"\"\"\n+\n+    version = VersionProperty('1.0.0')\n+    specify_behavior = SelectProperty(Behavior, title='Specify behavior',\n+                                      default=Behavior.BLACKLIST)\n+    specify_attributes = ListProperty(StringType,\n+                                      title='Incoming signal attributes',\n+                                      default=[])\n+\n+    def __init__(self):\n+        super().__init__()\n+        self._specify_items = None\n+\n+    def configure(self, context):\n+        super().configure(context)\n+        self._specify_items = set(spec for spec in\n+                                  self.specify_attributes())\n+\n+    def process_signals(self, signals):\n+        self.logger.debug('specifying these attributes: {}'\n+                          .format(self._specify_items))\n+\n+        new_sigs = []\n+        for signal in signals:\n+            sig_dict = signal.to_dict()\n+            specified_items = set(list(sig_dict.keys())).intersection(self._specify_items)\n+\n+            if self.specify_behavior() is Behavior.WHITELIST:\n+                self.logger.debug('whitelisting...')\n+\n+                new_sig = Signal({attr: sig_dict[attr] for attr in specified_items})\n+\n+                self.logger.debug('Allowing incoming attributes: {}'\n+                                  .format(sig_dict))\n+\n+            if self.specify_behavior() is Behavior.BLACKLIST:","path":"attribute_selector_block.py","position":58,"original_position":58,"commit_id":"61ed37aaf82d70661807689746c759b1eba34ac5","original_commit_id":"61ed37aaf82d70661807689746c759b1eba34ac5","user":{"login":"mattdodge","id":797259,"avatar_url":"https://avatars.githubusercontent.com/u/797259?v=3","gravatar_id":"","url":"https://api.github.com/users/mattdodge","html_url":"https://github.com/mattdodge","followers_url":"https://api.github.com/users/mattdodge/followers","following_url":"https://api.github.com/users/mattdodge/following{/other_user}","gists_url":"https://api.github.com/users/mattdodge/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdodge/subscriptions","organizations_url":"https://api.github.com/users/mattdodge/orgs","repos_url":"https://api.github.com/users/mattdodge/repos","events_url":"https://api.github.com/users/mattdodge/events{/privacy}","received_events_url":"https://api.github.com/users/mattdodge/received_events","type":"User","site_admin":false},"body":"Probably `elif` here instead of `if`.","created_at":"2016-12-12T22:39:57Z","updated_at":"2016-12-12T22:39:57Z","html_url":"https://github.com/nio-blocks/attribute_selector/pull/2#discussion_r92057567","pull_request_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/comments/92057567"},"html":{"href":"https://github.com/nio-blocks/attribute_selector/pull/2#discussion_r92057567"},"pull_request":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2","id":97613920,"html_url":"https://github.com/nio-blocks/attribute_selector/pull/2","diff_url":"https://github.com/nio-blocks/attribute_selector/pull/2.diff","patch_url":"https://github.com/nio-blocks/attribute_selector/pull/2.patch","issue_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/2","number":2,"state":"open","locked":false,"title":"attribute_selector block","user":{"login":"dorzel","id":6152541,"avatar_url":"https://avatars.githubusercontent.com/u/6152541?v=3","gravatar_id":"","url":"https://api.github.com/users/dorzel","html_url":"https://github.com/dorzel","followers_url":"https://api.github.com/users/dorzel/followers","following_url":"https://api.github.com/users/dorzel/following{/other_user}","gists_url":"https://api.github.com/users/dorzel/gists{/gist_id}","starred_url":"https://api.github.com/users/dorzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorzel/subscriptions","organizations_url":"https://api.github.com/users/dorzel/orgs","repos_url":"https://api.github.com/users/dorzel/repos","events_url":"https://api.github.com/users/dorzel/events{/privacy}","received_events_url":"https://api.github.com/users/dorzel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-12T19:10:49Z","updated_at":"2016-12-12T22:44:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdde9681fb281a6a64ea435a821ab11870693237","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2/commits","review_comments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2/comments","review_comment_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/2/comments","statuses_url":"https://api.github.com/repos/nio-blocks/attribute_selector/statuses/61ed37aaf82d70661807689746c759b1eba34ac5","head":{"label":"nio-blocks:nio2","ref":"nio2","sha":"61ed37aaf82d70661807689746c759b1eba34ac5","user":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"repo":{"id":76285375,"name":"attribute_selector","full_name":"nio-blocks/attribute_selector","owner":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nio-blocks/attribute_selector","description":"whitelist or blacklist incoming signal attributes","fork":false,"url":"https://api.github.com/repos/nio-blocks/attribute_selector","forks_url":"https://api.github.com/repos/nio-blocks/attribute_selector/forks","keys_url":"https://api.github.com/repos/nio-blocks/attribute_selector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nio-blocks/attribute_selector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nio-blocks/attribute_selector/teams","hooks_url":"https://api.github.com/repos/nio-blocks/attribute_selector/hooks","issue_events_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/events{/number}","events_url":"https://api.github.com/repos/nio-blocks/attribute_selector/events","assignees_url":"https://api.github.com/repos/nio-blocks/attribute_selector/assignees{/user}","branches_url":"https://api.github.com/repos/nio-blocks/attribute_selector/branches{/branch}","tags_url":"https://api.github.com/repos/nio-blocks/attribute_selector/tags","blobs_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/refs{/sha}","trees_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nio-blocks/attribute_selector/statuses/{sha}","languages_url":"https://api.github.com/repos/nio-blocks/attribute_selector/languages","stargazers_url":"https://api.github.com/repos/nio-blocks/attribute_selector/stargazers","contributors_url":"https://api.github.com/repos/nio-blocks/attribute_selector/contributors","subscribers_url":"https://api.github.com/repos/nio-blocks/attribute_selector/subscribers","subscription_url":"https://api.github.com/repos/nio-blocks/attribute_selector/subscription","commits_url":"https://api.github.com/repos/nio-blocks/attribute_selector/commits{/sha}","git_commits_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/commits{/sha}","comments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/comments{/number}","issue_comment_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/comments{/number}","contents_url":"https://api.github.com/repos/nio-blocks/attribute_selector/contents/{+path}","compare_url":"https://api.github.com/repos/nio-blocks/attribute_selector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nio-blocks/attribute_selector/merges","archive_url":"https://api.github.com/repos/nio-blocks/attribute_selector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nio-blocks/attribute_selector/downloads","issues_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues{/number}","pulls_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls{/number}","milestones_url":"https://api.github.com/repos/nio-blocks/attribute_selector/milestones{/number}","notifications_url":"https://api.github.com/repos/nio-blocks/attribute_selector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nio-blocks/attribute_selector/labels{/name}","releases_url":"https://api.github.com/repos/nio-blocks/attribute_selector/releases{/id}","deployments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/deployments","created_at":"2016-12-12T18:49:09Z","updated_at":"2016-12-12T21:19:58Z","pushed_at":"2016-12-12T21:42:45Z","git_url":"git://github.com/nio-blocks/attribute_selector.git","ssh_url":"git@github.com:nio-blocks/attribute_selector.git","clone_url":"https://github.com/nio-blocks/attribute_selector.git","svn_url":"https://github.com/nio-blocks/attribute_selector","homepage":"","size":11,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"nio2"}},"base":{"label":"nio-blocks:master","ref":"master","sha":"e03d2ae671ffefc4feffc6db691788b5a7695642","user":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"repo":{"id":76285375,"name":"attribute_selector","full_name":"nio-blocks/attribute_selector","owner":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nio-blocks/attribute_selector","description":"whitelist or blacklist incoming signal attributes","fork":false,"url":"https://api.github.com/repos/nio-blocks/attribute_selector","forks_url":"https://api.github.com/repos/nio-blocks/attribute_selector/forks","keys_url":"https://api.github.com/repos/nio-blocks/attribute_selector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nio-blocks/attribute_selector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nio-blocks/attribute_selector/teams","hooks_url":"https://api.github.com/repos/nio-blocks/attribute_selector/hooks","issue_events_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/events{/number}","events_url":"https://api.github.com/repos/nio-blocks/attribute_selector/events","assignees_url":"https://api.github.com/repos/nio-blocks/attribute_selector/assignees{/user}","branches_url":"https://api.github.com/repos/nio-blocks/attribute_selector/branches{/branch}","tags_url":"https://api.github.com/repos/nio-blocks/attribute_selector/tags","blobs_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/refs{/sha}","trees_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nio-blocks/attribute_selector/statuses/{sha}","languages_url":"https://api.github.com/repos/nio-blocks/attribute_selector/languages","stargazers_url":"https://api.github.com/repos/nio-blocks/attribute_selector/stargazers","contributors_url":"https://api.github.com/repos/nio-blocks/attribute_selector/contributors","subscribers_url":"https://api.github.com/repos/nio-blocks/attribute_selector/subscribers","subscription_url":"https://api.github.com/repos/nio-blocks/attribute_selector/subscription","commits_url":"https://api.github.com/repos/nio-blocks/attribute_selector/commits{/sha}","git_commits_url":"https://api.github.com/repos/nio-blocks/attribute_selector/git/commits{/sha}","comments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/comments{/number}","issue_comment_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/comments{/number}","contents_url":"https://api.github.com/repos/nio-blocks/attribute_selector/contents/{+path}","compare_url":"https://api.github.com/repos/nio-blocks/attribute_selector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nio-blocks/attribute_selector/merges","archive_url":"https://api.github.com/repos/nio-blocks/attribute_selector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nio-blocks/attribute_selector/downloads","issues_url":"https://api.github.com/repos/nio-blocks/attribute_selector/issues{/number}","pulls_url":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls{/number}","milestones_url":"https://api.github.com/repos/nio-blocks/attribute_selector/milestones{/number}","notifications_url":"https://api.github.com/repos/nio-blocks/attribute_selector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nio-blocks/attribute_selector/labels{/name}","releases_url":"https://api.github.com/repos/nio-blocks/attribute_selector/releases{/id}","deployments_url":"https://api.github.com/repos/nio-blocks/attribute_selector/deployments","created_at":"2016-12-12T18:49:09Z","updated_at":"2016-12-12T21:19:58Z","pushed_at":"2016-12-12T21:42:45Z","git_url":"git://github.com/nio-blocks/attribute_selector.git","ssh_url":"git@github.com:nio-blocks/attribute_selector.git","clone_url":"https://github.com/nio-blocks/attribute_selector.git","svn_url":"https://github.com/nio-blocks/attribute_selector","homepage":"","size":11,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"nio2"}},"_links":{"self":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2"},"html":{"href":"https://github.com/nio-blocks/attribute_selector/pull/2"},"issue":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/2"},"comments":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/nio-blocks/attribute_selector/statuses/61ed37aaf82d70661807689746c759b1eba34ac5"}}}}
{"actor":{"display_login":"mattdodge"}}