Skip to content

Commit fb5b7bc

Browse files
committed
Use 125 chars for max line length for both flake8 and black
1 parent bd14d32 commit fb5b7bc

File tree

204 files changed

+1325
-4130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+1325
-4130
lines changed

integration_tests/audit_logs/test_async_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
class TestAuditLogsClient(unittest.TestCase):
1212
def setUp(self):
13-
self.client = AsyncAuditLogsClient(
14-
token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN]
15-
)
13+
self.client = AsyncAuditLogsClient(token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN])
1614

1715
def tearDown(self):
1816
pass

integration_tests/audit_logs/test_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
class TestAuditLogsClient(unittest.TestCase):
1111
def setUp(self):
12-
self.client = AuditLogsClient(
13-
token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN]
14-
)
12+
self.client = AuditLogsClient(token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN])
1513

1614
def tearDown(self):
1715
pass

integration_tests/audit_logs/test_pagination.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
class TestAuditLogsClient(unittest.TestCase):
1212
def setUp(self):
13-
self.client = AuditLogsClient(
14-
token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN]
15-
)
13+
self.client = AuditLogsClient(token=os.environ[SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN])
1614

1715
def tearDown(self):
1816
pass
@@ -22,11 +20,7 @@ def test_pagination(self):
2220
response = None
2321
ids = []
2422
while call_count < 10 and (response is None or response.status_code != 429):
25-
cursor = (
26-
response.body["response_metadata"]["next_cursor"]
27-
if response is not None
28-
else None
29-
)
23+
cursor = response.body["response_metadata"]["next_cursor"] if response is not None else None
3024
response = self.client.logs(action="user_login", limit=1, cursor=cursor)
3125
ids += map(lambda v: v["id"], response.body.get("entries", []))
3226
call_count += 1

integration_tests/env_variable_names.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
# Testing with Grid workspaces
2020
SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN = "SLACK_SDK_TEST_GRID_ORG_ADMIN_USER_TOKEN"
21-
SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN = (
22-
"SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN"
23-
)
21+
SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN = "SLACK_SDK_TEST_GRID_WORKSPACE_ADMIN_USER_TOKEN"
2422
SLACK_SDK_TEST_GRID_WORKSPACE_USER_TOKEN = "SLACK_SDK_TEST_GRID_WORKSPACE_USER_TOKEN"
2523
SLACK_SDK_TEST_GRID_WORKSPACE_BOT_TOKEN = "SLACK_SDK_TEST_GRID_WORKSPACE_BOT_TOKEN"
2624
SLACK_SDK_TEST_GRID_IDP_USERGROUP_ID = "SLACK_SDK_TEST_GRID_IDP_USERGROUP_ID"
@@ -32,17 +30,9 @@
3230

3331
# Webhook
3432
SLACK_SDK_TEST_INCOMING_WEBHOOK_URL = "SLACK_SDK_TEST_INCOMING_WEBHOOK_URL"
35-
SLACK_SDK_TEST_INCOMING_WEBHOOK_CHANNEL_NAME = (
36-
"SLACK_SDK_TEST_INCOMING_WEBHOOK_CHANNEL_NAME"
37-
)
33+
SLACK_SDK_TEST_INCOMING_WEBHOOK_CHANNEL_NAME = "SLACK_SDK_TEST_INCOMING_WEBHOOK_CHANNEL_NAME"
3834

3935
# For Slack Connect shared tests
40-
SLACK_SDK_TEST_CONNECT_INVITE_SENDER_BOT_TOKEN = (
41-
"SLACK_SDK_TEST_CONNECT_INVITE_SENDER_BOT_TOKEN"
42-
)
43-
SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_TOKEN = (
44-
"SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_TOKEN"
45-
)
46-
SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_USER_ID = (
47-
"SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_USER_ID"
48-
)
36+
SLACK_SDK_TEST_CONNECT_INVITE_SENDER_BOT_TOKEN = "SLACK_SDK_TEST_CONNECT_INVITE_SENDER_BOT_TOKEN"
37+
SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_TOKEN = "SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_TOKEN"
38+
SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_USER_ID = "SLACK_SDK_TEST_CONNECT_INVITE_RECEIVER_BOT_USER_ID"

integration_tests/rtm/test_issue_530.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ def tearDown(self):
2222

2323
def test_issue_530(self):
2424
try:
25-
rtm_client = RTMClient(
26-
token="I am not a token", run_async=False, loop=asyncio.new_event_loop()
27-
)
25+
rtm_client = RTMClient(token="I am not a token", run_async=False, loop=asyncio.new_event_loop())
2826
rtm_client.start()
2927
self.fail("Raising an error here was expected")
3028
except Exception as e:
3129
self.assertEqual(
32-
"The request to the Slack API failed.\n"
33-
"The server responded with: {'ok': False, 'error': 'invalid_auth'}",
30+
"The request to the Slack API failed.\n" "The server responded with: {'ok': False, 'error': 'invalid_auth'}",
3431
str(e),
3532
)
3633
finally:
@@ -45,8 +42,7 @@ async def test_issue_530_async(self):
4542
self.fail("Raising an error here was expected")
4643
except Exception as e:
4744
self.assertEqual(
48-
"The request to the Slack API failed.\n"
49-
"The server responded with: {'ok': False, 'error': 'invalid_auth'}",
45+
"The request to the Slack API failed.\n" "The server responded with: {'ok': False, 'error': 'invalid_auth'}",
5046
str(e),
5147
)
5248
finally:

