Skip to content

Conversation

@zulquer
Copy link
Collaborator

@zulquer zulquer commented May 5, 2025

This pull request includes several updates to improve type annotations, ensure compatibility with older Python versions, and enhance the maintainability of the codebase. The changes primarily focus on replacing modern type hinting syntax with imports from typing, adding type annotations to method parameters, and introducing missing imports for consistency.

Type Hinting Updates:

  • Replaced modern type hinting syntax (e.g., list[...]) with List[...] from typing across various files for compatibility with older Python versions. Examples include get_categories.py [1] listings.py [2] and checkout_data.py [3].

Type Annotation Enhancements:

  • Added type annotations to method parameters and return types, such as specifying client: Client in manager classes (AuthManager, CaptureManager, etc.) and adding types like int and str to method parameters in checkout_data.py [1] [2] [3].

Import Adjustments:

  • Introduced missing imports for Client in various manager files to ensure consistency and clarity, such as auth_manager.py [1] and category_manager.py [2].

Code Cleanup:

  • Removed unnecessary blank lines and redundant ignored type-checking rules in pyproject.toml to streamline the configuration [1] [2].

Documentation Updates:

  • Updated docstrings to reflect the new type annotations, ensuring that parameter and return type descriptions align with the updated code (e.g., checkout_data.py methods like add_items and refund_by_merchant_item_id) [1] [2].

@zulquer zulquer requested a review from danielcivit May 5, 2025 14:00
@codecov
Copy link

codecov bot commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.75%. Comparing base (81c0626) to head (64354bf).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
+ Coverage   90.71%   90.75%   +0.04%     
==========================================
  Files         106      106              
  Lines        2293     2305      +12     
==========================================
+ Hits         2080     2092      +12     
  Misses        213      213              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zulquer zulquer force-pushed the PTHMINT-38 branch 4 times, most recently from fa47fd0 to c5b8a7d Compare May 6, 2025 09:02
@zulquer zulquer removed the request for review from danielcivit May 6, 2025 09:35
@zulquer zulquer force-pushed the PTHMINT-38 branch 2 times, most recently from dce9f7b to 6041612 Compare May 6, 2025 09:47
@zulquer zulquer requested a review from Copilot May 6, 2025 10:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request improves type annotations for enhanced compatibility with older Python versions, refactors function signatures for clarity, and updates necessary imports across the codebase.

  • Updated type hints from modern syntaxes (e.g., list[...]) to List[...] in multiple files
  • Enhanced type annotations on method parameters and return types
  • Removed outdated ignore rules in configuration to enforce proper type checking

Reviewed Changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/multisafepay/api/paths/payment_methods/response/payment_method.py Updated type annotations for allowed countries, currencies, and brands
src/multisafepay/api/paths/payment_methods/payment_method_manager.py Added type annotations and updated import for Client, but noted a docstring inconsistency
src/multisafepay/api/paths/orders/* Updated type annotations in order-related models and managers
src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py Added type annotations and adjusted default parameters for collection methods
Other files (e.g., category_manager, gateway_manager, etc.) Introduced missing Client type annotations and improved documentation accordingly
pyproject.toml, examples/* Updated type hinting imports and cleaned configuration
Comments suppressed due to low confidence (1)

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

  • The docstring incorrectly refers to 'CaptureManager' instead of 'PaymentMethodManager'. Please update the docstring to accurately reflect the class name.
    def __init__(self, client: Client):

allowed_countries (Optional[list[str]]): The allowed countries for the payment method.
allowed_currencies (Optional[list[str]]): The allowed currencies for the payment method.
allowed_countries (Optional[List[str]]): The allowed countries for the payment method.
allowed_currencies (OptionalList[str]]): The allowed currencies for the payment method.
Copy link

Copilot AI May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a typo in the type annotation for allowed_currencies. It should likely be 'Optional[List[str]]' instead of 'OptionalList[str]]'.

Suggested change
allowed_currencies (OptionalList[str]]): The allowed currencies for the payment method.
allowed_currencies (Optional[List[str]]): The allowed currencies for the payment method.

Copilot uses AI. Check for mistakes.
@zulquer zulquer merged commit accf037 into master May 6, 2025
7 checks passed
@zulquer zulquer deleted the PTHMINT-38 branch May 6, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants