Skip to content

Commit 48a9960

Browse files
committed
PTHMINT-42: Fix ruff error ANN101 occurrences
1 parent 93bacee commit 48a9960

File tree

76 files changed

+523
-302
lines changed

Some content is hidden

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

76 files changed

+523
-302
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-
"ANN101", # missing type annotation for self
102101
"ANN102", # missing type annotation for cls
103102
"ANN201",
104103
"ANN204",

src/multisafepay/api/base/abstract_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AbstractManager:
1919
2020
"""
2121

22-
def __init__(self, client: Client):
22+
def __init__(self: "AbstractManager", client: Client):
2323
"""
2424
Initialize the AbstractManager with a Client instance.
2525

src/multisafepay/api/base/decorator.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class Decorator:
1414
1515
Attributes
1616
----------
17-
dependencies (Optional[dict]): A dictionary of dependencies to be used by the decorator.
17+
dependencies (Optional[Dict]): A dictionary of dependencies to be used by the decorator.
1818
1919
"""
2020

21-
dependencies: Optional[dict]
21+
dependencies: Optional[Dict]
2222

23-
def __init__(self, dependencies: dict = {}) -> None:
23+
def __init__(self: "Decorator", dependencies: Dict = {}) -> None:
2424
"""
2525
Initialize the Decorator with optional dependencies.
2626
@@ -32,7 +32,7 @@ def __init__(self, dependencies: dict = {}) -> None:
3232
self.dependencies = dependencies
3333

3434
def adapt_checkout_options(
35-
self,
35+
self: "Decorator",
3636
checkout_options: Optional[Dict],
3737
) -> "Decorator":
3838
"""
@@ -57,7 +57,7 @@ def adapt_checkout_options(
5757
)
5858
return self
5959

60-
def adapt_costs(self, costs: Optional[Dict]) -> "Decorator":
60+
def adapt_costs(self: "Decorator", costs: Optional[Dict]) -> "Decorator":
6161
"""
6262
Adapt the costs and update the dependencies.
6363
@@ -78,7 +78,10 @@ def adapt_costs(self, costs: Optional[Dict]) -> "Decorator":
7878
]
7979
return self
8080

81-
def adapt_custom_info(self, custom_info: Optional[Dict]) -> "Decorator":
81+
def adapt_custom_info(
82+
self: "Decorator",
83+
custom_info: Optional[Dict],
84+
) -> "Decorator":
8285
"""
8386
Adapt the custom information and update the dependencies.
8487
@@ -100,7 +103,10 @@ def adapt_custom_info(self, custom_info: Optional[Dict]) -> "Decorator":
100103

101104
return self
102105

103-
def adapt_customer(self, customer: Optional[Dict]) -> "Decorator":
106+
def adapt_customer(
107+
self: "Decorator",
108+
customer: Optional[Dict],
109+
) -> "Decorator":
104110
"""
105111
Adapt the customer information and update the dependencies.
106112
@@ -121,7 +127,7 @@ def adapt_customer(self, customer: Optional[Dict]) -> "Decorator":
121127
return self
122128

