Skip to content

Commit

Permalink
Upgrade black version to the latest
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Nov 21, 2023
1 parent 750d97c commit 0aee5ae
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 72 deletions.
1 change: 0 additions & 1 deletion integration_tests/samples/socket_mode/aiohttp_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


async def main():

client = SocketModeClient(
app_token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_APP_TOKEN"),
web_client=AsyncWebClient(token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_BOT_TOKEN")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def hello_command(ack, body):


if __name__ == "__main__":

from bolt_adapter.builtin import SocketModeHandler

app_token = os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_APP_TOKEN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async def hello_command(ack, body):


if __name__ == "__main__":

import asyncio
from asyncio import Future

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def hello_command(ack, body):


if __name__ == "__main__":

from bolt_adapter.websocket_client import SocketModeHandler

app_token = os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_APP_TOKEN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


async def main():

client = SocketModeClient(
app_token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_APP_TOKEN"),
web_client=AsyncWebClient(token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_BOT_TOKEN")),
Expand Down
2 changes: 0 additions & 2 deletions integration_tests/web/test_admin_conversations_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def test_sync(self):

@async_test
async def test_async_move(self):

client = self.async_client

conv_creation = await client.admin_conversations_create(
Expand All @@ -98,7 +97,6 @@ async def test_async_move(self):

@async_test
async def test_async(self):

client = self.async_client

conv_creation = await client.admin_conversations_create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def setUp(self):
if self.channel_id is None:
millis = int(round(time.time() * 1000))
channel_name = f"private-test-channel-{millis}"
self.channel_id = client.conversations_create(name=channel_name, is_private=True,)[
self.channel_id = client.conversations_create(
name=channel_name,
is_private=True,
)[
"channel"
]["id"]

Expand Down
76 changes: 18 additions & 58 deletions integration_tests/web/test_app_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def tearDown(self):
pass

def test_operations(self):
token = os.environ["SLACK_SDK_TEST_TOOLING_TOKEN"] # xoxe.xoxp-...
token = os.environ["SLACK_SDK_TEST_TOOLING_TOKEN"] # xoxe.xoxp-...
client = WebClient(token)
client.apps_manifest_validate(manifest=STR_MANIFEST)
client.apps_manifest_validate(manifest=DICT_MANIFEST)
Expand Down Expand Up @@ -115,86 +115,46 @@ def test_operations(self):
"""

DICT_MANIFEST = {
"display_information": {
"name": "manifest-sandbox"
},
"display_information": {"name": "manifest-sandbox"},
"features": {
"app_home": {
"home_tab_enabled": True,
"messages_tab_enabled": False,
"messages_tab_read_only_enabled": False
},
"bot_user": {
"display_name": "manifest-sandbox",
"always_online": True
},
"app_home": {"home_tab_enabled": True, "messages_tab_enabled": False, "messages_tab_read_only_enabled": False},
"bot_user": {"display_name": "manifest-sandbox", "always_online": True},
"shortcuts": [
{
"name": "message one",
"type": "message",
"callback_id": "m",
"description": "message"
},
{
"name": "global one",
"type": "global",
"callback_id": "g",
"description": "global"
}
{"name": "message one", "type": "message", "callback_id": "m", "description": "message"},
{"name": "global one", "type": "global", "callback_id": "g", "description": "global"},
],
"slash_commands": [
{
"command": "/hey",
"url": "https://www.example.com/",
"description": "What's up?",
"usage_hint": "What's up?",
"should_escape": True
"should_escape": True,
}
],
"unfurl_domains": [
"example.com"
]
"unfurl_domains": ["example.com"],
},
"oauth_config": {
"redirect_urls": [
"https://www.example.com/foo"
],
"redirect_urls": ["https://www.example.com/foo"],
"scopes": {
"user": [
"search:read",
"channels:read",
"groups:read",
"mpim:read"
],
"bot": [
"commands",
"incoming-webhook",
"app_mentions:read",
"links:read"
]
}
"user": ["search:read", "channels:read", "groups:read", "mpim:read"],
"bot": ["commands", "incoming-webhook", "app_mentions:read", "links:read"],
},
},
"settings": {
"allowed_ip_address_ranges": [
"123.123.123.123/32"
],
"allowed_ip_address_ranges": ["123.123.123.123/32"],
"event_subscriptions": {
"request_url": "https://www.example.com/slack/events",
"user_events": [
"member_joined_channel"
],
"bot_events": [
"app_mention",
"link_shared"
]
"user_events": ["member_joined_channel"],
"bot_events": ["app_mention", "link_shared"],
},
"interactivity": {
"is_enabled": True,
"request_url": "https://www.example.com/",
"message_menu_options_url": "https://www.example.com/"
"message_menu_options_url": "https://www.example.com/",
},
"org_deploy_enabled": True,
"socket_mode_enabled": False,
"token_rotation_enabled": True
}
"token_rotation_enabled": True,
},
}
7 changes: 6 additions & 1 deletion integration_tests/web/test_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def tearDown(self):

def test_sync(self):
client = self.sync_client
user_id = list(filter(lambda u: not u["deleted"] and "bot_id" not in u, client.users_list(limit=50)["members"],))[
user_id = list(
filter(
lambda u: not u["deleted"] and "bot_id" not in u,
client.users_list(limit=50)["members"],
)
)[
0
]["id"]

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@
"Jinja2==3.0.3", # https://github.com/pallets/flask/issues/4494
"pytest-cov>=2,<3",
"flake8>=5,<6",
"black==22.8.0",
"black==23.11.0",
"click==8.0.4", # black is affected by https://github.com/pallets/click/issues/2225
"psutil>=5,<6",
# used only under slack_sdk/*_store
"boto3<=2",
# TODO: Upgrade to v2
"moto>=3,<4", # For AWS tests
]
codegen_dependencies = [
"black==22.10.0",
"black==23.11.0",
]

needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
Expand Down
1 change: 1 addition & 0 deletions slack_sdk/models/blocks/block_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def _get_sub_block_elements(cls: Type["BlockElement"]) -> Iterator[Type["BlockEl
# Interactive Block Elements
# -------------------------------------------------


# This is a base class
class InteractiveElement(BlockElement):
action_id_max_length = 255
Expand Down
2 changes: 0 additions & 2 deletions slack_sdk/socket_mode/builtin/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def _establish_new_socket_connection(
trace_enabled: bool,
ssl_context: Optional[ssl.SSLContext] = None,
) -> Union[ssl.SSLSocket, Socket]:

ssl_context = _use_or_create_ssl_context(ssl_context)

if proxy is not None:
Expand Down Expand Up @@ -240,7 +239,6 @@ def _fetch_messages(
current_header: Optional[FrameHeader] = None,
current_data: Optional[bytes] = None,
) -> List[Tuple[Optional[FrameHeader], bytes]]:

if remaining_bytes is None:
# Fetch more to complete the current message
remaining_bytes = receive() # type: ignore
Expand Down

0 comments on commit 0aee5ae

Please sign in to comment.