8000 make prettier run · twilio/twilio-python@3670f03 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3670f03

Browse files
committed
make prettier run
1 parent 824ed9f commit 3670f03

File tree

13 files changed

+938
-993
lines changed

13 files changed

+938
-993
lines changed

twilio/auth_strategy/token_auth_strategy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ def requires_authentication(self) -> bool:
2727
def fetch_token(self):
2828
if self.token is None or self.token == "" or self.is_token_expired(self.token):
2929
with self.lock:
30-
if self.token is None or self.token == "" or self.is_token_expired(self.token):
30+
if (
31+
self.token is None
32+
or self.token == ""
33+
or self.is_token_expired(self.token)
34+
):
3135
self.logger.info("New token fetched for accessing organization API")
3236
self.token = self.token_manager.fetch_access_token()
3337

twilio/base/client_base.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from urllib.parse import urlparse, urlunparse
55

66
from twilio import __version__
7-
from twilio.base.exceptions import TwilioException
87
from twilio.http import HttpClient
98
from twilio.http.http_client import TwilioHttpClient
109
from twilio.http.response import Response
@@ -99,7 +98,7 @@ def request(
9998
else:
10099
auth = None
101100

102-
if method == 'DELETE':
101+
if method == "DELETE":
103102
del headers["Accept"]
104103

105104
uri = self.get_hostname(uri)
@@ -148,7 +147,7 @@ async def request_async(
148147
)
149148

150149
headers = self.get_headers(method, headers)
151-
if method == 'DELETE':
150+
if method == "DELETE":
152151
del headers["Accept"]
153152

154153
if self.credential_provider:
@@ -174,9 +173,15 @@ async def request_async(
174173

175174
def copy_non_none_values(self, data):
176175
if isinstance(data, dict):
177-
return {k: self.copy_non_none_values(v) for k, v in data.items() if v is not None}
176+
return {
177+
k: self.copy_non_none_values(v)
178+
for k, v in data.items()
179+
if v is not None
180+
}
178181
elif isinstance(data, list):
179-
return [self.copy_non_none_values(item) for item in data if item is not None]
182+
return [
183+
self.copy_non_none_values(item) for item in data if item is not None
184+
]
180185
return data
181186

182187
def get_auth(self, auth: Optional[Tuple[str, str]]) -> Tuple[str, str]:

twilio/rest/preview/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
class Preview(PreviewBase):
1717

18-
1918
@property
2019
def authorization_documents(self) -> AuthorizationDocumentList:
2120
warn(

twilio/rest/preview_iam/PreviewIamBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from twilio.rest.preview_iam.v1 import V1
1717
from twilio.rest.preview_iam.versionless import Versionless
1818

19+
1920
class PreviewIamBase(Domain):
2021
def __init__(self, twilio: Client):
2122
"""
@@ -27,7 +28,6 @@ def __init__(self, twilio: Client):
2728
self._versionless: Optional[Versionless] = None
2829
self._v1: Optional[V1] = None
2930

30-
3131
@property
3232
def versionless(self) -> Versionless:
3333
"""

twilio/rest/preview_iam/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
from warnings import warn
21
from twilio.rest.preview_iam.PreviewIamBase import PreviewIamBase
32

4-
from twilio.rest.preview_iam.versionless.organization.account import (
5-
AccountList,
6-
)
7-
from twilio.rest.preview_iam.versionless.organization.role_assignment import (
8-
RoleAssignmentList,
9-
)
103
from twilio.rest.preview_iam.v1.authorize import (
114
AuthorizeList,
125
)
@@ -17,12 +10,12 @@
1710
OrganizationList,
1811
)
1912

13+
2014
class PreviewIam(PreviewIamBase):
2115
@property
2216
def organization(self) -> OrganizationList:
2317
return self.versionless.organization
2418

25-
2619
@property
2720
def authorize(self) -> AuthorizeList:
2821
return self.v1.authorize

twilio/rest/preview_iam/v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, domain: Domain):
3030
super().__init__(domain, "v1")
3131
self._authorize: Optional[AuthorizeList] = None
3232
self._token: Optional[TokenList] = None
33-
33+
3434
@property
3535
def authorize(self) -> AuthorizeList:
3636
if self._authorize is None:

twilio/rest/preview_iam/v1/authorize.py

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,116 +12,115 @@
1212
Do not edit the class manually.
1313
"""
1414

15-
16-
from datetime import date, datetime
17-
from decimal import Decimal
18-
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
19-
from twilio.base import deserialize, serialize, values
15+
from typing import Any, Dict, Optional, Union
16+
from twilio.base import values
2017

2118
from twilio.base.instance_resource import InstanceResource
2219
from twilio.base.list_resource import ListResource
2320
from twilio.base.version import Version
2421

2522

26-
2723
class AuthorizeInstance(InstanceResource):
28-
2924
"""
3025
:ivar redirect_to: The callback URL
3126
"""
3227

3328
def __init__(self, version: Version, payload: Dict[str, Any]):
3429
super().__init__(version)
3530

36-
3731
self.redirect_to: Optional[str] = payload.get("redirect_to")
3832

39-
40-
41-
4233
def __repr__(self) -> str:
4334
"""
4435
Provide a friendly representation
4536
4637
:returns: Machine friendly representation
4738
"""
48-
49-
return '<Twilio.PreviewIam.V1.AuthorizeInstance>'
50-
5139

40+
return "<Twilio.PreviewIam.V1.AuthorizeInstance>"
5241

5342

5443
class AuthorizeList(ListResource):
55-
44+
5645
def __init__(self, version: Version):
5746
"""
5847
Initialize the AuthorizeList
5948
6049
:param version: Version that contains the resource
61-
50+
6251
"""
6352
super().__init__(version)
6453

65-
66-
self._uri = '/authorize'
67-
68-
69-
70-
def fetch(self, response_type: Union[str, object]=values.unset, client_id: Union[str, object]=values.unset, redirect_uri: Union[str, object]=values.unset, scope: Union[str, object]=values.unset, state: Union[str, object]=values.unset) -> AuthorizeInstance:
54+
self._uri = "/authorize"
55+
56+
def fetch(
57+
self,
58+
response_type: Union[str, object] = values.unset,
59+
client_id: Union[str, object] = values.unset,
60+
redirect_uri: Union[str, object] = values.unset,
61+
scope: Union[str, object] = values.unset,
62+
state: Union[str, object] = values.unset,
63+
) -> AuthorizeInstance:
7164
"""
7265
Asynchronously fetch the AuthorizeInstance
7366
7467
:param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback
7568
:returns: The fetched AuthorizeInstance
7669
"""
77-
headers = values.of({
78-
'Content-Type': 'application/x-www-form-urlencoded'
79-
})
80-
81-
params = values.of({
82-
'response_type': response_type,
83-
'client_id': client_id,
84-
'redirect_uri': redirect_uri,
85-
'scope': scope,
86-
'state': state,
87-
88-
})
89-
90-
payload = self._version.fetch(method='GET', uri=self._uri, headers=headers, params=params)
70+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
71+
72+
params = values.of(
73+
{
74+
"response_type": response_type,
75+
"client_id": client_id,
76+
"redirect_uri": redirect_uri,
77+
"scope": scope,
78+
"state": state,
79+
}
80+
)
81+
82+
payload = self._version.fetch(
83+
method="GET", uri=self._uri, headers=headers, params=params
84+
)
9185

9286
return AuthorizeInstance(self._version, payload)
9387

94-
async def fetch_async(self, response_type: Union[str, object]=values.unset, client_id: Union[str, object]=values.unset, redirect_uri: Union[str, object]=values.unset, scope: Union[str, object]=values.unset, state: Union[str, object]=values.unset) -> AuthorizeInstance:
88+
async def fetch_async(
89+
self,
90+
response_type: Union[str, object] = values.unset,
91+
client_id: Union[str, object] = values.unset,
92+
redirect_uri: Union[str, object] = values.unset,
93+
scope: Union[str, object] = values.unset,
94+
state: Union[str, object] = values.unset,
95+
) -> AuthorizeInstance:
9596
"""
9697
Asynchronously fetch the AuthorizeInstance
9798
9899
:param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback
99100
:returns: The fetched AuthorizeInstance
100101
"""
101-
headers = values.of({
102-
'Content-Type': 'application/x-www-form-urlencoded'
103-
})
104-
105-
params = values.of({
106-
'response_type': response_type,
107-
'client_id': client_id,
108-
'redirect_uri': redirect_uri,
109-
'scope': scope,
110-
'state': state,
111-
112-
})
113-
114-
payload = await self._version.fetch_async(method='GET', uri=self._uri, headers=headers, params=params)
102+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
103+
104+
params = values.of(
105+
{
106+
"response_type": response_type,
107+
"client_id": client_id,
108+
"redirect_uri": redirect_uri,
109+
"scope": scope,
110+
"state": state,
111+
}
112+
)
113+
114+
payload = await self._version.fetch_async(
115+
method="GET", uri=self._uri, headers=headers, params=params
116+
)
115117

116118
return AuthorizeInstance(self._version, payload)
117119

118-
119-
120120
def __repr__(self) -> str:
121121
"""
122122
Provide a friendly representation
123123
124124
:returns: Machine friendly representation
125125
"""
126-
return '<Twilio.PreviewIam.V1.AuthorizeList>'
127-
126+
return "<Twilio.PreviewIam.V1.AuthorizeList>"

0 commit comments

Comments
 (0)
0