Skip to content

Commit 39c5f6f

Browse files
committed
Clean up code quality
1 parent 3f89f62 commit 39c5f6f

9 files changed

Lines changed: 20 additions & 20 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Braspag SDK for Python
22
[![PyPi page link -- version](https://img.shields.io/pypi/v/braspag-sdk.svg)](https://pypi.python.org/pypi/braspag-sdk)
3+
[![License](https://img.shields.io/github/license/romatallinn/braspagSdk-python)](LICENSE)
4+
35

46
An unofficial Python SDK for [Braspag](https://braspag.github.io/).
57

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .get_access_token import *
1+
from .get_access_token import *

braspag_sdk/apps/emv3ds/services.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from .environment import EMV3DSEnvironment
2-
from .data import *
31
from .requests import *
42

53

braspag_sdk/apps/payments/data/credit_card.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def __init__(self, security_code, brand):
1414
self.card_token = None
1515
self.customer_name = None
1616

17-
1817
def update_return(self, response_return):
1918

2019
self.card_token = response_return['CardToken']

braspag_sdk/apps/payments/data/payment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class Payment(ObjectJSON):
1414

15-
def __init__(self, amount, installments = 1):
15+
def __init__(self, amount, installments=1):
1616

1717
self.amount = amount
1818
self.service_tax_amount = None

braspag_sdk/apps/payments/services.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .environment import PaymentsEnvironment
21
from .data import *
32
from .requests import *
43

braspag_sdk/apps/sop/services.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from datetime import datetime, timedelta
2-
31
from .requests import *
42

53

@@ -35,4 +33,3 @@ def get_access_token(self):
3533
environment=self._environment,
3634
)
3735
return request.execute()
38-

braspag_sdk/utils/base_request.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ def send_request(self, method, uri, data=None, params=None):
5151
data_send = body
5252
if not isinstance(data_send, dict):
5353
data_send = json.loads(data_send or 'null')
54-
raise_with_traceback(Exception('\r\n%s\r\nMethod: %s\r\nUri: %s\r\nData: %s' % (response.content, method, response.url, json.dumps(data_send, indent=2))))
54+
raise_with_traceback(Exception(
55+
'\r\n%s\r\n'
56+
'Method: %s\r\n'
57+
'Uri: %s\r\n'
58+
'Data: %s' % (response.content, method, response.url, json.dumps(data_send, indent=2))
59+
))
5560

5661
return answers
5762

braspag_sdk/utils/object_json.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
class ObjectJSON(object):
66

77
def toJSON(self):
8-
98
dicionary = json.loads(json.dumps(self, default=lambda o: o.__dict__))
109

1110
dicionary = remove_none(dicionary)
@@ -18,43 +17,43 @@ def prepare(self):
1817
pass
1918

2019
def __getattribute__(self, attribute):
21-
2220
if attribute == '__dict__':
2321
self.prepare()
2422

2523
return object.__getattribute__(self, attribute)
2624

2725

2826
def process_name_key(dictionary):
29-
3027
if not isinstance(dictionary, dict):
3128
return dictionary
3229

33-
newDictionary = {}
30+
new_dictionary = {}
3431

3532
for key in dictionary:
36-
newDictionary[capitalize_key(key)] = process_name_key(dictionary[key])
33+
new_dictionary[capitalize_key(key)] = process_name_key(dictionary[key])
34+
35+
return new_dictionary
3736

38-
return newDictionary
3937

4038
def capitalize_key(key):
4139
parts = key.split('_')
4240

43-
newParts = []
41+
new_parts = []
4442
for part in parts:
45-
newParts.append(part.capitalize())
43+
new_parts.append(part.capitalize())
4644

47-
return ''.join(newParts)
45+
return ''.join(new_parts)
4846

49-
def remove_none(dado):
5047

48+
def remove_none(dado):
5149
if isinstance(dado, dict):
5250
return remove_none_dict(dado)
5351
elif isinstance(dado, list):
5452
return remove_none_list(dado)
5553

5654
return dado
5755

56+
5857
def remove_none_dict(obj):
5958
retorno = {}
6059
for chave in obj:
@@ -65,6 +64,7 @@ def remove_none_dict(obj):
6564

6665
return retorno
6766

67+
6868
def remove_none_list(lista):
6969
resposta = []
7070
for linha in lista:

0 commit comments

Comments
 (0)