Skip to content

Commit 3f7ec7a

Browse files
committed
Refactor check_type
Change the `may_be_none=` parameter name to `optional=`.
1 parent 5a2460a commit 3f7ec7a

File tree

16 files changed

+87
-84
lines changed

16 files changed

+87
-84
lines changed

webexteamssdk/api/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
126126
check_type(base_url, basestring)
127127
check_type(single_request_timeout, int)
128128
check_type(wait_on_rate_limit, bool)
129-
check_type(client_id, basestring, may_be_none=True)
130-
check_type(client_secret, basestring, may_be_none=True)
131-
check_type(oauth_code, basestring, may_be_none=True)
132-
check_type(redirect_uri, basestring, may_be_none=True)
133-
check_type(proxies, dict, may_be_none=True)
129+
check_type(client_id, basestring, optional=True)
130+
check_type(client_secret, basestring, optional=True)
131+
check_type(oauth_code, basestring, optional=True)
132+
check_type(redirect_uri, basestring, optional=True)
133+
check_type(proxies, dict, optional=True)
134134

135135
access_token = access_token or WEBEX_TEAMS_ACCESS_TOKEN
136136

webexteamssdk/api/access_tokens.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, base_url, object_factory, single_request_timeout=None):
7979
TypeError: If the parameter types are incorrect.
8080
8181
"""
82-
check_type(base_url, basestring, may_be_none=False)
82+
check_type(base_url, basestring, optional=False)
8383
check_type(single_request_timeout, int)
8484

8585
super(AccessTokensAPI, self).__init__()
@@ -125,10 +125,10 @@ def get(self, client_id, client_secret, code, redirect_uri):
125125
ApiError: If the Webex Teams cloud returns an error.
126126
127127
"""
128-
check_type(client_id, basestring, may_be_none=False)
129-
check_type(client_secret, basestring, may_be_none=False)
130-
check_type(code, basestring, may_be_none=False)
131-
check_type(redirect_uri, basestring, may_be_none=False)
128+
check_type(client_id, basestring, optional=False)
129+
check_type(client_secret, basestring, optional=False)
130+
check_type(code, basestring, optional=False)
131+
check_type(redirect_uri, basestring, optional=False)
132132

133133
post_data = dict_from_items_with_values(
134134
grant_type="authorization_code",
@@ -166,9 +166,9 @@ def refresh(self, client_id, client_secret, refresh_token):
166166
ApiError: If the Webex Teams cloud returns an error.
167167
168168
"""
169-
check_type(client_id, basestring, may_be_none=False)
170-
check_type(client_secret, basestring, may_be_none=False)
171-
check_type(refresh_token, basestring, may_be_none=False)
169+
check_type(client_id, basestring, optional=False)
170+
check_type(client_secret, basestring, optional=False)
171+
check_type(refresh_token, basestring, optional=False)
172172

173173
post_data = dict_from_items_with_values(
174174
grant_type="refresh_token",

webexteamssdk/api/attachment_actions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(self, session, object_factory):
6666
TypeError: If the parameter types are incorrect.
6767
6868
"""
69-
check_type(session, RestSession, may_be_none=False)
69+
check_type(session, RestSession, optional=False)
7070
super(AttachmentActionsAPI, self).__init__()
7171
self._session = session
7272
self._object_factory = object_factory
@@ -96,9 +96,9 @@ def create(self, type=None, messageId=None, inputs=None,
9696
9797
"""
9898

99-
check_type(type, basestring, may_be_none=False)
100-
check_type(messageId, basestring, may_be_none=False)
101-
check_type(inputs, dict, may_be_none=False)
99+
check_type(type, basestring, optional=False)
100+
check_type(messageId, basestring, optional=False)
101+
check_type(inputs, dict, optional=False)
102102

103103
post_data = dict_from_items_with_values(
104104
request_parameters,
@@ -128,7 +128,7 @@ def get(self, attachmentId):
128128
ApiError: If the Webex Teams cloud returns an error.
129129
130130
"""
131-
check_type(attachmentId, basestring, may_be_none=False)
131+
check_type(attachmentId, basestring, optional=False)
132132

133133
# API request
134134
json_data = self._session.get(API_ENDPOINT + '/' + attachmentId)

webexteamssdk/api/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, session, object_factory):
6565
TypeError: If the parameter types are incorrect.
6666
6767
"""
68-
check_type(session, RestSession, may_be_none=False)
68+
check_type(session, RestSession, optional=False)
6969

7070
super(EventsAPI, self).__init__()
7171

@@ -159,7 +159,7 @@ def get(self, eventId):
159159
ApiError: If the Webex Teams cloud returns an error.
160160
161161
"""
162-
check_type(eventId, basestring, may_be_none=False)
162+
check_type(eventId, basestring, optional=False)
163163

164164
# API request
165165
json_data = self._session.get(API_ENDPOINT + '/' + eventId)

webexteamssdk/api/licenses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, session, object_factory):
6565
TypeError: If the input object is not a dictionary or string.
6666
6767
"""
68-
check_type(session, RestSession, may_be_none=False)
68+
check_type(session, RestSession, optional=False)
6969

7070
super(LicensesAPI, self).__init__()
7171

@@ -122,7 +122,7 @@ def get(self, licenseId):
122122
ApiError: If the Webex Teams cloud returns an error.
123123
124124
"""
125-
check_type(licenseId, basestring, may_be_none=False)
125+
check_type(licenseId, basestring, optional=False)
126126

127127
# API request
128128
json_data = self._session.get(API_ENDPOINT + '/' + licenseId)

