Skip to content

Commit 7173ef7

Browse files
committed
Add type: ignore for pytype 2021.9.9
1 parent ba2c7e4 commit 7173ef7

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

slack_bolt/oauth/async_oauth_settings.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,24 @@ def __init__(
118118
self.client_id = client_id
119119
self.client_secret = client_secret
120120

121-
self.scopes = scopes or os.environ.get("SLACK_SCOPES", "").split(",")
121+
# NOTE: pytype says that self.scopes can be str, not Sequence[str].
122+
# That's true but we will check the pattern in the following if statement.
123+
# Thus, we ignore the warnings here. This is the same for user_scopes too.
124+
self.scopes = ( # type: ignore
125+
scopes # type: ignore
126+
if scopes is not None
127+
else os.environ.get("SLACK_SCOPES", "").split(",") # type: ignore
128+
) # type: ignore
122129
if isinstance(self.scopes, str):
123130
self.scopes = self.scopes.split(",")
124-
self.user_scopes = user_scopes or os.environ.get("SLACK_USER_SCOPES", "").split(
125-
","
126-
)
131+
self.user_scopes = ( # type: ignore
132+
user_scopes
133+
if user_scopes is not None
134+
else os.environ.get("SLACK_USER_SCOPES", "").split(",") # type: ignore
135+
) # type: ignore
127136
if isinstance(self.user_scopes, str):
128137
self.user_scopes = self.user_scopes.split(",")
138+
129139
self.redirect_uri = redirect_uri or os.environ.get("SLACK_REDIRECT_URI")
130140
# Handler configuration
131141
self.install_path = install_path or os.environ.get(

slack_bolt/oauth/oauth_settings.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,21 @@ def __init__(
112112
self.client_id = client_id
113113
self.client_secret = client_secret
114114

115-
self.scopes = scopes or os.environ.get("SLACK_SCOPES", "").split(",")
115+
# NOTE: pytype says that self.scopes can be str, not Sequence[str].
116+
# That's true but we will check the pattern in the following if statement.
117+
# Thus, we ignore the warnings here. This is the same for user_scopes too.
118+
self.scopes = ( # type: ignore
119+
scopes # type: ignore
120+
if scopes is not None
121+
else os.environ.get("SLACK_SCOPES", "").split(",") # type: ignore
122+
) # type: ignore
116123
if isinstance(self.scopes, str):
117124
self.scopes = self.scopes.split(",")
118-
self.user_scopes = user_scopes or os.environ.get("SLACK_USER_SCOPES", "").split(
119-
","
120-
)
125+
self.user_scopes = ( # type: ignore
126+
user_scopes
127+
if user_scopes is not None
128+
else os.environ.get("SLACK_USER_SCOPES", "").split(",") # type: ignore
129+
) # type: ignore
121130
if isinstance(self.user_scopes, str):
122131
self.user_scopes = self.user_scopes.split(",")
123132
self.redirect_uri = redirect_uri or os.environ.get("SLACK_REDIRECT_URI")

0 commit comments

Comments
 (0)