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

chore: Use TypeGuard to avoid unncessary type casts #3090

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

aahung
Copy link
Contributor

@aahung aahung commented Apr 5, 2023

Issue #, if available

Description of changes

This change will get rid of str() casting without these errors:

samtranslator/model/connector/connector.py:151: error: Argument 2 to "_get_resource_arn" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
samtranslator/model/connector/connector.py:153: error: Argument 3 to "_get_resource_role_name" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
samtranslator/model/connector/connector.py:155: error: Argument 2 to "_get_resource_queue_url" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
samtranslator/model/connector/connector.py:157: error: Argument 2 to "_get_resource_id" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
samtranslator/model/connector/connector.py:159: error: Argument 2 to "_get_resource_name" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
samtranslator/model/connector/connector.py:161: error: Argument 1 to "_get_resource_qualifier" has incompatible type "Optional[Any]"; expected "str"  [arg-type]
Found 6 errors in 1 file (checked 159 source files)

Description of how you validated changes

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through aws/aws-sam-cli-app-templates.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aahung aahung requested a review from GavinZZ April 5, 2023 22:17
@aahung aahung marked this pull request as ready for review April 5, 2023 22:17
@aahung aahung requested a review from a team as a code owner April 5, 2023 22:17
@aahung aahung enabled auto-merge (squash) April 5, 2023 22:17
@aahung aahung merged commit 270de45 into aws:develop Apr 5, 2023
@aahung aahung deleted the type-guard branch April 5, 2023 22:26
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.

None yet

3 participants