Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DE-870] Fix union type imports in exception models #43

Merged
merged 2 commits into from
Jun 17, 2024
Merged

Conversation

maciej-nedza
Copy link
Contributor

@maciej-nedza maciej-nedza commented Jun 17, 2024

  • Fixed union type imports in exception models

Copy link

swarmia bot commented Jun 17, 2024

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range and nitpick comments (3)
advancedbilling/exceptions/customer_error_response_exception.py (1)

Line range hint 24-24: Use the modern Python super() syntax without parameters.

- super(CustomerErrorResponseException, self).__init__(reason, response)
+ super().__init__(reason, response)
advancedbilling/exceptions/subscription_group_create_error_response_exception.py (1)

Line range hint 24-24: Use the modern Python super() syntax without parameters.

- super(SubscriptionGroupCreateErrorResponseException, self).__init__(reason, response)
+ super().__init__(reason, response)
advancedbilling/controllers/base_controller.py (1)

Line range hint 16-16: Remove redundant inheritance from object.

- class BaseController(object):
+ class BaseController:
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6791546 and 44e988d.

Files selected for processing (5)
  • README.md (3 hunks)
  • advancedbilling/controllers/base_controller.py (1 hunks)
  • advancedbilling/exceptions/customer_error_response_exception.py (1 hunks)
  • advancedbilling/exceptions/subscription_group_create_error_response_exception.py (1 hunks)
  • pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • pyproject.toml
Additional context used
Ruff
advancedbilling/exceptions/customer_error_response_exception.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


24-24: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters

advancedbilling/exceptions/subscription_group_create_error_response_exception.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


24-24: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters

advancedbilling/controllers/base_controller.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


16-16: Class BaseController inherits from object (UP004)

Remove object inheritance

LanguageTool
README.md

[uncategorized] ~8-~8: If this is a compound adjective that modifies the following noun, use a hyphen. (EN_COMPOUND_ADJECTIVE_INTERNAL)
Context: ...d format, but XML is also provided as a backwards compatible option for Merchants who require it. #...


