Skip to content

V2.1.2 more bug fixes #47

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

Merged
merged 6 commits into from
May 20, 2025
Merged

V2.1.2 more bug fixes #47

merged 6 commits into from
May 20, 2025

Conversation

Deconstrained
Copy link
Collaborator

This fixes #45 and #46.

  • Update try_decoding to return None for empty input, and add a unit test where previously there was none.
  • Update iter_cursor to respect the client default and accept a page_size keyword argument similar to iter_all. Moreover, the similarly-named arguments from iter_all are passed through to it when calling out to it for cursor-based iteration endpoints.

@Deconstrained Deconstrained force-pushed the v2.1.2-more-bug-fixes branch from dcb149c to 1752822 Compare May 19, 2025 22:33
@Deconstrained Deconstrained force-pushed the v2.1.2-more-bug-fixes branch 2 times, most recently from a79577c to 3334790 Compare May 19, 2025 22:37
@Deconstrained Deconstrained force-pushed the v2.1.2-more-bug-fixes branch from 3334790 to f943e7a Compare May 19, 2025 22:40
@Deconstrained Deconstrained requested a review from Copilot May 19, 2025 22:55
Copy link
Contributor

@Copilot 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

Updates in this PR address two bugs: ensuring that try_decoding returns None for empty input and enhancing iter_cursor (and indirectly iter_all) to support a page_size keyword argument. Other changes include adding appropriate tests and updating documentation and version numbers.

  • Updated tests to pass page_size to iter_all and verify iter_cursor behavior.
  • Modified iter_all and iter_cursor in the API client to support page_size and updated try_decoding for empty responses.
  • Updated documentation, changelog, and versioning details accordingly.

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/rest_api_v2_client_test.py Updated tests to pass and verify page_size parameter and iter_cursor invocation.
tests/mocks.py Added handling for JSONDecodeError in JSON mocking.
tests/common_test.py Added unit tests for try_decoding with empty and invalid JSON responses.
pyproject.toml Bumped version from 2.1.1 to 2.1.2.
pagerduty/rest_api_v2_client.py Enhanced iter_all and iter_cursor to accept page_size and pass item_hook.
pagerduty/common.py Updated try_decoding to catch JSONDecodeError and return None when appropriate.
docs/* Updated version strings and changelog entries to reflect new changes.
README.rst & CHANGELOG.rst Revised documentation to match the updated CLI and API behaviors.
Comments suppressed due to low confidence (2)

pagerduty/rest_api_v2_client.py:1013

  • The variable 'total' is referenced here but does not appear to be defined anywhere. Consider either removing it or adding it as a parameter if its behavior is intended.
data = { 'limit': (self.default_page_size, page_size)[int(bool(page_size))], 'total': int(bool(total)) }

pagerduty/rest_api_v2_client.py:1013

  • [nitpick] Using an indexed tuple for assigning 'limit' may be less readable than a clear conditional expression. Consider rewriting it as: 'limit': page_size if page_size is not None else self.default_page_size.
data = { 'limit': (self.default_page_size, page_size)[int(bool(page_size))], ... }

- Changes to pyproject.toml trigger rebuild
- Module build happens first, which is necessary to include the version bump in the doc rebuild
@Deconstrained Deconstrained merged commit 28a8850 into main May 20, 2025
13 checks passed
@Deconstrained Deconstrained deleted the v2.1.2-more-bug-fixes branch June 4, 2025 19:23
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.

iter_all does not pass args thru when short-circuiting to iter_cursor (also, iter_cursor does not use the client's page size configuration)
1 participant