Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions slack_sdk/models/blocks/block_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,6 @@ def attributes(self) -> Set[str]: # type: ignore[override]
{
"url",
"text",
"icon_url",
}
)

Expand All @@ -1677,7 +1676,6 @@ def __init__(
*,
url: str,
text: str,
icon_url: Optional[str] = None,
**others: Dict,
):
"""
Expand All @@ -1687,13 +1685,11 @@ def __init__(
Args:
url (required): The URL type source.
text (required): Display text for the URL.
icon_url: Optional icon URL to display with the source.
"""
super().__init__(type=self.type)
show_unknown_key_warning(self, others)
self.url = url
self.text = text
self.icon_url = icon_url


# -------------------------------------------------
Expand Down
5 changes: 0 additions & 5 deletions slack_sdk/models/blocks/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,6 @@ class PlanBlock(Block):
def attributes(self) -> Set[str]: # type: ignore[override]
return super().attributes.union(
{
"plan_id",
"title",
"tasks",
}
Expand All @@ -858,7 +857,6 @@ def attributes(self) -> Set[str]: # type: ignore[override]
def __init__(
self,
*,
plan_id: str,
title: str,
tasks: Optional[Sequence[Union[Dict, TaskCardBlock]]] = None,
block_id: Optional[str] = None,
Expand All @@ -872,14 +870,11 @@ def __init__(
Maximum length for this field is 255 characters.
block_id should be unique for each message and each iteration of a message.
If a message is updated, use a new block_id.
plan_id (required): ID for the plan (May be removed / made optional, feel free to pass in a random UUID
for now)
title (required): Title of the plan in plain text
tasks: Details of the task in the form of a single "rich_text" entity.
"""
super().__init__(type=self.type, block_id=block_id)
show_unknown_key_warning(self, others)

self.plan_id = plan_id
self.title = title
self.tasks = tasks
10 changes: 5 additions & 5 deletions slack_sdk/web/async_chat_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ async def stop(

async def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, **kwargs) -> AsyncSlackResponse:
"""Flush the internal buffer with chunks by making appropriate API calls."""
flushings: List[Union[Dict, Chunk]] = []
chunks_to_flush: List[Union[Dict, Chunk]] = []
if len(self._buffer) != 0:
flushings.append(MarkdownTextChunk(text=self._buffer))
chunks_to_flush.append(MarkdownTextChunk(text=self._buffer))
if chunks is not None:
flushings.extend(chunks)
chunks_to_flush.extend(chunks)
if not self._stream_ts:
response = await self._client.chat_startStream(
**self._stream_args,
token=self._token,
**kwargs,
chunks=flushings,
chunks=chunks_to_flush,
)
self._stream_ts = response.get("ts")
self._state = "in_progress"
Expand All @@ -226,7 +226,7 @@ async def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = N
channel=self._stream_args["channel"],
ts=self._stream_ts,
**kwargs,
chunks=flushings,
chunks=chunks_to_flush,
)
self._buffer = ""
return response
10 changes: 5 additions & 5 deletions slack_sdk/web/chat_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,17 @@ def stop(

def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, **kwargs) -> SlackResponse:
"""Flush the internal buffer with chunks by making appropriate API calls."""
flushings: List[Union[Dict, Chunk]] = []
chunks_to_flush: List[Union[Dict, Chunk]] = []
if len(self._buffer) != 0:
flushings.append(MarkdownTextChunk(text=self._buffer))
chunks_to_flush.append(MarkdownTextChunk(text=self._buffer))
if chunks is not None:
flushings.extend(chunks)
chunks_to_flush.extend(chunks)
if not self._stream_ts:
response = self._client.chat_startStream(
**self._stream_args,
token=self._token,
**kwargs,
chunks=flushings,
chunks=chunks_to_flush,
)
self._stream_ts = response.get("ts")
self._state = "in_progress"
Expand All @@ -216,7 +216,7 @@ def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, *
channel=self._stream_args["channel"],
ts=self._stream_ts,
**kwargs,
chunks=flushings,
chunks=chunks_to_flush,
)
self._buffer = ""
return response
1 change: 0 additions & 1 deletion tests/slack_sdk/models/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,6 @@ class PlanBlockTests(unittest.TestCase):
def test_document(self):
input = {
"type": "plan",
"plan_id": "plan_1",
"title": "Thinking completed",
"tasks": [
{
Expand Down
2 changes: 0 additions & 2 deletions tests/slack_sdk/models/test_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def test_json(self):
UrlSourceElement(
text="The Free Encyclopedia",
url="https://wikipedia.org",
icon_url="https://example.com/globe.png",
),
],
).to_dict(),
Expand All @@ -86,7 +85,6 @@ def test_json(self):
"type": "url",
"text": "The Free Encyclopedia",
"url": "https://wikipedia.org",
"icon_url": "https://example.com/globe.png",
},
],
},
Expand Down