10000 PEP8ify · meego/twilio-python@8503534 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8503534

Browse files
committed
PEP8ify
1 parent 72143b4 commit 8503534

File tree

10 files changed

+53
-36
lines changed

10 files changed

+53
-36
lines changed

tests/test_base_resource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def testListResourceCreateResponse201(self):
105105
self.r.create_instance({})
106106
self.r.request.assert_called_with("POST", "https://api.twilio.com/2010-04-01/Resources", data={})
107107

108+
108109
class testInstanceResourceInit(unittest.TestCase):
109110

110111
def setUp(self):

twilio/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class TwilioRestException(TwilioException):
1212
:param int status: the HTTP status that was returned for the exception
1313
:param str uri: The URI that caused the exception
1414
:param str msg: A human-readable message for the error
15-
:param int|None code: A Twilio-specific error code for the error. This is not
16-
available for all errors.
15+
:param int|None code: A Twilio-specific error code for the error. This is
16+
not available for all errors.
1717
"""
1818

1919
# XXX: Move this to the twilio.rest folder

twilio/rest/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class TwilioRestClient(object):
4747
<https://twilio.com/user/account>`_
4848
:param str token: Your Auth Token from `your dashboard
4949
<https://twilio.com/user/account>`_
50-
:param float timeout: The socket and read timeout for making requests to Twilio
50+
:param float timeout: The socket and read timeout for requests to Twilio
5151
"""
5252

