(MODULES-905) Add bool2str() and camelcase() for string manipulation#255
Merged
apenney merged 2 commits intopuppetlabs:masterfrom May 15, 2014
mckern:enhancement/master/camelcasedembools
Merged
(MODULES-905) Add bool2str() and camelcase() for string manipulation#255apenney merged 2 commits intopuppetlabs:masterfrom mckern:enhancement/master/camelcasedembools
apenney merged 2 commits intopuppetlabs:masterfrom
mckern:enhancement/master/camelcasedembools
Conversation
Python likes to have its constants Capitalized, and the capitalize function only understands strings... so I shave a yak. bool2str will convert a boolean to its equivalent string value, and camelcase extends on uppercase & downcase to convert an underscore delimited string into a camelcased string.
Contributor
Author
|
I don't know if I made intent clear here, but the need for these was that I've got to edit/interpolate values into a decent amount of Python configuration files (specifically for tools like mock and createrepo). Python loves it some CamelCasing (they call them StudlyWords!), and the ability to coerce strings into that format natively (without having to munge them in templates) would be very useful. |
apenney
pushed a commit
that referenced
this pull request
May 15, 2014
(MODULES-905) Add bool2str() and camelcase() for string manipulation
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.
Python likes to have its constants Capitalized, and the capitalize function only understands strings... so I shave a yak.
bool2str()will convert a boolean to its equivalent string value, andcamelcase()extends on the functionality provided byuppercase()&downcase()to convert an underscore-delimited string into a camelcased string.I also added spec tests for these new functions.