Skip to content

Commit c5b8a7d

Browse files
committed
PTHMINT-38: Fix ruff problems code ANN001
1 parent 81c0626 commit c5b8a7d

File tree

58 files changed

+143
-170
lines changed

Some content is hidden

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

58 files changed

+143
-170
lines changed

examples/category_manager/get_categories.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from typing import List
23

34
from dotenv import load_dotenv
45

@@ -27,6 +28,6 @@
2728
# print(get_categories_response)
2829

2930
# Print the API response containing the categories
30-
categories: list[Category] = get_categories_response.get_data()
31+
categories: List[Category] = get_categories_response.get_data()
3132

3233
print(categories)

examples/gateway_manager/get_gateways.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from typing import List
23

34
from dotenv import load_dotenv
45

@@ -28,6 +29,6 @@
2829
# print(get_gateways_response)
2930

3031
# Extract the listing of gateways from the response
31-
gatewayListing: list[Gateway] = get_gateways_response.get_data()
32+
gatewayListing: List[Gateway] = get_gateways_response.get_data()
3233

3334
print(gatewayListing)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ extend-safe-fixes = [
9999
]
100100
ignore = [
101101
"ANN001",
102+
"A002",
102103
"ANN003",
103104
"ANN101", # missing type annotation for self
104105
"ANN102", # missing type annotation for cls

src/multisafepay/api/base/abstract_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

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

8+
89
from multisafepay.client.client import Client
910

1011

src/multisafepay/api/base/decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def adapt_brands(
281281
282282
Parameters
283283
----------
284-
brands (Optional[list[Optional[dict]]]): A list of dictionaries containing brand information, by default None.
284+
brands (Optional[List[Optional[dict]]]): A list of dictionaries containing brand information, by default None.
285285
286286
Returns
287287
-------

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, data: List[Any], class_type: type, **kwargs):
3030
3131
Parameters
3232
----------
33-
data (list[Any]): A list of data to be converted into items of type T.
33+
data (List[Any]): A list of data to be converted into items of type T.
3434
class_type (type): The class type to convert the data into.
3535
**kwargs: Additional keyword arguments to pass to the class type constructor.
3636
@@ -59,7 +59,7 @@ def __iter__(self):
5959
"""
6060
return iter(self.data)
6161

62-
def __getitem__(self, index):
62+
def __getitem__(self: "Listing", index: int) -> T:
6363
"""
6464
Get an item by index.
6565

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CustomApiResponse(ApiResponse):
2222

2323
data: Optional[Any]
2424

25-
def __init__(self, data, **kwargs):
25+
def __init__(self: "CustomApiResponse", data: Optional[Any], **kwargs):
2626
"""
2727
Initialize the CustomApiResponse with optional data and additional keyword arguments.
2828

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
CustomApiResponse,
1313
)
1414
from multisafepay.api.paths.auth.api_token.response.api_token import ApiToken
15+
from multisafepay.client.client import Client
1516
from multisafepay.util.dict_utils import dict_empty
1617
from multisafepay.util.message import MessageList, gen_could_not_created_msg
1718

@@ -21,13 +22,13 @@ class AuthManager(AbstractManager):
2122
A manager class for handling authentication-related operations.
2223
"""
2324

24-
def __init__(self, client):
25+
def __init__(self: "AuthManager", client: Client):
2526
"""
2627
Initialize the CaptureManager with a client.
2728
2829
Parameters
2930
----------
30-
client: The client used to make API requests.
31+
client (Client): The client used to make API requests.
3132
3233
"""
3334
super().__init__(client)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
CaptureRequest,
1717
)
1818
from multisafepay.api.paths.capture.response.capture import CancelReservation
19+
from multisafepay.client.client import Client
1920
from multisafepay.util.dict_utils import dict_empty
2021
from multisafepay.util.message import MessageList, gen_could_not_created_msg
2122

@@ -25,13 +26,13 @@ class CaptureManager(AbstractManager):
2526
A class to manage capture operations.
2627
"""
2728

28-
def __init__(self, client):
29+
def __init__(self: "CaptureManager", client: Client):
2930
"""
3031
Initialize the CaptureManager with a client.
3132
3233
Parameters
3334
----------
34-
client: The client used to make API requests.
35+
client (Client): The client used to make API requests.
3536
3637
"""
3738
super().__init__(client)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
CustomApiResponse,
1212
)
1313
from multisafepay.api.paths.categories.response.category import Category
14+
from multisafepay.client.client import Client
1415
from multisafepay.util.message import MessageList, gen_could_not_created_msg
1516

1617

@@ -19,13 +20,13 @@ class CategoryManager(AbstractManager):
1920
A manager class for handling category-related API requests.
2021
"""
2122

22-
def __init__(self, client):
23+
def __init__(self: "CategoryManager", client: Client):
2324
"""
2425
Initialize the CategoryManager with a client.
2526
2627
Parameters
2728
----------
28-
client: The client used to make API requests.
29+
client (Client): The client used to make API requests.
2930
3031
"""
3132
super().__init__(client)

0 commit comments

Comments
 (0)