KMS: Move Tagging Functionality into methods on the Provider#13595
KMS: Move Tagging Functionality into methods on the Provider#13595
Conversation
LocalStack Community integration with Pro 2 files 2 suites 5m 9s ⏱️ Results for commit 42cc595. ♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 17m 30s ⏱️ Results for commit 42cc595. ♻️ This comment has been updated with latest results. |
247c199 to
494a487
Compare
494a487 to
fa88094
Compare
fa88094 to
3d9bb51
Compare
| def _set_key_tags(self, key: KmsKey, account_id: str, region: str, tags: TagList) -> None: | ||
| return | ||
|
|
||
| def _remove_key_tags(self, key: KmsKey, account_id: str, region: str, tag_keys: TagKeyList): |
There was a problem hiding this comment.
| def _remove_key_tags(self, key: KmsKey, account_id: str, region: str, tag_keys: TagKeyList): | |
| def _remove_key_tags(self, key: KmsKey, account_id: str, region: str, tag_keys: TagKeyList) -> None: |
| if not (tag_keys := request.get("TagKeys", [])): | ||
| return |
There was a problem hiding this comment.
Don't use the walrus operator if you intend to use the variable outside the scope of the conditional block.
https://effectivepython.com/2020/02/02/prevent-repetition-with-assignment-expressions
It's not syntactically wrong, but defining the variable outside the conditional block implies that the var is used later.
| if not (tag_keys := request.get("TagKeys", [])): | |
| return | |
| tag_keys = request.get("TagKeys", []) | |
| if not tag_keys: | |
| return |
There was a problem hiding this comment.
Interesting, I have been using the walrus operator a lot in that way, TIL. That makes sense in a way!
Edit: I'm not seeing a mention against using the outside the conditional block, or did I miss it?
Edit2: found this as well: https://news.ycombinator.com/item?id=44584016, and people are generally confused by it, so makes sense! I'll try not to use that anymore 😄
786fc35 to
dd2d3ef
Compare
dd2d3ef to
42cc595
Compare
Changes
validate_tag_listto be reused.