webexteamssdk/api/memberships.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def create(self, roomId, personId=None, personEmail=None,
159159
ApiError: If the Webex Teams cloud returns an error.
160160
161161
"""
162-
check_type(roomId, basestring, may_be_none=False)
162+
check_type(roomId, basestring, optional=False)
163163
check_type(personId, basestring)
164164
check_type(personEmail, basestring)
165165
check_type(isModerator, bool)
@@ -193,7 +193,7 @@ def get(self, membershipId):
193193
ApiError: If the Webex Teams cloud returns an error.
194194
195195
"""
196-
check_type(membershipId, basestring, may_be_none=False)
196+
check_type(membershipId, basestring, optional=False)
197197

198198
# API request
199199
json_data = self._session.get(API_ENDPOINT + '/' + membershipId)
@@ -219,7 +219,7 @@ def update(self, membershipId, isModerator=None, **request_parameters):
219219
ApiError: If the Webex Teams cloud returns an error.
220220
221221
"""
222-
check_type(membershipId, basestring, may_be_none=False)
222+
check_type(membershipId, basestring, optional=False)
223223
check_type(isModerator, bool)
224224

225225
put_data = dict_from_items_with_values(

webexteamssdk/api/messages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(self, session, object_factory):
6666
TypeError: If the parameter types are incorrect.
6767
6868
"""
69-
check_type(session, RestSession, may_be_none=False)
69+
check_type(session, RestSession, optional=False)
7070
super(MessagesAPI, self).__init__()
7171
self._session = session
7272
self._object_factory = object_factory
@@ -112,7 +112,7 @@ def list(self, roomId, mentionedPeople=None, before=None,
112112
ApiError: If the Webex Teams cloud returns an error.
113113
114114
"""
115-
check_type(roomId, basestring, may_be_none=False)
115+
check_type(roomId, basestring, optional=False)
116116
check_type(mentionedPeople, basestring)
117117
check_type(before, basestring)
118118
check_type(beforeMessage, basestring)
@@ -155,7 +155,7 @@ def create(self, roomId=None, toPersonId=None, toPersonEmail=None,
155155
files(`list`): A list of public URL(s) or local path(s) to files to
156156
be posted into the room. Only one file is allowed per message.
157157
attachments(`list`): A list comprised of properly formatted button
158-
and card data structure. This can be found at
158+
and card data structure. This can be found at
159159
https://docs.microsoft.com/en-us/adaptive-cards/sdk/designer
160160
**request_parameters: Additional request parameters (provides
161161
support for parameters that may be added in the future).
@@ -246,7 +246,7 @@ def get(self, messageId):
246246
ApiError: If the Webex Teams cloud returns an error.
247247
248248
"""
249-
check_type(messageId, basestring, may_be_none=False)
249+
check_type(messageId, basestring, optional=False)
250250

251251
# API request
252252
json_data = self._session.get(API_ENDPOINT + '/' + messageId)
@@ -265,7 +265,7 @@ def delete(self, messageId):
265265
ApiError: If the Webex Teams cloud returns an error.
266266
267267
"""
268-
check_type(messageId, basestring, may_be_none=False)
268+
check_type(messageId, basestring, optional=False)
269269

270270
# API request
271271
self._session.delete(API_ENDPOINT + '/' + messageId)

webexteamssdk/api/organizations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, session, object_factory):
6262
TypeError: If the parameter types are incorrect.
6363
6464
"""
65-
check_type(session, RestSession, may_be_none=False)
65+
check_type(session, RestSession, optional=False)
6666

6767
super(OrganizationsAPI, self).__init__()
6868

@@ -111,7 +111,7 @@ def get(self, orgId):
111111
ApiError: If the Webex Teams cloud returns an error.
112112
113113
"""
114-
check_type(orgId, basestring, may_be_none=False)
114+
check_type(orgId, basestring, optional=False)
115115

116116
# API request
117117
json_data = self._session.get(API_ENDPOINT + '/' + orgId)

webexteamssdk/api/people.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def create(self, emails, displayName=None, firstName=None, lastName=None,
161161
ApiError: If the Webex Teams cloud returns an error.
162162
163163
"""
164-
check_type(emails, list, may_be_none=False)
164+
check_type(emails, list, optional=False)
165165
check_type(displayName, basestring)
166166
check_type(firstName, basestring)
167167
check_type(lastName, basestring)
@@ -202,7 +202,7 @@ def get(self, personId):
202202
ApiError: If the Webex Teams cloud returns an error.
203203
204204
"""
205-
check_type(personId, basestring, may_be_none=False)
205+
check_type(personId, basestring, optional=False)
206206

207207
# API request
208208
json_data = self._session.get(API_ENDPOINT + '/' + personId)
@@ -290,7 +290,7 @@ def delete(self, personId):
290290
ApiError: If the Webex Teams cloud returns an error.
291291
292292
"""
293-
check_type(personId, basestring, may_be_none=False)
293+
check_type(personId, basestring, optional=False)
294294

295295
# API request
296296
self._session.delete(API_ENDPOINT + '/' + personId)

webexteamssdk/api/roles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, session, object_factory):
6565
TypeError: If the parameter types are incorrect.
6666
6767
"""
68-
check_type(session, RestSession, may_be_none=False)
68+
check_type(session, RestSession, optional=False)
6969

7070
super(RolesAPI, self).__init__()
7171

@@ -113,7 +113,7 @@ def get(self, roleId):
113113
ApiError: If the Webex Teams cloud returns an error.
114114
115115
"""
116-
check_type(roleId, basestring, may_be_none=False)
116+
check_type(roleId, basestring, optional=False)
117117

118118
# API request
119119
json_data = self._session.get(API_ENDPOINT + '/' + roleId)

0 commit comments

Comments
 (0)