-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for tuples in get_attr #3302
Conversation
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.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3302 +/- ##
========================================
Coverage 93.18% 93.19%
========================================
Files 66 66
Lines 14345 14376 +31
========================================
+ Hits 13367 13397 +30
- Misses 978 979 +1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
* release-1.35.67: Bumping version to 1.35.67 Update endpoints model Update to latest models Add support for tuples in get_attr (#3302) changes a variable name from is_opt_in_region to is_opt_in_region_redirect this fix addresses the issue of only checking for GetObject during IllegalLocationConstraintException error during region-redirect removes a duplicate unit test This change fixes region redirect issues for opt-in regions
The get_attr function is intended to be able to support an input with a path such as
[0]
and a value of['foo']
and parse out the fist index of the value to getfoo
as the result.Without the change in this PR, the such an input will not match the indexing regex, and instead it will reach the else statement and reach the code intended to access dictionary indexes. This will fail with a type error, so this PR updates the regex to properly reach the part of the code that handles indexes without a word string before them.
That code still fails for the same input; it assumes that it is getting the index of a list from a dictionary, so it attempts to call
.get()
on the base input. This will not work if the input value is not a dictionary, so we need to add the conditional to only call.get()
if there is a string before the first open bracket in the part of the path that we are parsing.Finally, this code can't be reached currently with a list due to how we memoize input parameters to endpoints; all parameter types have to be hash-able. While this function could theoretically get called with a list as input from another context, this is a private interface and it is only internally called from the endpoint provider. Because of this, I've updated the docblock to specify
tuple
as the input type instead oflist
.