integration_tests/rtm/test_issue_558.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ async def process_reactions(**payload):
6161
await asyncio.sleep(3)
6262

6363
try:
64-
first_reaction = await web_client.reactions_add(
65-
channel=channel_id, timestamp=ts, name="eyes"
66-
)
64+
first_reaction = await web_client.reactions_add(channel=channel_id, timestamp=ts, name="eyes")
6765
self.assertFalse("error" in first_reaction)
6866
await asyncio.sleep(2)
6967

@@ -72,9 +70,7 @@ async def process_reactions(**payload):
7270
# used to start blocking here
7371

7472
# This reaction_add event won't be handled due to a bug
75-
second_reaction = await web_client.reactions_add(
76-
channel=channel_id, timestamp=ts, name="tada"
77-
)
73+
second_reaction = await web_client.reactions_add(channel=channel_id, timestamp=ts, name="tada")
7874
self.assertFalse("error" in second_reaction)
7975
await asyncio.sleep(2)
8076

integration_tests/rtm/test_issue_569.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def run_cpu_monitor(self):
4343
if current_cpu_usage > TestRTMClient.cpu_usage:
4444
TestRTMClient.cpu_usage = current_cpu_usage
4545

46-
TestRTMClient.cpu_monitor = threading.Thread(
47-
target=run_cpu_monitor, args=[self]
48-
)
46+
TestRTMClient.cpu_monitor = threading.Thread(target=run_cpu_monitor, args=[self])
4947
TestRTMClient.cpu_monitor.daemon = True
5048
TestRTMClient.cpu_monitor.start()
5149

@@ -59,13 +57,9 @@ def tearDown(self):
5957
if hasattr(self, "rtm_client") and not self.rtm_client._stopped:
6058
self.rtm_client.stop()
6159

62-
@pytest.mark.skipif(
63-
condition=is_not_specified(), reason="To avoid rate_limited errors"
64-
)
60+
@pytest.mark.skipif(condition=is_not_specified(), reason="To avoid rate_limited errors")
6561
def test_cpu_usage(self):
66-
self.rtm_client = RTMClient(
67-
token=self.bot_token, run_async=False, loop=asyncio.new_event_loop()
68-
)
62+
self.rtm_client = RTMClient(token=self.bot_token, run_async=False, loop=asyncio.new_event_loop())
6963
self.web_client = WebClient(token=self.bot_token)
7064

7165
self.call_count = 0
@@ -97,9 +91,7 @@ def connect():
9791
time.sleep(5)
9892

9993
text = "This message was sent by <https://slack.dev/python-slackclient/|python-slackclient>! (test_cpu_usage)"
100-
new_message = self.web_client.chat_postMessage(
101-
channel=self.channel_id, text=text
102-
)
94+
new_message = self.web_client.chat_postMessage(channel=self.channel_id, text=text)
10395
self.assertFalse("error" in new_message)
10496

10597
time.sleep(5)
@@ -140,9 +132,7 @@ async def send_reply_async(**payload):
140132
await asyncio.sleep(5)
141133

142134
text = "This message was sent by <https://slack.dev/python-slackclient/|python-slackclient>! (test_cpu_usage_async)"
143-
new_message = await self.web_client.chat_postMessage(
144-
channel=self.channel_id, text=text
145-
)
135+
new_message = await self.web_client.chat_postMessage(channel=self.channel_id, text=text)
146136
self.assertFalse("error" in new_message)
147137

148138
await asyncio.sleep(5)

integration_tests/rtm/test_issue_605.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def tearDown(self):
3232
# Reset the decorators by @RTMClient.run_on
3333
RTMClient._callbacks = collections.defaultdict(list)
3434

35-
@pytest.mark.skipif(
36-
condition=is_not_specified(), reason="To avoid rate_limited errors"
37-
)
35+
@pytest.mark.skipif(condition=is_not_specified(), reason="To avoid rate_limited errors")
3836
def test_issue_605(self):
3937
self.text = "This message was sent to verify issue #605"
4038
self.called = False
@@ -60,9 +58,7 @@ def connect():
6058
token=self.bot_token,
6159
run_async=False,
6260
)
63-
new_message = self.web_client.chat_postMessage(
64-
channel=self.channel_id, text=self.text
65-
)
61+
new_message = self.web_client.chat_postMessage(channel=self.channel_id, text=self.text)
6662
self.assertFalse("error" in new_message)
6763

6864
time.sleep(5)

integration_tests/rtm/test_issue_611.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def tearDown(self):
2929
# Reset the decorators by @RTMClient.run_on
3030
RTMClient._callbacks = collections.defaultdict(list)
3131

