summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-07-30 19:02:28 +0100
committerBrendan Abolivier <babolivier@matrix.org>2020-07-30 19:02:28 +0100
commit60328ce9fbe90299253ba740f2648c42b9091920 (patch)
treeb3d332ba0bca212953a5abebc22b00094c8535e1
parentMerge branch 'develop' of github.com:matrix-org/synapse into babolivier/new_p... (diff)
downloadsynapse-60328ce9fbe90299253ba740f2648c42b9091920.tar.xz
Lint
-rw-r--r--synapse/push/baserules.py51
1 files changed, 32 insertions, 19 deletions
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py
index e06b1a01e6..172fd00f19 100644
--- a/synapse/push/baserules.py
+++ b/synapse/push/baserules.py
@@ -96,9 +96,17 @@ def make_base_append_rules(kind, modified_base_rules, use_new_defaults=False):
     rules = []
 
     if kind == "override":
-        rules = NEW_APPEND_OVERRIDE_RULES if use_new_defaults else BASE_APPEND_OVERRIDE_RULES
+        rules = (
+            NEW_APPEND_OVERRIDE_RULES
+            if use_new_defaults
+            else BASE_APPEND_OVERRIDE_RULES
+        )
     elif kind == "underride":
-        rules = NEW_APPEND_UNDERRIDE_RULES if use_new_defaults else BASE_APPEND_UNDERRIDE_RULES
+        rules = (
+            NEW_APPEND_UNDERRIDE_RULES
+            if use_new_defaults
+            else BASE_APPEND_UNDERRIDE_RULES
+        )
     elif kind == "content":
         rules = BASE_APPEND_CONTENT_RULES
 
@@ -117,7 +125,11 @@ def make_base_prepend_rules(kind, modified_base_rules, use_new_defaults=False):
     rules = []
 
     if kind == "override":
-        rules = NEW_PREPEND_OVERRIDE_RULES if use_new_defaults else BASE_PREPEND_OVERRIDE_RULES
+        rules = (
+            NEW_PREPEND_OVERRIDE_RULES
+            if use_new_defaults
+            else BASE_PREPEND_OVERRIDE_RULES
+        )
 
     # Copy the rules before modifying them
     rules = copy.deepcopy(rules)
@@ -315,7 +327,7 @@ NEW_APPEND_OVERRIDE_RULES = [
                 "key": "content.msgtype",
                 "pattern": "m.notice",
                 "_id": "_suppress_notices",
-            }
+            },
         ],
         "actions": [],
     },
@@ -348,10 +360,7 @@ NEW_APPEND_OVERRIDE_RULES = [
             },
             {"kind": "event_match", "key": "state_key", "pattern_type": "user_id"},
         ],
-        "actions": [
-            "notify",
-            {"set_tweak": "sound", "value": "default"},
-        ],
+        "actions": ["notify", {"set_tweak": "sound", "value": "default"}],
     },
     {
         "rule_id": "global/override/.m.rule.contains_display_name",
@@ -415,11 +424,8 @@ NEW_APPEND_OVERRIDE_RULES = [
                 "_id": "_call",
             }
         ],
-        "actions": [
-            "notify",
-            {"set_tweak": "sound", "value": "ring"},
-        ],
-    }
+        "actions": ["notify", {"set_tweak": "sound", "value": "ring"}],
+    },
 ]
 
 
@@ -512,17 +518,24 @@ NEW_APPEND_UNDERRIDE_RULES = [
         "rule_id": "global/underride/.m.rule.room_one_to_one",
         "conditions": [
             {"kind": "room_member_count", "is": "2", "_id": "member_count"},
-            {"kind": "event_match", "key": "content.body", "pattern": "*", "_id": "body"},
-        ],
-        "actions": [
-            "notify",
-            {"set_tweak": "sound", "value": "default"},
+            {
+                "kind": "event_match",
+                "key": "content.body",
+                "pattern": "*",
+                "_id": "body",
+            },
         ],
+        "actions": ["notify", {"set_tweak": "sound", "value": "default"}],
     },
     {
         "rule_id": "global/underride/.m.rule.message",
         "conditions": [
-            {"kind": "event_match", "key": "content.body", "pattern": "*", "_id": "body"},
+            {
+                "kind": "event_match",
+                "key": "content.body",
+                "pattern": "*",
+                "_id": "body",
+            },
         ],
         "actions": ["notify"],
         "enabled": False,