8000 fixes from pycharm · neo2020/twilio-python@9fd13ed · GitHub
[go: up one dir, main page]

Skip to content

Commit 9fd13ed

Browse files
author
Kevin Burke
committed
fixes from pycharm
1 parent b95beae commit 9fd13ed

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

twilio/jwt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import base64
77
import hashlib
88
import hmac
9-
from six import text_type, b
9+
from six import b
1010

1111

1212
# default text to binary representation conversion

twilio/rest/__init__.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def make_twilio_request(self, method, uri, **kwargs):
222222
error = resp.json()
223223
code = error["code"]
224224
message = "%s: %s" % (code, error["message"])
225-
except:
225+
except Exception:
226226
code = None
227227
message = resp.content
228228

@@ -255,20 +255,17 @@ def __init__(self, method='GET', uri='/', status=200, code=None, msg=""):
255255
def __str__(self):
256256
""" Try to pretty-print the exception, if this is going on screen. """
257257

258-
def red(msg):
259-
return u("\033[31m\033[49m%s\033[0m") % msg
258+
def red(words):
259+
return u("\033[31m\033[49m%s\033[0m") % words
260260

261-
def white(msg):
262-
return u("\033[37m\033[49m%s\033[0m") % msg
261+
def white(words):
262+
return u("\033[37m\033[49m%s\033[0m") % words
263263

264-
def blue(msg):
265-
return u("\033[34m\033[49m%s\033[0m") % msg
264+
def blue(words):
265+
return u("\033[34m\033[49m%s\033[0m") % words
266266

267-
def orange(msg):
268-
return u("\033[33m\033[49m%s\033[0m") % msg
269-
270-
def teal(msg):
271-
return u("\033[36m\033[49m%s\033[0m") % msg
267+
def teal(words):
268+
return u("\033[36m\033[49m%s\033[0m") % words
272269

273270
def get_uri(code):
274271
return "https://www.twilio.com/docs/errors/{}".format(code)

twilio/rest/resources/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ def __hash__(self):
2525
def __ne__(self, other):
2626
return not self.__eq__(other)
2727

28-
def get_resource(uri, **kwargs):
29-
pass
30-
3128
def request(self, method, uri, **kwargs):
3229
"""
3330
Send an HTTP request to the resource.

twilio/rest/resources/sip/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ class Sip(object):
1515

1616
def __init__(self, base_uri, client):
1717
self.uri = "%s/SIP" % base_uri
18+
self.client = client
1819
self.domains = Domains(self.uri, client)
1920
self.credential_lists = SipCredentialLists(self.uri, client)
2021
self.ip_access_control_lists = SipIpAccessControlLists(
2122
self.uri,
22-
client
23+
client,
2324
)
2425

2526
def ip_access_control_list_mappings(self, domain_sid):
@@ -28,15 +29,15 @@ def ip_access_control_list_mappings(self, domain_sid):
2829
:class:`Domain` with the given domain_sid
2930
"""
3031
base_uri = "%s/Domains/%s" % (self.uri, domain_sid)
31-
return IpAccessControlListMappings(base_uri, self.auth, self.timeout)
32+
return IpAccessControlListMappings(base_uri, self.client)
3233

3334
def credential_list_mappings(self, domain_sid):
3435
"""
3536
Return a :class:`CredentialListMappings` instance for the
3637
:class:`Domain` with the given domain_sid
3738
"""
3839
base_uri = "%s/Domains/%s" % (self.uri, domain_sid)
39-
return CredentialListMappings(base_uri, self.auth, self.timeout)
40+
return CredentialListMappings(base_uri, self.client)
4041

4142
def ip_addresses(self, ip_access_control_list_sid):
4243
"""
@@ -47,7 +48,7 @@ def ip_addresses(self, ip_access_control_list_sid):
4748
self.uri,
4849
ip_access_control_list_sid,
4950
)
50-
return IpAddresses(base_uri, self.auth, self.timeout)
51+
return IpAddresses(base_uri, self.client)
5152

5253
def credentials(self, credential_list_sid):
5354
"""
@@ -58,4 +59,4 @@ def credentials(self, credential_list_sid):
5859
self.uri,
5960
credential_list_sid,
6061
)
61-
return Credentials(base_uri, self.auth, self.timeout)
62+
return Credentials(base_uri, self.client)

twilio/rest/resources/usage.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from twilio.rest.resources import InstanceResource, ListResource
2-
from twilio.rest.resources.util import UNSET_TIMEOUT
32

43

54
class UsageTrigger(InstanceResource):

twilio/util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def compute_signature(self, uri, params):
1818
1919
:param uri: full URI that Twilio requested on your server
2020
:param params: post vars that Twilio sent with the request
21-
:param auth: tuple with (account_sid, token)
2221
2322
:returns: The computed signature
2423
"""
@@ -39,7 +38,6 @@ def validate(self, uri, params, signature):
3938
:param uri: full URI that Twilio requested on your server
4039
:param params: post vars that Twilio sent with the request
4140
:param signature: expexcted signature in HTTP X-Twilio-Signature header
42-
:param auth: tuple with (account_sid, token)
4341
4442
:returns: True if the request passes validation, False if not
4543
"""

0 commit comments

Comments
 (0)
0