Skip to content

Commit d89f135

Browse files
committed
PTHMINT-51: Fix ruff BLE001
1 parent d23e05d commit d89f135

File tree

11 files changed

+25
-25
lines changed

11 files changed

+25
-25
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ extend-safe-fixes = [
9999
"D415", # docstrings should end with a period, question mark, or exclamation point
100100
]
101101
ignore = [
102-
"BLE001",
103102
"D100",
104103
"D101",
105104
"D103",

src/multisafepay/api/paths/auth/auth_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.api_response import ApiResponse
1110
from multisafepay.api.base.response.custom_api_response import (
@@ -15,6 +14,7 @@
1514
from multisafepay.client.client import Client
1615
from multisafepay.util.dict_utils import dict_empty
1716
from multisafepay.util.message import MessageList, gen_could_not_created_msg
17+
from pydantic import ValidationError
1818

1919

2020
class AuthManager(AbstractManager):
@@ -57,7 +57,7 @@ def get_api_token(self: "AuthManager") -> CustomApiResponse:
5757
if not dict_empty(response.get_body_data()):
5858
try:
5959
args["data"] = ApiToken(**response.get_body_data().copy())
60-
except Exception as e:
60+
except ValidationError as e:
6161
args["warnings"] = (
6262
MessageList()
6363
.add_message(str(e))

src/multisafepay/api/paths/capture/capture_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
import json
109

1110
from multisafepay.api.base.abstract_manager import AbstractManager
@@ -19,6 +18,7 @@
1918
from multisafepay.client.client import Client
2019
from multisafepay.util.dict_utils import dict_empty
2120
from multisafepay.util.message import MessageList, gen_could_not_created_msg
21+
from pydantic import ValidationError
2222

2323

2424
class CaptureManager(AbstractManager):
@@ -73,7 +73,7 @@ def capture_reservation_cancel(
7373
args["data"] = CancelReservation(
7474
**response.get_body_data().copy(),
7575
)
76-
except Exception as e:
76+
except ValidationError as e:
7777
args["warnings"] = (
7878
MessageList()
7979
.add_message(str(e))

src/multisafepay/api/paths/categories/category_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.custom_api_response import (
1110
CustomApiResponse,
1211
)
1312
from multisafepay.api.paths.categories.response.category import Category
1413
from multisafepay.client.client import Client
1514
from multisafepay.util.message import MessageList, gen_could_not_created_msg
15+
from pydantic import ValidationError
1616

1717

1818
class CategoryManager(AbstractManager):
@@ -56,7 +56,7 @@ def get_categories(self: "CategoryManager") -> CustomApiResponse:
5656
Category.from_dict(category)
5757
for category in response.get_body_data().copy()
5858
]
59-
except Exception as e:
59+
except ValidationError as e:
6060
args["warnings"] = (
6161
MessageList()
6262
.add_message(str(e))

src/multisafepay/api/paths/gateways/gateway_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.custom_api_response import (
1110
CustomApiResponse,
@@ -14,6 +13,7 @@
1413
from multisafepay.client.client import Client
1514
from multisafepay.util.dict_utils import dict_empty
1615
from multisafepay.util.message import MessageList, gen_could_not_created_msg
16+
from pydantic import ValidationError
1717

1818
ALLOWED_OPTIONS = {
1919
"country": "",
@@ -70,7 +70,7 @@ def get_gateways(
7070
Gateway.from_dict(gateway)
7171
for gateway in response.get_body_data().copy()
7272
]
73-
except Exception as e:
73+
except ValidationError as e:
7474
args["warnings"] = (
7575
MessageList()
7676
.add_message(str(e))
@@ -115,7 +115,7 @@ def get_by_code(
115115
if not dict_empty(response.get_body_data()):
116116
try:
117117
args["data"] = Gateway(**response.get_body_data().copy())
118-
except Exception as e:
118+
except ValidationError as e:
119119
args["warnings"] = (
120120
MessageList()
121121
.add_message(str(e))

src/multisafepay/api/paths/issuers/issuer_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.custom_api_response import (
1110
CustomApiResponse,
@@ -17,6 +16,7 @@
1716
from multisafepay.client.client import Client
1817
from multisafepay.exception.invalid_argument import InvalidArgumentException
1918
from multisafepay.util.message import MessageList, gen_could_not_created_msg
19+
from pydantic import ValidationError
2020

2121

2222
class IssuerManager(AbstractManager):
@@ -73,7 +73,7 @@ def get_issuers_by_gateway_code(
7373
Issuer.from_dict(issuer)
7474
for issuer in response.get_body_data().copy()
7575
]
76-
except Exception as e:
76+
except ValidationError as e:
7777
print(e)
7878
args["warnings"] = (
7979
MessageList()

src/multisafepay/api/paths/me/me_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.custom_api_response import (
1110
CustomApiResponse,
@@ -14,6 +13,7 @@
1413
from multisafepay.client.client import Client
1514
from multisafepay.util.dict_utils import dict_empty
1615
from multisafepay.util.message import MessageList, gen_could_not_created_msg
16+
from pydantic import ValidationError
1717

1818

1919
class MeManager(AbstractManager):
@@ -52,7 +52,7 @@ def get(self: "MeManager") -> CustomApiResponse:
5252
if not dict_empty(response.get_body_data()):
5353
try:
5454
args["data"] = Me(**response.get_body_data().copy())
55-
except Exception as e:
55+
except ValidationError as e:
5656
args["warnings"] = (
5757
MessageList()
5858
.add_message(str(e))

src/multisafepay/api/paths/orders/order_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
import json
109
from typing import Union
1110

@@ -41,6 +40,7 @@
4140
from multisafepay.util.message import MessageList, gen_could_not_created_msg
4241
from multisafepay.value_object.amount import Amount
4342
from multisafepay.value_object.currency import Currency
43+
from pydantic import ValidationError
4444

4545

4646
class OrderManager(AbstractManager):
@@ -82,7 +82,7 @@ def __custom_api_response(response: ApiResponse) -> CustomApiResponse:
8282
args["data"] = Order.from_dict(
8383
d=response.get_body_data().copy(),
8484
)
85-
except Exception:
85+
except ValidationError:
8686
args["warnings"] = MessageList().add_message(
8787
gen_could_not_created_msg("Order"),
8888
)
@@ -198,7 +198,7 @@ def capture(
198198
args["data"] = OrderCapture.from_dict(
199199
d=response.get_body_data().copy(),
200200
)
201-
except Exception:
201+
except ValidationError:
202202
args["warnings"] = MessageList().add_message(
203203
gen_could_not_created_msg("OrderCapture"),
204204
)
@@ -238,7 +238,7 @@ def refund(
238238
args["data"] = OrderRefund.from_dict(
239239
d=response.get_body_data().copy(),
240240
)
241-
except Exception:
241+
except ValidationError:
242242
args["warnings"] = MessageList().add_message(
243243
gen_could_not_created_msg("OrderRefund"),
244244
)

src/multisafepay/api/paths/payment_methods/payment_method_manager.py

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

66
# See the DISCLAIMER.md file for disclaimer details.
77

8-
98
from multisafepay.api.base.abstract_manager import AbstractManager
109
from multisafepay.api.base.response.custom_api_response import (
1110
CustomApiResponse,
@@ -16,6 +15,7 @@
1615
from multisafepay.client.client import ApiResponse, Client
1716
from multisafepay.util.dict_utils import dict_empty
1817
from multisafepay.util.message import MessageList, gen_could_not_created_msg
18+
from pydantic import ValidationError
1919

2020
ALLOWED_OPTIONS = {
2121
"country": "",
@@ -98,7 +98,7 @@ def get_payment_methods(
9898
PaymentMethod.from_dict(payment_method)
9999
for payment_method in response.get_body_data().copy()
100100
]
101-
except Exception:
101+
except ValidationError:
102102
args["warnings"] = MessageList().add_message(
103103
gen_could_not_created_msg("Listing Payment Method"),
104104
)
@@ -140,7 +140,7 @@ def get_by_gateway_code(
140140
args["data"] = PaymentMethod.from_dict(
141141
d=response.get_body_data().copy(),
142142
)
143-
except Exception:
143+
except ValidationError:
144144
args["warnings"] = MessageList().add_message(
145145
gen_could_not_created_msg("Payment Method"),
146146
)

src/multisafepay/api/paths/recurring/recurring_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from multisafepay.client.client import Client
1919
from multisafepay.util.dict_utils import dict_empty
2020
from multisafepay.util.message import MessageList, gen_could_not_created_msg
21+
from pydantic import ValidationError
2122

2223

2324
class RecurringManager(AbstractManager):
@@ -85,7 +86,7 @@ def get_list(
8586
if tokens["tokens"]
8687
]
8788

88-
except Exception:
89+
except ValidationError:
8990
args["warnings"] = MessageList().add_message(
9091
gen_could_not_created_msg("Listing Tokens"),
9192
)
@@ -122,7 +123,7 @@ def get(
122123
if not dict_empty(response.get_body_data()):
123124
try:
124125
args["data"] = Token(**response.get_body_data().copy())
125-
except Exception:
126+
except ValidationError:
126127
args["warnings"] = MessageList().add_message(
127128
gen_could_not_created_msg("Listing Tokens"),
128129
)

0 commit comments

Comments
 (0)