-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
⚡ decode returns dict[str, Any]
instead of dict
#4
Conversation
WalkthroughThe updates focus on refining type annotations and ensuring dictionary keys are treated as strings in the Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4 +/- ##
=======================================
Coverage 96.75% 96.75%
=======================================
Files 16 16
Lines 709 709
=======================================
Hits 686 686
Misses 23 23 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- README.rst (4 hunks)
- docs/README.rst (4 hunks)
- src/qs_codec/decode.py (5 hunks)
- src/qs_codec/utils/utils.py (4 hunks)
- tests/unit/decode_test.py (8 hunks)
- tests/unit/example_test.py (1 hunks)
- tests/unit/utils_test.py (3 hunks)
Files skipped from review due to trivial changes (1)
- tests/unit/example_test.py
Additional comments not posted (19)
src/qs_codec/decode.py (5)
17-19
: Updated function signature tot.Dict[str, t.Any]
aligns with the PR's objective to ensure all dictionary keys are strings.
25-25
: Initialization ofobj
with typet.Dict[str, t.Any]
is consistent with the new function signature.
28-28
: Proper handling of empty input values by returning an empty dictionary.
57-57
: Parsing logic in_parse_query_string_values
appears robust and handles various encoding scenarios.
Line range hint
127-161
: Complex parsing logic in_parse_object
handles nested structures and list indexing correctly.src/qs_codec/utils/utils.py (3)
18-21
: Updated type hints inmerge
method to ensure dictionary keys are treated as strings, aligning with PR objectives.
63-63
: Handling of list and tuple sources inmerge
method ensures that indices are treated as string keys, which is crucial for consistency.Also applies to: 75-75
104-104
: Implementation ofcompact
method effectively removesUndefined
values from dictionaries, maintaining data integrity.tests/unit/utils_test.py (3)
424-424
: Updated test case correctly reflects the change in handling dictionary keys as strings.
453-453
: Test case update correctly reflects the handling of dictionary keys as strings in complex structures.
465-471
: Test case update ensures that dictionary keys are treated as strings, aligning with the changes made in the utility functions.docs/README.rst (5)
14-14
: Updated function signature in documentation aligns with the new return type.
306-306
: Example correctly demonstrates handling of list indices beyond the specified limit.
318-318
: Example correctly demonstrates the effect of setting the list limit to 0.
330-330
: Example correctly demonstrates the effect of disabling list parsing.
338-338
: Example correctly demonstrates the merging behavior when mixing list and dictionary notations.tests/unit/decode_test.py (2)
21-21
: Ensure the test cases reflect the updated type annotations in thedecode
function.Verification successful
The search did not return any occurrences of the old type annotations in
decode_test.py
. This suggests that the test cases have been updated to reflect the new type annotations.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the test cases in `decode_test.py` are updated to reflect the new type annotations. # Test: Search for the function usage with old type annotations. Expect: No occurrences of the old type. rg --type python $'decode(encoded: str, options: DecodeOptions = None) -> t.Mapping' tests/unit/decode_test.pyLength of output: 142
Script:
#!/bin/bash # Description: Verify that the test cases in `decode_test.py` are updated to reflect the new type annotations. # Test: Search for the function usage with old type annotations. Expect: No occurrences of the old type. rg 'decode(encoded: str, options: DecodeOptions = None) -> t.Mapping' tests/unit/decode_test.pyLength of output: 97
192-192
: The changes in these lines are consistent with the PR's objective to handle dictionary keys as strings and improve the handling of list indices and dictionary transformations.Also applies to: 197-197, 199-199, 220-224, 248-252, 259-259, 310-311, 336-341, 344-345, 489-489, 536-537, 539-539
README.rst (1)
40-40
: The update in the function signature correctly reflects the new return type ast.Dict[str, t.Any]
, aligning with the PR's objectives.
## 0.2.2 - #4 - fix decoding encoded square brackets in key names
Description
decode
now returnsdict[str, Any]
instead ofdict
.NOTE: This means that all decoded
dict
keys will now bestr
ings.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
The tests have been updated to reflect the change.
Checklist:
Summary by CodeRabbit
Documentation
Bug Fixes
Tests
Refactor