Repository navigation
feat(sdk/python): normalize names to avoid escape hatch for reserved keywords - #8014
Merged
Merged
Conversation
helderco
force-pushed
the
sdk/python/normalize-names
branch
2 times, most recently
from
July 23, 2024 14:29
a8e515d to
6febbd7
Compare
helderco
force-pushed
the
sdk/python/normalize-names
branch
2 times, most recently
from
July 24, 2024 10:37
979e68d to
aa8c55f
Compare
…erride Name overrides were created as an escape hatch to allow using function, attribute, and parameter names that conflict with Python reserved words. Since the convention in these cases is to add an underscore to the end, we can remove it automatically when registering the name with Dagger. This avoids the need to override the name in a way that's not documented. This applies to names that only have a single underscore in the end, so we don't make too many assumptions about what's intended. The escape hatch is still available for now in any case, but might get deprecated at some point, because not all SDKs have it. Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
helderco
force-pushed
the
sdk/python/normalize-names
branch
from
July 25, 2024 09:12
aa8c55f to
4f16802
Compare
sipsma
approved these changes
Jul 25, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
Name overrides were created as an escape hatch to allow using function, attribute, and parameter names that conflict with Python reserved words:
After
Since the convention in these cases is to add an underscore to the end, we can remove it automatically when registering the name with Dagger:
This avoids the need to override the name in a way that's not documented.
It applies to names that only have a single underscore in the end, so we don't make too many assumptions about what's intended. The escape hatch is still available for now in any case, but might get deprecated at some point, because not all SDKs have it.