Skip to content

Commit 009d7ca

Browse files
author
Bruno Vieira
committed
lint project with black to match pep8
Signed-off-by: Bruno Vieira <[email protected]>
1 parent f93dacd commit 009d7ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1434
-1449
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[flake8]
22
ignore = E501,W503
33
exclude = __init__.py
4+
max-line-length = 100

chartmogul/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
:license: MIT, see LICENSE for more details.
3838
"""
3939

40-
__title__ = 'chartmogul'
40+
__title__ = "chartmogul"
4141
__build__ = 0x000000
42-
__author__ = 'ChartMogul Ltd'
43-
__license__ = 'MIT'
44-
__copyright__ = 'Copyright 2023 ChartMogul Ltd'
42+
__author__ = "ChartMogul Ltd"
43+
__license__ = "MIT"
44+
__copyright__ = "Copyright 2023 ChartMogul Ltd"

chartmogul/api/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
21
# api module is imported directly into chartmogul namespace for users' convenience.

chartmogul/api/account.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Account(Resource):
66
"""
77
https://dev.chartmogul.com/v1.0/reference#account
88
"""
9+
910
_path = "/account"
1011

1112
class _Schema(Schema):

chartmogul/api/activities_export.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class ExportParams(DataObject):
8-
98
class _Schema(Schema):
109
kind = fields.String()
1110
params = fields.Dict(allow_none=True)
@@ -19,8 +18,9 @@ class ActivitiesExport(Resource):
1918
"""
2019
https://dev.chartmogul.com/v1.0/reference#
2120
"""
21+
2222
_path = "/activities_export"
23-
_many = namedtuple('ActivitiesExport', ["id", "status", "file_url", "expires_at", "created_at"])
23+
_many = namedtuple("ActivitiesExport", ["id", "status", "file_url", "expires_at", "created_at"])
2424

2525
class _Schema(Schema):
2626
# Create
@@ -45,11 +45,13 @@ def make(self, data, **kwargs):
4545
@classmethod
4646
def _validate_arguments(cls, method, kwargs):
4747
# This enforces user to pass correct argument
48-
if method in ['retrieve'] and 'id' not in kwargs:
49-
raise ArgumentMissingError("Please pass 'id' parameter to retrieve your export request status")
50-
if method in ['create'] and 'data' not in kwargs:
48+
if method in ["retrieve"] and "id" not in kwargs:
49+
raise ArgumentMissingError(
50+
"Please pass 'id' parameter to retrieve your export request status"
51+
)
52+
if method in ["create"] and "data" not in kwargs:
5153
raise ArgumentMissingError("Please pass 'data' parameter")
5254

5355

54-
ActivitiesExport.create = ActivitiesExport._method('create', 'post', '/activities_export')
55-
ActivitiesExport.retrieve = ActivitiesExport._method('retrieve', 'get', '/activities_export/{id}')
56+
ActivitiesExport.create = ActivitiesExport._method("create", "post", "/activities_export")
57+
ActivitiesExport.retrieve = ActivitiesExport._method("retrieve", "get", "/activities_export/{id}")

chartmogul/api/activity.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@ class Activity(Resource):
77
"""
88
https://dev.chartmogul.com/reference/list-activities
99
"""
10-
_path = '/activities'
11-
_root_key = 'entries'
12-
_many = namedtuple('Activities',
13-
[_root_key, 'has_more', 'per_page', 'cursor'],
14-
defaults=[None, None, None])
10+
11+
_path = "/activities"
12+
_root_key = "entries"
13+
_many = namedtuple(
14+
"Activities", [_root_key, "has_more", "per_page", "cursor"], defaults=[None, None, None]
15+
)
1516

1617
class _Schema(Schema):
17-
activity_arr = fields.Number(data_key='activity-arr')
18-
activity_mrr = fields.Number(data_key='activity-mrr')
19-
activity_mrr_movement = fields.Number(data_key='activity-mrr-movement')
18+
activity_arr = fields.Number(data_key="activity-arr")
19+
activity_mrr = fields.Number(data_key="activity-mrr")
20+
activity_mrr_movement = fields.Number(data_key="activity-mrr-movement")
2021
currency = fields.String()
2122
date = fields.DateTime()
2223
description = fields.String()
2324
type = fields.String()
24-
subscription_external_id = fields.String(data_key='subscription-external-id')
25-
plan_external_id = fields.String(data_key='plan-external-id')
26-
customer_name = fields.String(data_key='customer-name')
27-
customer_uuid = fields.String(data_key='customer-uuid')
28-
customer_external_id = fields.String(data_key='customer-external-id')
29-
billing_connector_uuid = fields.String(data_key='billing-connector-uuid')
30-
uuid = fields.String(data_key='uuid')
25+
subscription_external_id = fields.String(data_key="subscription-external-id")
26+
plan_external_id = fields.String(data_key="plan-external-id")
27+
customer_name = fields.String(data_key="customer-name")
28+
customer_uuid = fields.String(data_key="customer-uuid")
29+
customer_external_id = fields.String(data_key="customer-external-id")
30+
billing_connector_uuid = fields.String(data_key="billing-connector-uuid")
31+
uuid = fields.String(data_key="uuid")
3132

3233
@post_load
3334
def make(self, data, **kwargs):

chartmogul/api/attributes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Attributes(Resource):
66
"""
77
https://dev.chartmogul.com/v1.0/reference#customer-attributes
88
"""
9+
910
_path = "/customers{/uuid}/attributes"
1011

1112
class _Schema(Schema):

chartmogul/api/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Config:
66
uri = API_BASE + "/" + VERSION
77

88
def __init__(self, api_key, request_timeout=None, max_retries=20, backoff_factor=2):
9-
self.auth = (api_key, '')
9+
self.auth = (api_key, "")
1010
self.request_timeout = request_timeout
1111
self.max_retries = max_retries
1212
self.backoff_factor = backoff_factor

chartmogul/api/contact.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Contact(Resource):
77
"""
88
https://dev.chartmogul.com/v1.0/reference#contacts
99
"""
10+
1011
_path = "/contacts{/uuid}"
1112
_root_key = "entries"
1213
_many = namedtuple("Contacts", [_root_key, "has_more", "cursor"])

chartmogul/api/custom_attrs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class CustomAttributes(Resource):
88
"""
99
https://dev.chartmogul.com/v1.0/reference#custom-attributes
1010
"""
11+
1112
_path = "/customers{/uuid}/attributes/custom"
1213

1314
class _Schema(Schema):
@@ -17,7 +18,7 @@ class _Schema(Schema):
1718
def make(self, data, **kwargs):
1819
return CustomAttributes(**data)
1920

20-
_customers = namedtuple('Customers', ['entries'])
21+
_customers = namedtuple("Customers", ["entries"])
2122
_schema = _Schema(unknown=EXCLUDE)
2223

2324
@classmethod
@@ -30,8 +31,8 @@ def _load(cls, response):
3031
if response.status_code == 204:
3132
return None
3233
jsonObj = response.json()
33-
if 'entries' in jsonObj:
34-
customers = Customer._schema.load(jsonObj['entries'], many=True)
34+
if "entries" in jsonObj:
35+
customers = Customer._schema.load(jsonObj["entries"], many=True)
3536
return cls._customers(customers)
3637
else:
3738
return cls._schema.load(jsonObj)

0 commit comments

Comments
 (0)