Skip to content

Commit eedc3d5

Browse files
committed
code quality
1 parent 9c35263 commit eedc3d5

21 files changed

Lines changed: 26 additions & 26 deletions

elementary/messages/formats/block_kit.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional
1+
from typing import Any, Dict, List, Optional, Tuple
22

33
from slack_sdk.models import blocks as slack_blocks
44

@@ -33,8 +33,8 @@ class BlockKitBuilder:
3333
_LONGEST_MARKDOWN_SUFFIX_LEN = 3 # length of markdown's code suffix (```)
3434

3535
def __init__(self) -> None:
36-
self._blocks: list[dict] = []
37-
self._attachment_blocks: list[dict] = []
36+
self._blocks: List[dict] = []
37+
self._attachment_blocks: List[dict] = []
3838
self._is_divided = False
3939

4040
def _format_icon(self, icon: Icon) -> str:
@@ -139,7 +139,7 @@ def _add_secondary_facts(self, facts: List[FactBlock]) -> None:
139139

140140
def _add_fact_list_block(self, block: FactListBlock) -> None:
141141
remaining_facts = block.facts[:]
142-
secondary_facts: list[FactBlock] = []
142+
secondary_facts: List[FactBlock] = []
143143
while remaining_facts:
144144
current_fact = remaining_facts.pop(0)
145145
if current_fact.primary:
@@ -192,10 +192,10 @@ def _add_message_blocks(self, blocks: List[MessageBlock]) -> None:
192192

193193
def _get_final_blocks(
194194
self, color: Optional[Color]
195-
) -> tuple[list[dict], list[dict]]:
195+
) -> Tuple[List[dict], List[dict]]:
196196
"""
197197
Slack does not support coloring regular messages, only attachments.
198-
Also, regular messages are allways displayed in full, while attachments show the first 5 blocks (with a "show more" button).
198+
Also, regular messages are always displayed in full, while attachments show the first 5 blocks (with a "show more" button).
199199
The way we handle this is as follows:
200200
- If we have a divider block, everything up to it and including it is a regular message, and everything after it is an attachment.
201201
- If we don't have a divider block:

tests/unit/messages/formats/block_kit/fixtures/all_blocks_green.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@
6262
"color": "#33b989"
6363
}
6464
]
65-
}
65+
}

tests/unit/messages/formats/block_kit/fixtures/all_blocks_no_color.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@
6161
"blocks": []
6262
}
6363
]
64-
}
64+
}

tests/unit/messages/formats/block_kit/fixtures/all_blocks_red.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@
6262
"color": "#ff0000"
6363
}
6464
]
65-
}
65+
}

tests/unit/messages/formats/block_kit/fixtures/all_blocks_yellow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@
6262
"color": "#ffcc00"
6363
}
6464
]
65-
}
65+
}

tests/unit/messages/formats/block_kit/fixtures/all_icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"blocks": []
1414
}
1515
]
16-
}
16+
}

tests/unit/messages/formats/block_kit/fixtures/bullet_list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
"blocks": []
2121
}
2222
]
23-
}
23+
}

tests/unit/messages/formats/block_kit/fixtures/code_block_200.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"blocks": []
1414
}
1515
]
16-
}
16+
}

tests/unit/messages/formats/block_kit/fixtures/code_block_50.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"blocks": []
1414
}
1515
]
16-
}
16+
}

tests/unit/messages/formats/block_kit/fixtures/code_block_500.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"blocks": []
1414
}
1515
]
16-
}
16+
}

0 commit comments

Comments
 (0)