Skip to content

Commit d2de25d

Browse files
committed
Alphabetize attributes for no good reason
1 parent 342772e commit d2de25d

7 files changed

Lines changed: 29 additions & 27 deletions

File tree

slack/web/classes/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def to_dict(self) -> dict:
4646
class ActionButton(Action):
4747
@property
4848
def attributes(self):
49-
return super().attributes.union({"value", "style"})
49+
return super().attributes.union({"style", "value"})
5050

5151
value_max_length = 2000
5252

@@ -117,7 +117,7 @@ def __init__(self, *, text: str, url: str):
117117
class AbstractActionSelector(Action, metaclass=ABCMeta):
118118
DataSourceTypes = DynamicSelectElementTypes.union({"external", "static"})
119119

120-
attributes = {"name", "text", "type", "data_source"}
120+
attributes = {"data_source", "name", "text", "type"}
121121

122122
@property
123123
@abstractmethod

slack/web/classes/attachments.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from .actions import Action
66
from .blocks import Block
77

8-
SeededColors = {"good", "warning", "danger"}
8+
SeededColors = {"danger", "good", "warning"}
99

1010

1111
class AttachmentField(JsonObject):
12-
attributes = {"short", "value", "title"}
12+
attributes = {"short", "title", "value"}
1313

1414
def __init__(
1515
self,
@@ -25,27 +25,27 @@ def __init__(
2525

2626
class Attachment(JsonObject):
2727
attributes = {
28-
"title",
29-
"pretext",
28+
"author_icon",
29+
"author_link",
30+
"author_name",
3031
"color",
31-
"text",
32-
"ts",
3332
"fallback",
33+
"fields",
3434
"footer",
35-
"thumb_url",
3635
"footer_icon",
37-
"author_icon",
38-
"author_name",
39-
"author_link",
40-
"fields",
41-
"title_link",
4236
"image_url",
37+
"pretext",
38+
"text",
39+
"thumb_url",
40+
"title",
41+
"title_link",
42+
"ts",
4343
}
4444

4545
fields: List[AttachmentField]
4646
actions: List[Action]
4747

48-
MarkdownFields = {"pretext", "text", "fields"}
48+
MarkdownFields = {"fields", "pretext", "text"}
4949

5050
footer_max_length = 300
5151

slack/web/classes/blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def to_dict(self) -> dict:
9393
class ImageBlock(Block):
9494
@property
9595
def attributes(self) -> Set[str]:
96-
return super().attributes.union({"image_url", "alt_text"})
96+
return super().attributes.union({"alt_text", "image_url"})
9797

9898
image_url_max_length = 3000
9999
alt_text_max_length = 2000

slack/web/classes/dialog_elements.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
class DialogTextComponent(JsonObject, metaclass=ABCMeta):
1111
attributes = {
12-
"optional",
13-
"name",
1412
"hint",
13+
"label",
1514
"max_length",
16-
"value",
17-
"placeholder",
1815
"min_length",
19-
"label",
16+
"name",
17+
"optional",
18+
"placeholder",
2019
"subtype",
2120
"type",
21+
"value",
2222
}
2323

2424
name_max_length = 300
@@ -137,7 +137,7 @@ class DialogTextArea(DialogTextComponent):
137137
class AbstractDialogSelector(JsonObject, metaclass=ABCMeta):
138138
DataSourceTypes = DynamicSelectElementTypes.union({"external", "static"})
139139

140-
attributes = {"name", "label", "optional", "placeholder", "type", "data_source"}
140+
attributes = {"data_source", "label", "name", "optional", "placeholder", "type"}
141141

142142
name_max_length = 300
143143
label_max_length = 48

slack/web/classes/dialogs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818

1919
class DialogBuilder(JsonObject):
20+
attributes = {} # no attributes because to_dict has unique implementation
21+
2022
_callback_id: Optional[str]
2123
_elements: List[Union[DialogTextComponent, AbstractDialogSelector]]
2224
_submit_label: Optional[str]

slack/web/classes/elements.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def action_id_length(self):
3939
class ImageElement(BlockElement):
4040
@property
4141
def attributes(self) -> Set[str]:
42-
return super().attributes.union({"image_url", "alt_text"})
42+
return super().attributes.union({"alt_text", "image_url"})
4343

4444
image_url_max_length = 3000
4545
alt_text_max_length = 2000
@@ -75,7 +75,7 @@ def alt_text_length(self):
7575
class ButtonElement(InteractiveElement):
7676
@property
7777
def attributes(self) -> Set[str]:
78-
return super().attributes.union({"value", "style"})
78+
return super().attributes.union({"style", "value"})
7979

8080
text_max_length = 75
8181
value_max_length = 75
@@ -181,7 +181,7 @@ def __init__(
181181
def placeholder_length(self):
182182
return len(self.placeholder) <= self.placeholder_max_length
183183

184-
def to_dict(self, ) -> dict:
184+
def to_dict(self,) -> dict:
185185
json = super().to_dict()
186186
json["placeholder"] = PlainTextObject.direct_from_string(self.placeholder)
187187
if self.confirm is not None:

slack/web/classes/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from . import BaseObject, JsonObject, JsonValidator, extract_json
55

6-
ButtonStyles = {"primary", "danger"}
7-
DynamicSelectElementTypes = {"users", "channels", "conversations"}
6+
ButtonStyles = {"danger", "primary"}
7+
DynamicSelectElementTypes = {"channels", "conversations", "users"}
88

99

1010
class Link(BaseObject):

0 commit comments

Comments
 (0)