Skip to content

Commit 637fe3d

Browse files
authored
Merge pull request #43 from mwarzybok-sumoheavy/feature/SP-673
SP-673 GitHub Actions - Python throws error on tomli
2 parents 973bfdf + 75bf42f commit 637fe3d

File tree

11 files changed

+336
-289
lines changed

11 files changed

+336
-289
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
run: |
2424
pipenv install --dev
2525
pipenv run pip3 install typing-extensions
26-
- name: Run code formatter
27-
run: pipenv run black src/
26+
- name: Check code format
27+
run: pipenv run black --check src/
2828
- name: Run static analysis
2929
run: |
3030
pipenv run mypy --install-types --non-interactive src/

Pipfile.lock

Lines changed: 273 additions & 256 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bitpay/clients/bill_client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def create(
4242
)
4343
except BitPayException as exe:
4444
raise BillCreationException(
45-
"failed to serialize bill object : %s" % str(exe), api_code=exe.get_api_code()
45+
"failed to serialize bill object : %s" % str(exe),
46+
api_code=exe.get_api_code(),
4647
)
4748

4849
try:
@@ -73,7 +74,8 @@ def get(
7374
)
7475
except BitPayException as exe:
7576
raise BillQueryException(
76-
"failed to serialize bill object : %s" % str(exe), api_code=exe.get_api_code()
77+
"failed to serialize bill object : %s" % str(exe),
78+
api_code=exe.get_api_code(),
7779
)
7880

7981
try:
@@ -100,7 +102,8 @@ def get_bills(self, status: Optional[str] = None) -> List[Bill]:
100102
response_json = self.__bitpay_client.get("bills", params, True)
101103
except BitPayException as exe:
102104
raise BillQueryException(
103-
"failed to serialize bill object : %s" % str(exe), api_code=exe.get_api_code()
105+
"failed to serialize bill object : %s" % str(exe),
106+
api_code=exe.get_api_code(),
104107
)
105108

106109
try:
@@ -134,7 +137,8 @@ def update(self, bill: Bill, bill_id: str) -> Bill:
134137
)
135138
except BitPayException as exe:
136139
raise BillUpdateException(
137-
"failed to serialize bill object : %s" % str(exe), api_code=exe.get_api_code()
140+
"failed to serialize bill object : %s" % str(exe),
141+
api_code=exe.get_api_code(),
138142
)
139143

140144
try:
@@ -162,7 +166,8 @@ def deliver(self, bill_id: str, bill_token: str) -> bool:
162166
)
163167
except BitPayException as exe:
164168
raise BillDeliveryException(
165-
"failed to serialize bill object : %s" % str(exe), api_code=exe.get_api_code()
169+
"failed to serialize bill object : %s" % str(exe),
170+
api_code=exe.get_api_code(),
166171
)
167172

168173
try:

src/bitpay/clients/currency_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get_currencies(self) -> Dict[str, Currency]:
2626
except BitPayException as exe:
2727
raise CurrencyQueryException(
2828
"failed to serialize Currency object : %s" % str(exe),
29-
api_code=exe.get_api_code()
29+
api_code=exe.get_api_code(),
3030
)
3131

3232
try:

