Skip to content

Commit 62668a7

Browse files
committed
make ConversationFilter.include() accept variadic arguments for better API consistency
1 parent 81b4c19 commit 62668a7

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

blockkit/core.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def __init__(
920920
exclude_external_shared_channels: bool | None = None,
921921
):
922922
super().__init__()
923-
self.include(include)
923+
self.include(*include or ())
924924
self.exclude_bot_users(exclude_bot_users)
925925
self.exclude_external_shared_channels(exclude_external_shared_channels)
926926
self._add_validator(
@@ -929,12 +929,10 @@ def __init__(
929929
)
930930
)
931931

932-
def include(
933-
self, include: list[Literal["im", "mpim", "private", "public"]] | None
934-
) -> Self:
932+
def include(self, *include: Literal["im", "mpim", "private", "public"]) -> Self:
935933
return self._add_field(
936934
"include",
937-
include,
935+
list(include),
938936
validators=[
939937
Typed(str),
940938
Strings(self.IM, self.MPIM, self.PRIVATE, self.PUBLIC),

tests/test_core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from blockkit.core import ColumnSettings
2-
from blockkit.core import RawText
31
from datetime import date, datetime, time
42
from zoneinfo import ZoneInfo
53

@@ -10,6 +8,7 @@
108
Button,
119
ChannelsSelect,
1210
Checkboxes,
11+
ColumnSettings,
1312
ComponentValidationError,
1413
Confirm,
1514
Context,
@@ -29,7 +28,6 @@
2928
Image,
3029
ImageEl,
3130
Input,
32-
Table,
3331
InputParameter,
3432
Markdown,
3533
Message,
@@ -45,6 +43,7 @@
4543
Overflow,
4644
PlainTextInput,
4745
RadioButtons,
46+
RawText,
4847
RichBroadcastEl,
4948
RichChannelEl,
5049
RichColorEl,
@@ -64,6 +63,7 @@
6463
Section,
6564
SlackFile,
6665
StaticSelect,
66+
Table,
6767
Text,
6868
TimePicker,
6969
Trigger,
@@ -386,7 +386,7 @@ def test_builds(self):
386386

387387
got = (
388388
ConversationFilter()
389-
.include(["public", "mpim"])
389+
.include("public", "mpim")
390390
.exclude_bot_users()
391391
.exclude_external_shared_channels()
392392
.build()

0 commit comments

Comments
 (0)