5353
def __init__(self, account=None, token=None, base="https://api.twilio.com",
@@ -111,20 +111,20 @@ def __init__(self, account=None, token=None, base="https://api.twilio.com",
111111
def participants(self, conference_sid):
112112
"""
113113
Return a :class:`~twilio.rest.resources.Participants` instance for the
114-
:class:`~twilio.rest.resources.Conference` with the given conference_sid
114+
:class:`~twilio.rest.resources.Conference` with given conference_sid
115115
"""
116116
base_uri = "%s/Conferences/%s" % (self.account_uri, conference_sid)
117117
return Participants(base_uri, self.auth, self.timeout)
118118

119119
def members(self, queue_sid):
120120
"""
121121
Return a :class:`Members <twilio.rest.resources.Members>` instance for
122-
the :class:`Queue <twilio.rest.resources.Queue>` with the given queue_sid
122+
the :class:`Queue <twilio.rest.resources.Queue>` with the
123+
given queue_sid
123124
"""
124125
base_uri = "%s/Queues/%s" % (self.account_uri, queue_sid)
125126
return Members(base_uri, self.auth, self.timeout)
126127

127-
128128
def request(self, path, method=None, vars=None):
129129
"""sends a request and gets a response from the Twilio REST API
130130
@@ -178,4 +178,3 @@ def request(self, path, method=None, vars=None):
178178
params=params, headers=headers)
179179

180180
return resp.content
181-

twilio/rest/resources/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class InstanceResource(Resource):
182182
""" The object representation of an instance response from the Twilio API
183183
184184
:param parent: The parent list class for this instance resource.
185-
For example, the parent for a :class:`~twilio.rest.resources.Call` would
186-
be a :class:`~twilio.rest.resources.Calls` object.
185+
For example, the parent for a :class:`~twilio.rest.resources.Call`
186+
would be a :class:`~twilio.rest.resources.Calls` object.
187187
:type parent: :class:`~twilio.rest.resources.ListResource`
188188
:param str sid: The 34-character unique identifier for this instance
189189
"""

twilio/rest/resources/messages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class Message(InstanceResource):
7171
7272
.. attribute:: price_unit
7373
74-
The currency in which price is measured, in ISO 4127 format (e.g. USD,EUR, JPY).
74+
The currency in which price is measured, in ISO 4127 format
75+
(e.g. USD,EUR, JPY).
7576
7677
.. attribute:: api_version
7778

twilio/rest/resources/phone_numbers.py

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ class PhoneNumber(InstanceResource):
108108
109109
.. attribute:: date_updated
110110
111-
The date that this resource was last updated, given as GMT RFC 2822 format.
111+
The date that this resource was last updated, in GMT RFC 2822 format.
112112
113113
.. attribute:: friendly_name
114114
115-
A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.
115+
A human readable descriptive text for this resource, up to 64 characters
116+
long. By default, the FriendlyName is a nicely formatted version of
117+
the phone number.
116118
117119
.. attribute:: account_sid
118120
@@ -124,58 +126,68 @@ class PhoneNumber(InstanceResource):
124126
125127
.. attribute:: api_version
126128
127-
Calls to this phone number will start a new TwiML session with this API version.
129+
Calls to this phone number will start a new TwiML session with this
130+
API version.
128131
129132
.. attribute:: voice_caller_id_lookup
130133
131-
Look up the caller's caller-ID name from the CNAM database (additional charges apply). Either true or false.
134+
Look up the caller's caller-ID name from the CNAM database (additional
135+
charges apply). Either true or false.
132136
133137
.. attribute:: voice_url
134138
135139
The URL Twilio will request when this phone number receives a call.
136140
137141
.. attribute:: voice_method
138142
139-
The HTTP method Twilio will use when requesting the above Url. Either GET or POST.
143+
The HTTP method Twilio will use when requesting the above Url.
144+
Either GET or POST.
140145
141146
.. attribute:: voice_fallback_url
142147
143-
The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by Url.
148+
The URL that Twilio will request if an error occurs retrieving or
149+
executing the TwiML requested by Url.
144150
145151
.. attribute:: voice_fallback_method
146152
147-
The HTTP method Twilio will use when requesting the VoiceFallbackUrl. Either GET or POST.
153+
The HTTP method Twilio will use when requesting the VoiceFallbackUrl.
154+
Either GET or POST.
148155
149156
.. attribute:: status_callback
150157
151-
The URL that Twilio will request to pass status parameters (such as call ended) to your application.
158+
The URL that Twilio will request to pass status parameters (such as
159+
call ended) to your application.
152160
153161
.. attribute:: status_callback_method
154162
155-
The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST.
163+
The HTTP method Twilio will use to make requests to the
164+
StatusCallback URL. Either GET or POST.
156165
157166
.. attribute:: sms_url
158167
159-
The URL Twilio will request when receiving an incoming SMS message to this number.
168+
The URL Twilio will request when receiving an incoming SMS message
169+
to this number.
160170
161171
.. attribute:: sms_method
162172
163-
The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
173+
The HTTP method Twilio will use when making requests to the SmsUrl.
174+
Either GET or POST.
164175
165176
.. attribute:: sms_fallback_url
166177
167-
The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.
178+
The URL that Twilio will request if an error occurs retrieving or
179+
executing the TwiML from SmsUrl.
168180
169181
.. attribute:: sms_fallback_method
170182
171-
The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
183+
The HTTP method Twilio will use when requesting the above URL.
184+
Either GET or POST.
172185
173186
.. attribute:: uri
174187
175188
The URI for this resource, relative to https://api.twilio.com.
176189
"""
177190

178-
179191
def load(self, entries):
180192
""" Set the proper Account owner of this phone number """
181193

@@ -262,7 +274,8 @@ def purchase(self, status_callback_url=None, **kwargs):
262274
263275
:returns: Returns a :class:`PhoneNumber` instance on success,
264276
:data:`False` on failure
265-
:raises: A :exc:`TypeError` if phone_number or area_code is not specified.
277+
:raises: A :exc:`TypeError` if neither phone_number or area_code
278+
is specified.
266279
"""
267280
kwargs["StatusCallback"] = kwargs.get("status_callback",
268281
status_callback_url)

twilio/rest/resources/queues.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Member(InstanceResource):
2525
The URI for this resource, relative to https://api.twilio.com.
2626
"""
2727

28-
2928
id_key = "call_sid"
3029

3130

@@ -91,7 +90,6 @@ class Queue(InstanceResource):
9190
queue.
9291
"""
9392

94-
9593
subresources = [
9694
Members
9795
]

twilio/rest/resources/sip/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from twilio.rest.resources.sip.domains import IpAccessControlListMappings
55
from twilio.rest.resources.sip.domains import Domains
66
from twilio.rest.resources.sip.ip_access_control_lists import IpAddresses
7-
from twilio.rest.resources.sip.ip_access_control_lists import SipIpAccessControlLists
7+
from twilio.rest.resources.sip.ip_access_control_lists import \
8+
SipIpAccessControlLists
89

910

1011
class Sip(object):
@@ -26,16 +27,16 @@ def __init__(self, base_uri, auth, timeout):
2627

2728
def ip_access_control_list_mappings(self, domain_sid):
2829
"""
29-
Return a :class:`IpAccessControlListMappings` instance for the :class:`Domain`
30-
with the given domain_sid
30+
Return a :class:`IpAccessControlListMappings` instance for the
31+
:class:`Domain` with the given domain_sid
3132
"""
3233
base_uri = "%s/Domains/%s" % (self.uri, domain_sid)
3334
return IpAccessControlListMappings(base_uri, self.auth, self.timeout)
3435

35 F438 36
def credential_list_mappings(self, domain_sid):
3637
"""
37-
Return a :class:`CredentialListMappings` instance for the :class:`Domain`
38-
with the given domain_sid
38+
Return a :class:`CredentialListMappings` instance for the
39+
:class:`Domain` with the given domain_sid
3940
"""
4041
base_uri = "%s/Domains/%s" % (self.uri, domain_sid)
4142
return CredentialListMappings(base_uri, self.auth, self.timeout)

twilio/rest/resources/sip/domains.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def create(self, domain_name, **kwargs):
159159
:type voice_method: None (defaults to 'POST'), 'GET', or 'POST'
160160
:param str voice_fallback_url: A URL that Twilio will request if an
161161
error occurs requesting or executing the TwiML at voice_url
162-
:param str voice_fallback_method: The HTTP method that Twilio should use
163-
to request the fallback_url
162+
:param str voice_fallback_method: The HTTP method that Twilio should
163+
use to request the fallback_url
164164
:type voice_fallback_method: None (defaults to 'POST'),
165165
'GET', or 'POST'
166166
:param str voice_status_callback: A URL that Twilio will request when

twilio/rest/resources/sms_messages.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ class SmsMessage(InstanceResource):
9292
9393
.. attribute:: from
9494
95-
The phone number that initiated the message in E.164 format. For incoming messages, this will be the remote phone. For outgoing messages, this will be one of your Twilio phone numbers.
95+
The phone number that initiated the message in E.164 format.
96+
For incoming messages, this will be the remote phone.
97+
For outgoing messages, this will be one of your Twilio phone numbers.
9698
9799
.. attribute:: to
98100
99-
The phone number that received the message in E.164 format. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the remote phone.
101+
The phone number that received the message in E.164 format.
102+
For incoming messages, this will be one of your Twilio phone numbers.
103+
For outgoing messages, this will be the remote phone.
100104
101105
.. attribute:: body
102106

0 commit comments

Comments
 (0)
0