32-
@pytest.mark.skipif(
33-
condition=is_not_specified(), reason="To avoid rate limited errors"
34-
)
32+
@pytest.mark.skipif(condition=is_not_specified(), reason="To avoid rate limited errors")
3533
@async_test
3634
async def test_issue_611(self):
3735
channel_id = os.environ[SLACK_SDK_TEST_RTM_TEST_CHANNEL_ID]
@@ -41,16 +39,11 @@ async def test_issue_611(self):
4139

4240
async def process_messages(**payload):
4341
self.logger.info(payload)
44-
if (
45-
"subtype" in payload["data"]
46-
and payload["data"]["subtype"] == "message_replied"
47-
):
42+
if "subtype" in payload["data"] and payload["data"]["subtype"] == "message_replied":
4843
return # skip
4944

5045
self.message_count += 1
51-
raise Exception(
52-
"something is wrong!"
53-
) # This causes the termination of the process
46+
raise Exception("something is wrong!") # This causes the termination of the process
5447

5548
async def process_reactions(**payload):
5649
self.logger.info(payload)
@@ -72,21 +65,15 @@ async def process_reactions(**payload):
7265
try:
7366
await asyncio.sleep(3)
7467

75-
first_reaction = await web_client.reactions_add(
76-
channel=channel_id, timestamp=ts, name="eyes"
77-
)
68+
first_reaction = await web_client.reactions_add(channel=channel_id, timestamp=ts, name="eyes")
7869
self.assertFalse("error" in first_reaction)
7970
await asyncio.sleep(2)
8071

81-
should_be_ignored = await web_client.chat_postMessage(
82-
channel=channel_id, text="Hello?", thread_ts=ts
83-
)
72+
should_be_ignored = await web_client.chat_postMessage(channel=channel_id, text="Hello?", thread_ts=ts)
8473
self.assertFalse("error" in should_be_ignored)
8574
await asyncio.sleep(2)
8675

87-
second_reaction = await web_client.reactions_add(
88-
channel=channel_id, timestamp=ts, name="tada"
89-
)
76+
second_reaction = await web_client.reactions_add(channel=channel_id, timestamp=ts, name="tada")
9077
self.assertFalse("error" in second_reaction)
9178
await asyncio.sleep(2)
9279

integration_tests/rtm/test_issue_631.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def tearDown(self):
3737
if hasattr(self, "rtm_client") and not self.rtm_client._stopped:
3838
self.rtm_client.stop()
3939

40-
@pytest.mark.skipif(
41-
condition=is_not_specified(), reason="to avoid rate_limited errors"
42-
)
40+
@pytest.mark.skipif(condition=is_not_specified(), reason="to avoid rate_limited errors")
4341
def test_issue_631_sharing_event_loop(self):
4442
self.success = None
4543
self.text = "This message was sent to verify issue #631"
@@ -85,9 +83,7 @@ def send_reply(**payload):
8583
if "text" in data and self.text in data["text"]:
8684
channel_id = data["channel"]
8785
thread_ts = data["ts"]
88-
self.success = web_client.chat_postMessage(
89-
channel=channel_id, text="Thanks!", thread_ts=thread_ts
90-
)
86+
self.success = web_client.chat_postMessage(channel=channel_id, text="Thanks!", thread_ts=thread_ts)
9187
except Exception as e:
9288
self.logger.error(traceback.format_exc())
9389
raise e
@@ -108,9 +104,7 @@ def connect():
108104
token=self.bot_token,
109105
run_async=False,
110106
)
111-
new_message = self.web_client.chat_postMessage(
112-
channel=self.channel_id, text=self.text
113-
)
107+
new_message = self.web_client.chat_postMessage(channel=self.channel_id, text=self.text)
114108
self.assertFalse("error" in new_message)
115109

116110
time.sleep(5)
@@ -119,9 +113,7 @@ def connect():
119113
t.join(0.3)
120114

121115
# Solution (2) for #631
122-
@pytest.mark.skipif(
123-
condition=is_not_specified(), reason="this is just for reference"
124-
)
116+
@pytest.mark.skipif(condition=is_not_specified(), reason="this is just for reference")
125117
@async_test
126118
async def test_issue_631_sharing_event_loop_async(self):
127119
self.success = None
@@ -141,9 +133,7 @@ async def send_reply(**payload):
141133
if "text" in data and self.text in data["text"]:
142134
channel_id = data["channel"]
143135
thread_ts = data["ts"]
144-
self.success = await web_client.chat_postMessage(
145-
channel=channel_id, text="Thanks!", thread_ts=thread_ts
146-
)
136+
self.success = await web_client.chat_postMessage(channel=channel_id, text="Thanks!", thread_ts=thread_ts)
147137
except Exception as e:
148138
self.logger.error(traceback.format_exc())
149139
raise e
@@ -158,9 +148,7 @@ async def send_reply(**payload):
158148
token=self.bot_token,
159149
run_async=True, # all need to be async here
160150
)
161-
new_message = await self.web_client.chat_postMessage(
162-
channel=self.channel_id, text=self.text
163-
)
151+
new_message = await self.web_client.chat_postMessage(channel=self.channel_id, text=self.text)
164152
self.assertFalse("error" in new_message)
165153

166154
await asyncio.sleep(5)

0 commit comments

Comments
 (0)