remove deprecated stringcase dependency#114
Merged
Merged
Conversation
luandy64
reviewed
Jan 8, 2025
| return (string[0]).lower() + re.sub(r"[A-Z]", lambda matched: '_' + (matched.group(0)).lower(), string[1:]) | ||
|
|
||
| def pascalcase(string): | ||
| string = snakecase(string) |
There was a problem hiding this comment.
Two passes over string seems a little wasteful.
If you add a new function to do the word splitting, then you can reuse it in snakecase and pascalcase.
def make_words(string):
pass
def snakecase(string):
return "_".join(word.lower() for word in make_words(string))
def pascalcase(string):
return "".join(word.title() for word in make_words(string))
Contributor
Author
There was a problem hiding this comment.
I was trying to keep all the functionality of the old library, which gets a little tricky with one pass over splitting. However, the use case in the tap is only for CamelCase hardcoded stream names to snake_case and back. I'll update the function to something simpler that fits that case.
luandy64
approved these changes
Jan 8, 2025
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.
Description of change
removes the stringcase library and replaces used functions.
Manual QA steps
Risks
pascalcasefunction is buggy for some edge cases. We opted to create a new implementation to transform strings into pascalcase. Wherepascalcasefunction is used in the code, it is always transforming a snakecase stream name into a pascalcase stream name. If a stream name changed to something weird, the old implementation in stringcase might have transformed it differently than the new one. However, the stream names are hard coded so I don't see this being an issue.Rollback steps
AI generated code
https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code