123129
def adapt_order_adjustment(
124-
self,
130+
self: "Decorator",
125131
order_adjustment: Optional[Dict],
126132
) -> "Decorator":
127133
"""
@@ -148,7 +154,7 @@ def adapt_order_adjustment(
148154
return self
149155

150156
def adapt_payment_details(
151-
self,
157+
self: "Decorator",
152158
payment_details: Optional[Dict],
153159
) -> "Decorator":
154160
"""
@@ -175,7 +181,7 @@ def adapt_payment_details(
175181
return self
176182

177183
def adapt_payment_methods(
178-
self,
184+
self: "Decorator",
179185
payment_methods: Optional[Dict],
180186
) -> "Decorator":
181187
"""
@@ -200,7 +206,7 @@ def adapt_payment_methods(
200206
return self
201207

202208
def adapt_shopping_cart(
203-
self,
209+
self: "Decorator",
204210
shopping_cart: Optional[Dict],
205211
) -> "Decorator":
206212
"""
@@ -224,7 +230,7 @@ def adapt_shopping_cart(
224230
return self
225231

226232
def adapt_related_transactions(
227-
self,
233+
self: "Decorator",
228234
related_transactions: Optional[Dict],
229235
) -> "Decorator":
230236
"""
@@ -250,7 +256,7 @@ def adapt_related_transactions(
250256
]
251257
return self
252258

253-
def adapt_apps(self, apps: Optional[Dict]) -> "Decorator":
259+
def adapt_apps(self: "Decorator", apps: Optional[Dict]) -> "Decorator":
254260
"""
255261
Adapt the apps and update the dependencies.
256262
@@ -273,7 +279,7 @@ def adapt_apps(self, apps: Optional[Dict]) -> "Decorator":
273279
return self
274280

275281
def adapt_brands(
276-
self,
282+
self: "Decorator",
277283
brands: Optional[List[Optional[Dict]]],
278284
) -> "Decorator":
279285
"""
@@ -298,7 +304,10 @@ def adapt_brands(
298304
]
299305
return self
300306

301-
def adapt_icon_urls(self, icon_urls: Optional[Dict]) -> "Decorator":
307+
def adapt_icon_urls(
308+
self: "Decorator",
309+
icon_urls: Optional[Dict],
310+
) -> "Decorator":
302311
"""
303312
Adapt the icon URLs and update the dependencies.
304313
@@ -320,7 +329,10 @@ def adapt_icon_urls(self, icon_urls: Optional[Dict]) -> "Decorator":
320329

321330
return self
322331

323-
def adapt_tokenization(self, tokenization: Optional[Dict]) -> "Decorator":
332+
def adapt_tokenization(
333+
self: "Decorator",
334+
tokenization: Optional[Dict],
335+
) -> "Decorator":
324336
"""
325337
Adapt the tokenization and update the dependencies.
326338
@@ -345,7 +357,7 @@ def adapt_tokenization(self, tokenization: Optional[Dict]) -> "Decorator":
345357
return self
346358

347359
def adapt_allowed_amount(
348-
self,
360+
self: "Decorator",
349361
allowed_amount: Optional[Dict],
350362
) -> "Decorator":
351363
"""
@@ -370,7 +382,7 @@ def adapt_allowed_amount(
370382
)
371383
return self
372384

373-
def get_dependencies(self) -> Dict[str, Any]:
385+
def get_dependencies(self: "Decorator") -> Dict[str, Any]:
374386
"""
375387
Get the current dependencies.
376388

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Listing(Generic[T], BaseModel):
2525
data: List[T]
2626

2727
def __init__(
28-
self,
28+
self: "Listing",
2929
data: List[Any],
3030
class_type: type,
3131
**kwargs: Dict[str, Any],
@@ -53,7 +53,7 @@ def __init__(
5353

5454
super().__init__(data=elements)
5555

56-
def __iter__(self):
56+
def __iter__(self: "Listing"):
5757
"""
5858
Return an iterator over the items in the listing.
5959
@@ -79,7 +79,7 @@ def __getitem__(self: "Listing", index: int) -> T:
7979
"""
8080
return self.data[index]
8181

82-
def __len__(self):
82+
def __len__(self: "Listing"):
8383
"""
8484
Get the number of items in the listing.
8585
@@ -90,7 +90,7 @@ def __len__(self):
9090
"""
9191
return len(self.data)
9292

93-
def get_data(self) -> List[T]:
93+
def get_data(self: "Listing") -> List[T]:
9494
"""
9595
Get the list of items in the listing.
9696
@@ -101,7 +101,7 @@ def get_data(self) -> List[T]:
101101
"""
102102
return self.data
103103

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

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

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

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

8+
from typing import Optional
9+
810
from multisafepay.api.base.listings.listing import Listing
911
from multisafepay.api.base.listings.pager import Pager
1012

@@ -19,23 +21,28 @@ class ListingPager(Listing):
1921
2022
"""
2123

22-
pager: Pager = None
24+
pager: Optional[Pager] = None
2325

24-
def __init__(self, data: list, pager: Pager, class_type: type):
26+
def __init__(
27+
self: "ListingPager",
28+
data: list,
29+
pager: Optional[Pager],
30+
class_type: type,
31+
):
2532
"""
2633
Initialize the ListingPager with data, pager, and class type.
2734
2835
Parameters
2936
----------
3037
data (list): A list of data to be converted into items of type T.
31-
pager (Pager): The pager object for pagination.
38+
pager (Optional[Pager]): The pager object for pagination.
3239
class_type (type): The class type to convert the data into.
3340
3441
"""
3542
super().__init__(data=data, class_type=class_type)
3643
self.pager = pager
3744

38-
def get_pager(self) -> Pager:
45+
def get_pager(self: "ListingPager") -> Optional[Pager]:
3946
"""
4047
Get the pager object.
4148

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def with_json(
6565
raw=json_data.__str__(),
6666
)
6767

68-
def get_body_data(self) -> Optional[Any]:
68+
def get_body_data(self: "ApiResponse") -> Optional[Any]:
6969
"""
7070
Get the data from the body of the response.
7171
@@ -76,7 +76,7 @@ def get_body_data(self) -> Optional[Any]:
7676
"""
7777
return self.body.get("data", None)
7878

79-
def get_body_success(self) -> Optional[bool]:
79+
def get_body_success(self: "ApiResponse") -> Optional[bool]:
8080
"""
8181
Get the success status from the body of the response.
8282
@@ -87,7 +87,7 @@ def get_body_success(self) -> Optional[bool]:
8787
"""
8888
return self.body.get("success", None)
8989

90-
def get_body_error_code(self) -> Optional[int]:
90+
def get_body_error_code(self: "ApiResponse") -> Optional[int]:
9191
"""
9292
Get the error code from the body of the response.
9393
@@ -98,7 +98,7 @@ def get_body_error_code(self) -> Optional[int]:
9898
"""
9999
return self.body.get("error_code", None)
100100

101-
def get_body_error_info(self) -> Optional[str]:
101+
def get_body_error_info(self: "ApiResponse") -> Optional[str]:
102102
"""
103103
Get the error information from the body of the response.
104104
@@ -109,7 +109,7 @@ def get_body_error_info(self) -> Optional[str]:
109109
"""
110110
return self.body.get("error_info", None)
111111

112-
def get_context(self) -> dict:
112+
def get_context(self: "ApiResponse") -> dict:
113113
"""
114114
Get the context of the response.
115115
@@ -120,7 +120,7 @@ def get_context(self) -> dict:
120120
"""
121121
return self.context
122122

123-
def get_headers(self) -> dict:
123+
def get_headers(self: "ApiResponse") -> dict:
124124
"""
125125
Get the headers of the response.
126126
@@ -131,7 +131,7 @@ def get_headers(self) -> dict:
131131
"""
132132
return self.headers
133133

134-
def get_status_code(self) -> int:
134+
def get_status_code(self: "ApiResponse") -> int:
135135
"""
136136
Get the status code of the response.
137137
@@ -142,7 +142,7 @@ def get_status_code(self) -> int:
142142
"""
143143
return self.status_code
144144

145-
def get_raw(self) -> str:
145+
def get_raw(self: "ApiResponse") -> str:
146146
"""
147147
Get the raw response data as a string.
148148
@@ -153,7 +153,7 @@ def get_raw(self) -> str:
153153
"""
154154
return self.raw
155155

156-
def get_pager(self) -> Optional[Pager]:
156+
def get_pager(self: "ApiResponse") -> Optional[Pager]:
157157
"""
158158
Get the pager object from the body of the response.
159159

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):
44+
def get_data(self: "CustomApiResponse"):
4545
"""
4646
Get the data contained in the response.
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self: "AuthManager", client: Client):
3333
"""
3434
super().__init__(client)
3535

36-
def get_api_token(self) -> CustomApiResponse:
36+
def get_api_token(self: "AuthManager") -> CustomApiResponse:
3737
"""
3838
Retrieve the API token.
3939

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self: "CaptureManager", client: Client):
3838
super().__init__(client)
3939

4040
def capture_reservation_cancel(
41-
self,
41+
self: "CaptureManager",
4242
order_id: str,
4343
capture_request: CaptureRequest,
4444
) -> CustomApiResponse:

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

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

0 commit comments

Comments
 (0)