{"action":"created","comment":{"url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/comments/214522682","pull_request_review_id":151603003,"id":214522682,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDUyMjY4Mg==","diff_hunk":"@@ -118,6 +118,15 @@ def to_dict(self, manager):\n \n         return data\n \n+    def can_add_condition(self, namespace, field_name, condition):\n+        if namespace not in self.value:\n+            self.value[namespace] = {}\n+        if field_name not in self.value[namespace]:\n+            self.value[namespace][field_name] = []\n+        if condition not in (c for _, c in self.value[namespace][field_name]):","path":"gargoyle/models.py","position":9,"original_position":9,"commit_id":"dcc929181b6b17e8d1c0b86600eab208767903ad","original_commit_id":"dcc929181b6b17e8d1c0b86600eab208767903ad","user":{"login":"adamchainz","id":857609,"node_id":"MDQ6VXNlcjg1NzYwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/857609?v=4","gravatar_id":"","url":"https://api.github.com/users/adamchainz","html_url":"https://github.com/adamchainz","followers_url":"https://api.github.com/users/adamchainz/followers","following_url":"https://api.github.com/users/adamchainz/following{/other_user}","gists_url":"https://api.github.com/users/adamchainz/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchainz/subscriptions","organizations_url":"https://api.github.com/users/adamchainz/orgs","repos_url":"https://api.github.com/users/adamchainz/repos","events_url":"https://api.github.com/users/adamchainz/events{/privacy}","received_events_url":"https://api.github.com/users/adamchainz/received_events","type":"User","site_admin":false},"body":"I'd prefer two lines for readability, and then the `if ... return True else return False` can be collapsed:\r\n\r\n```python\r\nconditions = [c for _, c in self.value[namespace][field_name]]\r\nreturn condition not in conditions\r\n```","created_at":"2018-09-01T20:42:24Z","updated_at":"2018-09-01T20:44:58Z","html_url":"https://github.com/adamchainz/gargoyle/pull/212#discussion_r214522682","pull_request_url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/comments/214522682"},"html":{"href":"https://github.com/adamchainz/gargoyle/pull/212#discussion_r214522682"},"pull_request":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212"}}},"pull_request":{"url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212","id":212212888,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMjEyODg4","html_url":"https://github.com/adamchainz/gargoyle/pull/212","diff_url":"https://github.com/adamchainz/gargoyle/pull/212.diff","patch_url":"https://github.com/adamchainz/gargoyle/pull/212.patch","issue_url":"https://api.github.com/repos/adamchainz/gargoyle/issues/212","number":212,"state":"open","locked":false,"title":"Handle conflicting conditions","user":{"login":"sssbox","id":181096,"node_id":"MDQ6VXNlcjE4MTA5Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/181096?v=4","gravatar_id":"","url":"https://api.github.com/users/sssbox","html_url":"https://github.com/sssbox","followers_url":"https://api.github.com/users/sssbox/followers","following_url":"https://api.github.com/users/sssbox/following{/other_user}","gists_url":"https://api.github.com/users/sssbox/gists{/gist_id}","starred_url":"https://api.github.com/users/sssbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sssbox/subscriptions","organizations_url":"https://api.github.com/users/sssbox/orgs","repos_url":"https://api.github.com/users/sssbox/repos","events_url":"https://api.github.com/users/sssbox/events{/privacy}","received_events_url":"https://api.github.com/users/sssbox/received_events","type":"User","site_admin":false},"body":"Addresses https://github.com/adamchainz/gargoyle/issues/207","created_at":"2018-08-30T21:13:03Z","updated_at":"2018-09-01T20:44:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"202be31f2eed939d7fd87b5e1657ca83eb74af17","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212/commits","review_comments_url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212/comments","review_comment_url":"https://api.github.com/repos/adamchainz/gargoyle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adamchainz/gargoyle/issues/212/comments","statuses_url":"https://api.github.com/repos/adamchainz/gargoyle/statuses/dcc929181b6b17e8d1c0b86600eab208767903ad","head":{"label":"sssbox:handle_conflicting_conditions","ref":"handle_conflicting_conditions","sha":"dcc929181b6b17e8d1c0b86600eab208767903ad","user":{"login":"sssbox","id":181096,"node_id":"MDQ6VXNlcjE4MTA5Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/181096?v=4","gravatar_id":"","url":"https://api.github.com/users/sssbox","html_url":"https://github.com/sssbox","followers_url":"https://api.github.com/users/sssbox/followers","following_url":"https://api.github.com/users/sssbox/following{/other_user}","gists_url":"https://api.github.com/users/sssbox/gists{/gist_id}","starred_url":"https://api.github.com/users/sssbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sssbox/subscriptions","organizations_url":"https://api.github.com/users/sssbox/orgs","repos_url":"https://api.github.com/users/sssbox/repos","events_url":"https://api.github.com/users/sssbox/events{/privacy}","received_events_url":"https://api.github.com/users/sssbox/received_events","type":"User","site_admin":false},"repo":{"id":146804259,"node_id":"MDEwOlJlcG9zaXRvcnkxNDY4MDQyNTk=","name":"gargoyle","full_name":"sssbox/gargoyle","owner":{"login":"sssbox","id":181096,"node_id":"MDQ6VXNlcjE4MTA5Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/181096?v=4","gravatar_id":"","url":"https://api.github.com/users/sssbox","html_url":"https://github.com/sssbox","followers_url":"https://api.github.com/users/sssbox/followers","following_url":"https://api.github.com/users/sssbox/following{/other_user}","gists_url":"https://api.github.com/users/sssbox/gists{/gist_id}","starred_url":"https://api.github.com/users/sssbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sssbox/subscriptions","organizations_url":"https://api.github.com/users/sssbox/orgs","repos_url":"https://api.github.com/users/sssbox/repos","events_url":"https://api.github.com/users/sssbox/events{/privacy}","received_events_url":"https://api.github.com/users/sssbox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sssbox/gargoyle","description":":radio_button: Feature switches in Django","fork":true,"url":"https://api.github.com/repos/sssbox/gargoyle","forks_url":"https://api.github.com/repos/sssbox/gargoyle/forks","keys_url":"https://api.github.com/repos/sssbox/gargoyle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sssbox/gargoyle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sssbox/gargoyle/teams","hooks_url":"https://api.github.com/repos/sssbox/gargoyle/hooks","issue_events_url":"https://api.github.com/repos/sssbox/gargoyle/issues/events{/number}","events_url":"https://api.github.com/repos/sssbox/gargoyle/events","assignees_url":"https://api.github.com/repos/sssbox/gargoyle/assignees{/user}","branches_url":"https://api.github.com/repos/sssbox/gargoyle/branches{/branch}","tags_url":"https://api.github.com/repos/sssbox/gargoyle/tags","blobs_url":"https://api.github.com/repos/sssbox/gargoyle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sssbox/gargoyle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sssbox/gargoyle/git/refs{/sha}","trees_url":"https://api.github.com/repos/sssbox/gargoyle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sssbox/gargoyle/statuses/{sha}","languages_url":"https://api.github.com/repos/sssbox/gargoyle/languages","stargazers_url":"https://api.github.com/repos/sssbox/gargoyle/stargazers","contributors_url":"https://api.github.com/repos/sssbox/gargoyle/contributors","subscribers_url":"https://api.github.com/repos/sssbox/gargoyle/subscribers","subscription_url":"https://api.github.com/repos/sssbox/gargoyle/subscription","commits_url":"https://api.github.com/repos/sssbox/gargoyle/commits{/sha}","git_commits_url":"https://api.github.com/repos/sssbox/gargoyle/git/commits{/sha}","comments_url":"https://api.github.com/repos/sssbox/gargoyle/comments{/number}","issue_comment_url":"https://api.github.com/repos/sssbox/gargoyle/issues/comments{/number}","contents_url":"https://api.github.com/repos/sssbox/gargoyle/contents/{+path}","compare_url":"https://api.github.com/repos/sssbox/gargoyle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sssbox/gargoyle/merges","archive_url":"https://api.github.com/repos/sssbox/gargoyle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sssbox/gargoyle/downloads","issues_url":"https://api.github.com/repos/sssbox/gargoyle/issues{/number}","pulls_url":"https://api.github.com/repos/sssbox/gargoyle/pulls{/number}","milestones_url":"https://api.github.com/repos/sssbox/gargoyle/milestones{/number}","notifications_url":"https://api.github.com/repos/sssbox/gargoyle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sssbox/gargoyle/labels{/name}","releases_url":"https://api.github.com/repos/sssbox/gargoyle/releases{/id}","deployments_url":"https://api.github.com/repos/sssbox/gargoyle/deployments","created_at":"2018-08-30T20:40:16Z","updated_at":"2018-08-30T20:40:17Z","pushed_at":"2018-08-31T17:45:23Z","git_url":"git://github.com/sssbox/gargoyle.git","ssh_url":"git@github.com:sssbox/gargoyle.git","clone_url":"https://github.com/sssbox/gargoyle.git","svn_url":"https://github.com/sssbox/gargoyle","homepage":"","size":708,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"adamchainz:master","ref":"master","sha":"cff9f3e0f91d42d2c74bcd04986dfb70c619bafa","user":{"login":"adamchainz","id":857609,"node_id":"MDQ6VXNlcjg1NzYwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/857609?v=4","gravatar_id":"","url":"https://api.github.com/users/adamchainz","html_url":"https://github.com/adamchainz","followers_url":"https://api.github.com/users/adamchainz/followers","following_url":"https://api.github.com/users/adamchainz/following{/other_user}","gists_url":"https://api.github.com/users/adamchainz/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchainz/subscriptions","organizations_url":"https://api.github.com/users/adamchainz/orgs","repos_url":"https://api.github.com/users/adamchainz/repos","events_url":"https://api.github.com/users/adamchainz/events{/privacy}","received_events_url":"https://api.github.com/users/adamchainz/received_events","type":"User","site_admin":false},"repo":{"id":42048726,"node_id":"MDEwOlJlcG9zaXRvcnk0MjA0ODcyNg==","name":"gargoyle","full_name":"adamchainz/gargoyle","owner":{"login":"adamchainz","id":857609,"node_id":"MDQ6VXNlcjg1NzYwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/857609?v=4","gravatar_id":"","url":"https://api.github.com/users/adamchainz","html_url":"https://github.com/adamchainz","followers_url":"https://api.github.com/users/adamchainz/followers","following_url":"https://api.github.com/users/adamchainz/following{/other_user}","gists_url":"https://api.github.com/users/adamchainz/gists{/gist_id}","starred_url":"https://api.github.com/users/adamchainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamchainz/subscriptions","organizations_url":"https://api.github.com/users/adamchainz/orgs","repos_url":"https://api.github.com/users/adamchainz/repos","events_url":"https://api.github.com/users/adamchainz/events{/privacy}","received_events_url":"https://api.github.com/users/adamchainz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamchainz/gargoyle","description":":radio_button: Feature switches in Django","fork":true,"url":"https://api.github.com/repos/adamchainz/gargoyle","forks_url":"https://api.github.com/repos/adamchainz/gargoyle/forks","keys_url":"https://api.github.com/repos/adamchainz/gargoyle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamchainz/gargoyle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamchainz/gargoyle/teams","hooks_url":"https://api.github.com/repos/adamchainz/gargoyle/hooks","issue_events_url":"https://api.github.com/repos/adamchainz/gargoyle/issues/events{/number}","events_url":"https://api.github.com/repos/adamchainz/gargoyle/events","assignees_url":"https://api.github.com/repos/adamchainz/gargoyle/assignees{/user}","branches_url":"https://api.github.com/repos/adamchainz/gargoyle/branches{/branch}","tags_url":"https://api.github.com/repos/adamchainz/gargoyle/tags","blobs_url":"https://api.github.com/repos/adamchainz/gargoyle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamchainz/gargoyle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamchainz/gargoyle/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamchainz/gargoyle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamchainz/gargoyle/statuses/{sha}","languages_url":"https://api.github.com/repos/adamchainz/gargoyle/languages","stargazers_url":"https://api.github.com/repos/adamchainz/gargoyle/stargazers","contributors_url":"https://api.github.com/repos/adamchainz/gargoyle/contributors","subscribers_url":"https://api.github.com/repos/adamchainz/gargoyle/subscribers","subscription_url":"https://api.github.com/repos/adamchainz/gargoyle/subscription","commits_url":"https://api.github.com/repos/adamchainz/gargoyle/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamchainz/gargoyle/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamchainz/gargoyle/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamchainz/gargoyle/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamchainz/gargoyle/contents/{+path}","compare_url":"https://api.github.com/repos/adamchainz/gargoyle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamchainz/gargoyle/merges","archive_url":"https://api.github.com/repos/adamchainz/gargoyle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamchainz/gargoyle/downloads","issues_url":"https://api.github.com/repos/adamchainz/gargoyle/issues{/number}","pulls_url":"https://api.github.com/repos/adamchainz/gargoyle/pulls{/number}","milestones_url":"https://api.github.com/repos/adamchainz/gargoyle/milestones{/number}","notifications_url":"https://api.github.com/repos/adamchainz/gargoyle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamchainz/gargoyle/labels{/name}","releases_url":"https://api.github.com/repos/adamchainz/gargoyle/releases{/id}","deployments_url":"https://api.github.com/repos/adamchainz/gargoyle/deployments","created_at":"2015-09-07T11:14:52Z","updated_at":"2018-08-28T07:46:30Z","pushed_at":"2018-08-31T17:45:24Z","git_url":"git://github.com/adamchainz/gargoyle.git","ssh_url":"git@github.com:adamchainz/gargoyle.git","clone_url":"https://github.com/adamchainz/gargoyle.git","svn_url":"https://github.com/adamchainz/gargoyle","homepage":"","size":706,"stargazers_count":102,"watchers_count":102,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":8,"watchers":102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212"},"html":{"href":"https://github.com/adamchainz/gargoyle/pull/212"},"issue":{"href":"https://api.github.com/repos/adamchainz/gargoyle/issues/212"},"comments":{"href":"https://api.github.com/repos/adamchainz/gargoyle/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adamchainz/gargoyle/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/adamchainz/gargoyle/statuses/dcc929181b6b17e8d1c0b86600eab208767903ad"}},"author_association":"NONE"}}
{"actor":{"display_login":"adamchainz"}}