aws-cloudformation-templates
aws-cloudformation-templates copied to clipboard
Upper function is not there
I believe the code is missing functions of upper, title and swapcase python functions. Please have a look and correct this.
Regards, bogdan
These functions are covered by this piece of code:
no_param_string_funcs = ["Upper", "Lower", "Capitalize", "Title", "SwapCase"]
if operation in no_param_string_funcs:
response["fragment"] = getattr(input, operation.lower())()
This takes the function name, makes it lower case, then uses the built-in Python method to run the method of the same name.
Let's step through it with "Upper":
if operation in no_param_string_funcs:
is "Upper" in the list of functions? Yes
Then let's break this line down:
response["fragment"] = getattr(input, operation.lower())()
operation.lower(): change "Upper" to "upper"
response["fragment"] = getattr(input, "upper")()
getattr(input, "upper"): get theuppermethod of thestrtype for theinputobject
response["fragment"] = input.upper()
- Call
upper()oninputand set the response to that.