[uncategorized] ~101-~101: The Latin adjective/adverb “pro forma” is spelled as two words. (PRO_RATA)
Context: ...controllers/product-price-points.md) * [Proforma Invoices](https://www.github.com/maxio-...

Markdownlint
README.md

131-131: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


26-26: null (MD034, no-bare-urls)
Bare URL used


38-38: null (MD034, no-bare-urls)
Bare URL used


24-24: null (MD036, no-emphasis-as-heading)
Emphasis used instead of a heading


48-48: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


48-48: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


49-49: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


49-49: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style

Additional comments not posted (4)
advancedbilling/controllers/base_controller.py (1)

33-33: The version number has been correctly updated.

README.md (3)

34-34: The pip install command has been correctly updated to reflect the new version number.


38-38: The package link has been correctly updated to reflect the new version number.

Tools
Markdownlint

38-38: null (MD034, no-bare-urls)
Bare URL used


42-42: The documentation link has been correctly updated to reflect the new version number.

@maxio-com maxio-com deleted a comment from coderabbitai bot Jun 17, 2024
Copy link

coderabbitai bot commented Jun 17, 2024

Walkthrough

The changes encompass a minor version update of the maxio-advanced-billing-sdk from 3.0.0 to 3.0.1, reflected across various documentation and implementation files. Alongside this, new imports to handle error deserialization are introduced in specific exception classes, and additional test cases focusing on error handling have been added. The updates ensure consistency with the new version while enhancing error processing and validation tests.

Changes

File Change Summary
README.md Updated version number references from 3.0.0 to 3.0.1 in installation commands, package links, and documentation links
advancedbilling/controllers/base_controller.py Updated user_agent method to return 'AB SDK Python:3.0.1 on OS {os-info}' instead of 3.0.0
advancedbilling/exceptions/customer_error_response_exception.py Added UnionTypeLookUp import for error deserialization in the unbox method
advancedbilling/exceptions/subscription_group_create_error_response_exception.py Added UnionTypeLookUp import for error deserialization in the unbox method
pyproject.toml Updated version from 3.0.0 to 3.0.1
tests/test_customers.py Introduced a new test case test_invalid_customer_creation_throws_422_error
tests/test_invoices.py Adjusted indentation of assertions related to errors in an existing test case
tests/test_subscriptions.py Updated assertions for checking error messages to handle a list of errors instead of a single message

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (2)
advancedbilling/exceptions/customer_error_response_exception.py (2)

Line range hint 1-1: Remove the unnecessary UTF-8 encoding declaration, as Python files are UTF-8 encoded by default.

- # -*- coding: utf-8 -*-

Line range hint 24-24: Use super() without arguments for simplicity and clarity.

- super(CustomerErrorResponseException, self).__init__(reason, response)
+ super().__init__(reason, response)
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6791546 and d87e1c6.

Files selected for processing (8)
  • README.md (3 hunks)
  • advancedbilling/controllers/base_controller.py (1 hunks)
  • advancedbilling/exceptions/customer_error_response_exception.py (1 hunks)
  • advancedbilling/exceptions/subscription_group_create_error_response_exception.py (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/test_customers.py (1 hunks)
  • tests/test_invoices.py (1 hunks)
  • tests/test_subscriptions.py (2 hunks)
Files not reviewed due to errors (2)
  • advancedbilling/exceptions/subscription_group_create_error_response_exception.py (no review received)
  • advancedbilling/controllers/base_controller.py (no review received)
Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
Additional context used
Ruff
advancedbilling/exceptions/customer_error_response_exception.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


24-24: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters

advancedbilling/exceptions/subscription_group_create_error_response_exception.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


24-24: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters

advancedbilling/controllers/base_controller.py

1-1: UTF-8 encoding declaration is unnecessary (UP009)

Remove unnecessary coding comment


16-16: Class BaseController inherits from object (UP004)

Remove object inheritance

tests/test_subscriptions.py

106-106: Replace unpacked list comprehension with a generator expression (UP027)

Replace with generator expression

LanguageTool
README.md

[uncategorized] ~8-~8: If this is a compound adjective that modifies the following noun, use a hyphen. (EN_COMPOUND_ADJECTIVE_INTERNAL)
Context: ...d format, but XML is also provided as a backwards compatible option for Merchants who require it. #...


[uncategorized] ~101-~101: The Latin adjective/adverb “pro forma” is spelled as two words. (PRO_RATA)
Context: ...controllers/product-price-points.md) * [Proforma Invoices](https://www.github.com/maxio-...

Markdownlint
README.md

131-131: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


26-26: null (MD034, no-bare-urls)
Bare URL used


38-38: null (MD034, no-bare-urls)
Bare URL used


24-24: null (MD036, no-emphasis-as-heading)
Emphasis used instead of a heading


48-48: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


48-48: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


49-49: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style


49-49: Expected: underscore; Actual: asterisk (MD049, emphasis-style)
Emphasis style

Additional comments not posted (11)
tests/test_customers.py (1)

10-22: The test method test_invalid_customer_creation_throws_422_error is well-structured and effectively checks for the correct error response when an invalid customer creation is attempted.

README.md (7)

34-34: Updated version number reflects the new SDK version.


38-38: Correctly updated package link.

Tools
Markdownlint

38-38: null (MD034, no-bare-urls)
Bare URL used


42-42: Documentation link correctly updated to the new version.


59-59: Updated documentation link for Basic Authentication.


89-89: Updated Basic Authentication link.


93-123: All API controller links updated to reflect the new version.

Tools
LanguageTool

[uncategorized] ~101-~101: The Latin adjective/adverb “pro forma” is spelled as two words. (PRO_RATA)
Context: ...controllers/product-price-points.md) * [Proforma Invoices](https://www.github.com/maxio-...


127-129: Utility classes and HTTP request/response documentation links correctly updated.

tests/test_subscriptions.py (2)

144-145: Properly checks for the specific error code and message when a customer does not exist.


162-162: Correctly asserts the response code for unauthorized access.

tests/test_invoices.py (1)

247-251: Correctly handles the error scenario when the end period is less than the start period.

@maciej-nedza maciej-nedza merged commit fe41131 into main Jun 17, 2024
1 check passed
@maciej-nedza maciej-nedza deleted the publish branch June 17, 2024 13:39
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.

3 participants