Skip to content

Commit 8d5bdfd

Browse files
author
Will Myers
authored
Update quote linting (#37)
* Update docstring quotes to double * Fixup quotes in request_test.py * Include flake8-quotes in flake8 plugins * Update CHANGELOG
1 parent e44a316 commit 8d5bdfd

File tree

15 files changed

+86
-85
lines changed

15 files changed

+86
-85
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Current Version
2+
- Update flake8 quote linting
23
- Add official support for Python 3.7
34
- Drop official support for Python 2.6, 3.2, 3.3
45

pybutton/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class Client(object):
15-
'''Top-level interface for making requests to the Button API.
15+
"""Top-level interface for making requests to the Button API.
1616
1717
All resources implemented in this client will be exposed as attributes of a
1818
pybutton.Client instance.
@@ -37,7 +37,7 @@ class Client(object):
3737
Raises:
3838
pybutton.ButtonClientError
3939
40-
'''
40+
"""
4141

4242
def __init__(self, api_key, config=None):
4343

pybutton/error.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66

77
class ButtonClientError(Exception):
8-
'''An Exception class for all pybutton understood errors.
9-
'''
8+
"""An Exception class for all pybutton understood errors.
9+
"""
1010

1111

1212
class HTTPResponseError(ButtonClientError):
13-
'''A non-success HTTP response was returned from the remote API.
13+
"""A non-success HTTP response was returned from the remote API.
1414
1515
The HTTP response status code can be retrieved from the
1616
`.status_code` property.
1717
1818
The original error object can be retrieved from the
1919
`.cause` property.
20-
'''
20+
"""
2121
def __init__(self, message, status_code, cause):
2222
super(HTTPResponseError, self).__init__(message)
2323
self.status_code = status_code

pybutton/request.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from urllib.parse import parse_qs
2727

2828
def request(url, method, headers, data=None, timeout=None):
29-
''' Make an HTTP request in Python 3.x
29+
""" Make an HTTP request in Python 3.x
3030
3131
This method will abstract the underlying organization and invocation of
3232
the Python 3 HTTP standard lib implementation.
@@ -45,7 +45,7 @@ def request(url, method, headers, data=None, timeout=None):
4545
Returns:
4646
(dict): The response from the server interpreted as JSON.
4747
48-
'''
48+
"""
4949

5050
encoded_data = json.dumps(data).encode('utf8') if data else None
5151
request = Request(url, data=encoded_data, headers=headers)
@@ -71,7 +71,7 @@ def request(url, method, headers, data=None, timeout=None):
7171
from urlparse import parse_qs
7272

7373
def request(url, method, headers, data=None, timeout=None):
74-
''' Make an HTTP request in Python 2.x
74+
""" Make an HTTP request in Python 2.x
7575
7676
This method will abstract the underlying organization and invocation of
7777
the Python 2 HTTP standard lib implementation.
@@ -90,7 +90,7 @@ def request(url, method, headers, data=None, timeout=None):
9090
Returns:
9191
(dict): The response from the server interpreted as JSON.
9292
93-
'''
93+
"""
9494

9595
request = Request(url)
9696
request.get_method = lambda: method
@@ -111,7 +111,7 @@ def request(url, method, headers, data=None, timeout=None):
111111

112112

113113
def request_url(secure, hostname, port, path, query=None):
114-
'''
114+
"""
115115
Combines url components into a url passable into the request function.
116116
117117
Args:
@@ -123,7 +123,7 @@ def request_url(secure, hostname, port, path, query=None):
123123
124124
Returns:
125125
(str) A complete url made up of the arguments.
126-
'''
126+
"""
127127
encoded_query = urlencode(query) if query else ''
128128
scheme = 'https' if secure else 'http'
129129
netloc = '{0}:{1}'.format(hostname, port)
@@ -132,7 +132,7 @@ def request_url(secure, hostname, port, path, query=None):
132132

133133

134134
def query_dict(url):
135-
'''
135+
"""
136136
Given a url, returns a dictionary of its query parameters.
137137
138138
Args:
@@ -145,7 +145,7 @@ def query_dict(url):
145145
...
146146
}
147147
148-
'''
148+
"""
149149
url_components = urlparse(url)
150150

151151
if (url_components):

pybutton/resources/accounts.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77

88

99
class Accounts(Resource):
10-
'''Manages interacting with Button Accounts via the Button API
10+
"""Manages interacting with Button Accounts via the Button API
1111
1212
See Resource for class docstring.
1313
14-
'''
14+
"""
1515

1616
def all(self):
17-
'''Get a list of available accounts
17+
"""Get a list of available accounts
1818
1919
Raises:
2020
pybutton.ButtonClientError
2121
2222
Returns:
2323
(pybutton.Response) The API response
2424
25-
'''
25+
"""
2626

2727
return self.api_get('/v1/affiliation/accounts')
2828

2929
def transactions(self, account_id, cursor=None, start=None, end=None,
3030
time_field=None):
31-
'''Get a list of transactions.
31+
"""Get a list of transactions.
3232
To paginate transactions, pass the result of response.next_cursor() as
3333
the cursor argument.
3434
@@ -50,7 +50,7 @@ def transactions(self, account_id, cursor=None, start=None, end=None,
5050
Returns:
5151
(pybutton.Response) The API response
5252
53-
'''
53+
"""
5454

5555
query = {}
5656

pybutton/resources/customers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77

88

99
class Customers(Resource):
10-
'''Manages interacting with Button Customers via the Button API
10+
"""Manages interacting with Button Customers via the Button API
1111
1212
See Resource for class docstring.
1313
14-
'''
14+
"""
1515

1616
def _path(self, customer_id=None):
17-
'''Format a url path
17+
"""Format a url path
1818
1919
Args:
2020
customer_id (str) optional: A Button customer id ('customer-XXX')
2121
2222
Returns:
2323
(str): The formatted path
2424
25-
'''
25+
"""
2626

2727
if customer_id:
2828
return '/v1/customers/{0}'.format(customer_id)
2929
else:
3030
return '/v1/customers'
3131

3232
def get(self, customer_id):
33-
'''Get a customer
33+
"""Get a customer
3434
3535
Args:
3636
customer_id (str) : A Button customer id ('customer-XXX')
@@ -41,12 +41,12 @@ def get(self, customer_id):
4141
Returns:
4242
(pybutton.Response) The API response
4343
44-
'''
44+
"""
4545

4646
return self.api_get(self._path(customer_id))
4747

4848
def create(self, customer):
49-
'''Create an customer
49+
"""Create an customer
5050
5151
Args:
5252
customer (dict): A dict representing the attributes of an customer
@@ -57,6 +57,6 @@ def create(self, customer):
5757
Returns:
5858
(pybutton.Response) The API response
5959
60-
'''
60+
"""
6161

6262
return self.api_post(self._path(), customer)

pybutton/resources/links.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77

88

99
class Links(Resource):
10-
'''Manages interacting with Button Links via the Button API
10+
"""Manages interacting with Button Links via the Button API
1111
1212
See Resource for class docstring.
1313
14-
'''
14+
"""
1515

1616
def _path(self):
17-
'''Format a url path
17+
"""Format a url path
1818
1919
Args:
2020
link (dict): A dict representing the attributes of a link
2121
2222
Returns:
2323
(str): The formatted path
2424
25-
'''
25+
"""
2626

2727
return '/v1/links'
2828

2929
def create(self, link):
30-
'''Create a link
30+
"""Create a link
3131
3232
Args:
3333
link (dict): A dict representing the attributes of a link
@@ -38,12 +38,12 @@ def create(self, link):
3838
Returns:
3939
(pybutton.Response) The API response
4040
41-
'''
41+
"""
4242

4343
return self.api_post(self._path(), link)
4444

4545
def get_info(self, link):
46-
'''Get info on a link
46+
"""Get info on a link
4747
4848
Args:
4949
link (dict): A dict representing the attributes of a link for info
@@ -54,6 +54,6 @@ def get_info(self, link):
5454
Returns:
5555
(pybutton.Response) The API response
5656
57-
'''
57+
"""
5858

5959
return self.api_post(self._path() + '/info', link)

pybutton/resources/merchants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88

99
class Merchants(Resource):
10-
'''Manages interacting with Button Merchants via the Button API
10+
"""Manages interacting with Button Merchants via the Button API
1111
1212
See Resource for class docstring.
1313
14-
'''
14+
"""
1515

1616
def all(self, status=None, currency=None):
17-
'''Get a list of merchants and their configured rates
17+
"""Get a list of merchants and their configured rates
1818
1919
Args:
2020
status (str) optional: A status to filter by. One of ('approved',
@@ -28,7 +28,7 @@ def all(self, status=None, currency=None):
2828
Returns:
2929
(pybutton.Response) The API response
3030
31-
'''
31+
"""
3232

3333
query = {}
3434

pybutton/resources/orders.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77

88

99
class Orders(Resource):
10-
'''Manages interacting with Button Orders via the Button API
10+
"""Manages interacting with Button Orders via the Button API
1111
1212
See Resource for class docstring.
1313
14-
'''
14+
"""
1515

1616
def _path(self, order_id=None):
17-
'''Format a url path
17+
"""Format a url path
1818
1919
Args:
2020
order_id (str) optional: A Button order id ('btnorder-XXX')
2121
2222
Returns:
2323
(str): The formatted path
2424
25-
'''
25+
"""
2626

2727
if order_id:
2828
return '/v1/order/{0}'.format(order_id)
2929
else:
3030
return '/v1/order'
3131

3232
def get(self, order_id):
33-
'''Get an order
33+
"""Get an order
3434
3535
Args:
3636
order_id (str) : A Button order id ('btnorder-XXX')
@@ -41,12 +41,12 @@ def get(self, order_id):
4141
Returns:
4242
(pybutton.Response) The API response
4343
44-
'''
44+
"""
4545

4646
return self.api_get(self._path(order_id))
4747

4848
def create(self, order):
49-
'''Create an order
49+
"""Create an order
5050
5151
Args:
5252
order (dict): A dict representing the attributes of an order
@@ -57,12 +57,12 @@ def create(self, order):
5757
Returns:
5858
(pybutton.Response) The API response
5959
60-
'''
60+
"""
6161

6262
return self.api_post(self._path(), order)
6363

6464
def update(self, order_id, order):
65-
'''Update an order
65+
"""Update an order
6666
6767
Args:
6868
order_id (str) : A Button order id ('btnorder-XXX')
@@ -74,12 +74,12 @@ def update(self, order_id, order):
7474
Returns:
7575
(pybutton.Response) The API response
7676
77-
'''
77+
"""
7878

7979
return self.api_post(self._path(order_id), order)
8080

8181
def delete(self, order_id):
82-
'''Delete an order
82+
"""Delete an order
8383
8484
Args:
8585
order_id (str) : A Button order id ('btnorder-XXX')
@@ -90,6 +90,6 @@ def delete(self, order_id):
9090
Returns:
9191
(pybutton.Response) The API response
9292
93-
'''
93+
"""
9494

9595
return self.api_delete(self._path(order_id))

0 commit comments

Comments
 (0)