Skip to content

Commit 02e1d69

Browse files
committed
PTHMINT-45 Fix ruff error code ANN201
1 parent 17ee68b commit 02e1d69

File tree

16 files changed

+30
-24
lines changed

16 files changed

+30
-24
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ extend-safe-fixes = [
9898
"D415", # docstrings should end with a period, question mark, or exclamation point
9999
]
100100
ignore = [
101-
"ANN201",
102101
"ANN204",
103102
"ANN401",
104103
"ARG002",

src/multisafepay/api/base/listings/listing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_data(self: "Listing") -> List[T]:
101101
"""
102102
return self.data
103103

104-
def append(self: "Listing", item: T):
104+
def append(self: "Listing", item: T) -> None:
105105
"""
106106
Append an item to the listing.
107107

src/multisafepay/api/base/response/custom_api_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
for key, value in kwargs.items():
4242
setattr(self, key, value)
4343

44-
def get_data(self: "CustomApiResponse"):
44+
def get_data(self: "CustomApiResponse") -> Optional[Any]:
4545
"""
4646
Get the data contained in the response.
4747

src/multisafepay/api/paths/capture/request/capture_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CaptureRequest(RequestModel):
2525
status: Optional[str]
2626
reason: Optional[str]
2727

28-
def add_status(self: "CaptureRequest", status: str):
28+
def add_status(self: "CaptureRequest", status: str) -> "CaptureRequest":
2929
"""
3030
Add a status to the capture request.
3131
@@ -41,7 +41,7 @@ def add_status(self: "CaptureRequest", status: str):
4141
self.status = status
4242
return self
4343

44-
def add_reason(self: "CaptureRequest", reason: str):
44+
def add_reason(self: "CaptureRequest", reason: str) -> "CaptureRequest":
4545
"""
4646
Add a reason to the capture request.
4747

src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ class CheckoutData(RequestModel):
2626

2727
items: Optional[List[CartItem]]
2828

29-
def add_items(self: "CheckoutData", items: List[CartItem] = ()):
29+
def add_items(
30+
self: "CheckoutData",
31+
items: List[CartItem] = (),
32+
) -> "CheckoutData":
3033
"""
3134
Adds multiple items to the checkout data.
3235
@@ -45,7 +48,7 @@ def add_items(self: "CheckoutData", items: List[CartItem] = ()):
4548
self.add_item(item)
4649
return self
4750

48-
def add_item(self: "CheckoutData", item: CartItem):
51+
def add_item(self: "CheckoutData", item: CartItem) -> "CheckoutData":
4952
"""
5053
Adds a single item to the checkout data.
5154
@@ -63,7 +66,7 @@ def add_item(self: "CheckoutData", item: CartItem):
6366
self.items.append(item)
6467
return self
6568

66-
def get_items(self: "CheckoutData"):
69+
def get_items(self: "CheckoutData") -> List[CartItem]:
6770
"""
6871
Retrieves all items from the checkout data.
6972
@@ -74,7 +77,7 @@ def get_items(self: "CheckoutData"):
7477
"""
7578
return self.items
7679

77-
def get_item(self: "CheckoutData", index: int):
80+
def get_item(self: "CheckoutData", index: int) -> CartItem:
7881
"""
7982
Retrieves an item by its index from the checkout data.
8083
@@ -93,7 +96,7 @@ def generate_from_shopping_cart(
9396
self: "CheckoutData",
9497
shopping_cart: ShoppingCart,
9598
tax_table_selector: str = "",
96-
):
99+
) -> None:
97100
"""
98101
Generates checkout data from a shopping cart.
99102
@@ -114,7 +117,7 @@ def refund_by_merchant_item_id(
114117
self: "CheckoutData",
115118
merchant_item_id: str,
116119
quantity: int = 0,
117-
):
120+
) -> None:
118121
"""
119122
Processes a refund by merchant item ID.
120123
@@ -146,7 +149,7 @@ def refund_by_merchant_item_id(
146149
def get_item_by_merchant_item_id(
147150
self: "CheckoutData",
148151
merchant_item_id: str,
149-
):
152+
) -> CartItem:
150153
"""
151154
Retrieves an item by its merchant item ID.
152155

src/multisafepay/api/shared/cart/shopping_cart.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def get_items(self: "ShoppingCart") -> List[CartItem]:
3434
"""
3535
return self.items
3636

37-
def add_items(self: "ShoppingCart", items: List[CartItem]):
37+
def add_items(
38+
self: "ShoppingCart",
39+
items: List[CartItem],
40+
) -> "ShoppingCart":
3841
"""
3942
Add multiple items to the shopping cart.
4043
@@ -50,7 +53,7 @@ def add_items(self: "ShoppingCart", items: List[CartItem]):
5053
self.items = items
5154
return self
5255

53-
def add_item(self: "ShoppingCart", item: CartItem):
56+
def add_item(self: "ShoppingCart", item: CartItem) -> "ShoppingCart":
5457
"""
5558
Add a single item to the shopping cart.
5659

src/multisafepay/client/api_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ApiKey(BaseModel):
2525
api_key: str
2626

2727
@validator("api_key")
28-
def validate_api_key(cls: "ApiKey", api_key: str):
28+
def validate_api_key(cls: "ApiKey", api_key: str) -> str:
2929
"""
3030
Validate the API key.
3131

src/multisafepay/exception/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
import json
10+
from typing import Any
1011

1112

1213
class ApiException(Exception):
@@ -110,7 +111,7 @@ def get_context_as_array(self: "ApiException") -> list:
110111
lines.append(f"{context_name}: {debug_value}")
111112
return lines
112113

113-
def get_context_value(self: "ApiException", name: str):
114+
def get_context_value(self: "ApiException", name: str) -> Any:
114115
"""
115116
Get a specific context value by name.
116117

src/multisafepay/util/dict_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Any, Optional
99

1010

11-
def merge_recursive(dict1: dict, dict2: dict):
11+
def merge_recursive(dict1: dict, dict2: dict) -> dict:
1212
"""
1313
Recursively merge two dictionaries.
1414

src/multisafepay/util/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_plugin_version(self: "Version") -> str:
3434
"""
3535
return self.plugin_version
3636

37-
def set_plugin_version(self: "Version", version: Optional[str]):
37+
def set_plugin_version(self: "Version", version: Optional[str]) -> None:
3838
"""
3939
Set the plugin version.
4040

0 commit comments

Comments
 (0)