src/bitpay/clients/invoice_client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def get_invoices(
207207
response_json = self.__bitpay_client.get("invoices/", params, True)
208208
except BitPayException as exe:
209209
raise InvoiceQueryException(
210-
"failed to serialize Invoice object : %s" % str(exe), api_code=exe.get_api_code()
210+
"failed to serialize Invoice object : %s" % str(exe),
211+
api_code=exe.get_api_code(),
211212
)
212213
except Exception as exe:
213214
raise InvoiceQueryException(
@@ -302,7 +303,8 @@ def cancel(self, invoice_id: str, force_cancel: bool = False) -> Invoice:
302303
)
303304
except BitPayException as exe:
304305
raise InvoiceCancellationException(
305-
"failed to serialize Invoice object : %s" % str(exe), api_code=exe.get_api_code()
306+
"failed to serialize Invoice object : %s" % str(exe),
307+
api_code=exe.get_api_code(),
306308
)
307309
except Exception as exe:
308310
raise InvoiceCancellationException(
@@ -340,7 +342,8 @@ def cancel_by_guid(self, guid: str, force_cancel: bool = False) -> Invoice:
340342
)
341343
except BitPayException as exe:
342344
raise InvoiceCancellationException(
343-
"failed to serialize Invoice object : %s" % str(exe), api_code=exe.get_api_code()
345+
"failed to serialize Invoice object : %s" % str(exe),
346+
api_code=exe.get_api_code(),
344347
)
345348
except Exception as exe:
346349
raise InvoiceCancellationException(
@@ -375,7 +378,8 @@ def get_event_token(self, invoice_id: str) -> InvoiceEventToken:
375378
)
376379
except BitPayException as exe:
377380
raise InvoiceCancellationException(
378-
"failed to serialize Invoice object : %s" % str(exe), api_code=exe.get_api_code()
381+
"failed to serialize Invoice object : %s" % str(exe),
382+
api_code=exe.get_api_code(),
379383
)
380384
except Exception as exe:
381385
raise InvoiceCancellationException(
@@ -411,7 +415,8 @@ def pay(self, invoice_id: str, status: str) -> Invoice:
411415
)
412416
except BitPayException as exe:
413417
raise InvoicePaymentException(
414-
"failed to serialize Invoice object : %s" % str(exe), api_code=exe.get_api_code()
418+
"failed to serialize Invoice object : %s" % str(exe),
419+
api_code=exe.get_api_code(),
415420
)
416421
except Exception as exe:
417422
raise InvoicePaymentException(

src/bitpay/clients/ledger_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def get_entries(
3939
response_json = self.__bitpay_client.get("ledgers/%s" % currency, params)
4040
except BitPayException as exe:
4141
raise LedgerQueryException(
42-
"failed to serialize Ledger object : %s" % str(exe), api_code=exe.get_api_code()
42+
"failed to serialize Ledger object : %s" % str(exe),
43+
api_code=exe.get_api_code(),
4344
)
4445

4546
try:
@@ -68,7 +69,8 @@ def get_ledgers(self) -> List[Ledger]:
6869
response_json = self.__bitpay_client.get("ledgers", params)
6970
except BitPayException as exe:
7071
raise LedgerQueryException(
71-
"failed to serialize Ledger object : %s" % str(exe), api_code=exe.get_api_code()
72+
"failed to serialize Ledger object : %s" % str(exe),
73+
api_code=exe.get_api_code(),
7274
)
7375

7476
try:

src/bitpay/clients/payout_client.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def submit(self, payout: Payout) -> Payout:
3737
response_json = self.__bitpay_client.post("payouts", payout.to_json(), True)
3838
except BitPayException as exe:
3939
raise PayoutCreationException(
40-
"failed to serialize Payout object : %s" % str(exe), api_code=exe.get_api_code()
40+
"failed to serialize Payout object : %s" % str(exe),
41+
api_code=exe.get_api_code(),
4142
)
4243

4344
try:
@@ -65,7 +66,8 @@ def get(self, payout_id: str) -> Payout:
6566
response_json = self.__bitpay_client.get("payouts/%s" % payout_id, params)
6667
except BitPayException as exe:
6768
raise PayoutQueryException(
68-
"failed to serialize Payout object : %s" % str(exe), api_code=exe.get_api_code()
69+
"failed to serialize Payout object : %s" % str(exe),
70+
api_code=exe.get_api_code(),
6971
)
7072

7173
try:
@@ -118,7 +120,8 @@ def get_payouts(
118120
response_json = self.__bitpay_client.get("payouts", params)
119121
except BitPayException as exe:
120122
raise PayoutQueryException(
121-
"failed to serialize Payout object : %s" % str(exe), api_code=exe.get_api_code()
123+
"failed to serialize Payout object : %s" % str(exe),
124+
api_code=exe.get_api_code(),
122125
)
123126

124127
try:
@@ -228,7 +231,9 @@ def create_group(self, payouts: List[Payout]) -> PayoutGroup:
228231
def cancel_group(self, group_id: str) -> PayoutGroup:
229232
params = {"token": self.__token_container.get_access_token(Facade.PAYOUT)}
230233
try:
231-
response_json = self.__bitpay_client.delete("payouts/group/" + group_id, params)
234+
response_json = self.__bitpay_client.delete(
235+
"payouts/group/" + group_id, params
236+
)
232237
return self.get_payout_group_response(response_json, "cancelled")
233238
except BitPayException as exe:
234239
raise PayoutCancellationException(

src/bitpay/clients/payout_recipient_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def submit(self, recipients: PayoutRecipients) -> List[PayoutRecipient]:
6161
except BitPayException as exe:
6262
raise PayoutRecipientCreationException(
6363
"failed to serialize PayoutRecipients object : %s" % str(exe),
64-
api_code=exe.get_api_code()
64+
api_code=exe.get_api_code(),
6565
)
6666

6767
try:

src/bitpay/clients/rate_client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def get_rates(self) -> Rates:
2626
response_json = self.__bitpay_client.get("rates", None, False)
2727
except BitPayException as exe:
2828
raise RateQueryException(
29-
"failed to serialize Rates object : %s" % str(exe), api_code=exe.get_api_code()
29+
"failed to serialize Rates object : %s" % str(exe),
30+
api_code=exe.get_api_code(),
3031
)
3132

3233
try:
@@ -57,7 +58,8 @@ def get_currency_rates(self, base_currency: str) -> Rates:
5758
)
5859
except BitPayException as exe:
5960
raise RateQueryException(
60-
"failed to serialize Rates object : %s" % str(exe), api_code=exe.get_api_code()
61+
"failed to serialize Rates object : %s" % str(exe),
62+
api_code=exe.get_api_code(),
6163
)
6264

6365
try:
@@ -92,7 +94,8 @@ def get_currency_pair_rate(self, base_currency: str, currency: str) -> Rate:
9294
)
9395
except BitPayException as exe:
9496
raise RateQueryException(
95-
"failed to serialize Rates object : %s" % str(exe), api_code=exe.get_api_code()
97+
"failed to serialize Rates object : %s" % str(exe),
98+
api_code=exe.get_api_code(),
9699
)
97100

98101
try:

src/bitpay/clients/refund_client.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def create(
7979
response_json = self.__bitpay_client.post("refunds", params, True)
8080
except BitPayException as exe:
8181
raise RefundCreationException(
82-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
82+
"failed to serialize refund object : %s" % str(exe),
83+
api_code=exe.get_api_code(),
8384
)
8485
except Exception as exe:
8586
raise RefundCreationException(
@@ -100,7 +101,8 @@ def get(self, refund_id: str) -> Refund:
100101
response_json = self.__bitpay_client.get("refunds/%s" % refund_id, params)
101102
except BitPayException as exe:
102103
raise RefundQueryException(
103-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
104+
"failed to serialize refund object : %s" % str(exe),
105+
api_code=exe.get_api_code(),
104106
)
105107
except Exception as exe:
106108
raise RefundQueryException("failed to serialize refund object : %s" % exe)
@@ -127,7 +129,8 @@ def get_by_guid(self, guid: str) -> Refund:
127129
response_json = self.__bitpay_client.get("refunds/guid/%s" % guid, params)
128130
except BitPayException as exe:
129131
raise RefundQueryException(
130-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
132+
"failed to serialize refund object : %s" % str(exe),
133+
api_code=exe.get_api_code(),
131134
)
132135
except Exception as exe:
133136
raise RefundQueryException("failed to serialize refund object : %s" % exe)
@@ -157,7 +160,8 @@ def get_refunds(self, invoice_id: str) -> List[Refund]:
157160
response_json = self.__bitpay_client.get("refunds", params)
158161
except BitPayException as exe:
159162
raise RefundQueryException(
160-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
163+
"failed to serialize refund object : %s" % str(exe),
164+
api_code=exe.get_api_code(),
161165
)
162166
except Exception as exe:
163167
raise RefundQueryException(
@@ -198,7 +202,8 @@ def update(self, refund_id: str, status: str) -> Refund:
198202
)
199203
except BitPayException as exe:
200204
raise RefundUpdateException(
201-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
205+
"failed to serialize refund object : %s" % str(exe),
206+
api_code=exe.get_api_code(),
202207
)
203208
except Exception as exe:
204209
raise RefundUpdateException(
@@ -235,7 +240,8 @@ def update_by_guid(self, refund_guid: str, status: str) -> Refund:
235240
)
236241
except BitPayException as exe:
237242
raise RefundUpdateException(
238-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
243+
"failed to serialize refund object : %s" % str(exe),
244+
api_code=exe.get_api_code(),
239245
)
240246
except Exception as exe:
241247
raise RefundUpdateException(
@@ -267,7 +273,8 @@ def cancel(self, refund_id: str) -> Refund:
267273
)
268274
except BitPayException as exe:
269275
raise RefundCancellationException(
270-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
276+
"failed to serialize refund object : %s" % str(exe),
277+
api_code=exe.get_api_code(),
271278
)
272279
except Exception as exe:
273280
raise RefundCancellationException(
@@ -299,7 +306,8 @@ def cancel_by_guid(self, guid: str) -> Refund:
299306
)
300307
except BitPayException as exe:
301308
raise RefundCancellationException(
302-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
309+
"failed to serialize refund object : %s" % str(exe),
310+
api_code=exe.get_api_code(),
303311
)
304312
except Exception as exe:
305313
raise RefundCancellationException(
@@ -331,7 +339,8 @@ def request_notification(self, refund_id: str) -> bool:
331339
)
332340
except BitPayException as exe:
333341
raise RefundNotificationException(
334-
"failed to serialize refund object : %s" % str(exe), api_code=exe.get_api_code()
342+
"failed to serialize refund object : %s" % str(exe),
343+
api_code=exe.get_api_code(),
335344
)
336345
except Exception as exe:
337346
raise RefundNotificationException(

0 commit comments

Comments
 (0)