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
| data "google_storage_bucket_object" "picture" { | |
| name = "folder/butterfly01.jpg" | |
| bucket = "image-store" | |
| } |
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
| locals { | |
| service_name = "forum" | |
| owner = "Community Team" | |
| } |
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
| module "consul" { | |
| source = "github.com/hashicorp/example" | |
| } |
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
| # This is the original function. | |
| def orig_func(a,b,c): | |
| """ | |
| This is the original function | |
| returns the product of a,b,c | |
| """ | |
| return (print('This is the product:',a*b*c)) |
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
| def decor_func(fn): | |
| def wrapper_func(*args,**kwargs): | |
| """ | |
| This is the wrapper function | |
| """ | |
| print('Execute this code before the main function is executed') | |
| return fn(*args, **kwargs) | |
| return wrapper_func |
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
| orig_func(7,9,11) |
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
| #Method:1 | |
| orig_func=decor_func(orig_func) | |
| # or | |
| #Method2 | |
| @decor_func | |
| def orig_func(a,b,c): | |
| """ | |
| returns the product of a,b,c |
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
| help(orig_func) |
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
| def decor_func(fn): | |
| def wrapper_func(*args,**kwargs): | |
| """ | |
| This is the wrapper function | |
| """ | |
| print('Execute this code before the main function is executed') | |
| return fn(*args, **kwargs) | |
| #Assign the original function name and the docstring to the wrapper name and doctstring. | |
| wrapper_func.__name__ = fn.__name__ |
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
| def decor_func(fn): | |
| @wraps(fn) | |
| def wrapper_func(*args,**kwargs): | |
| """ | |
| This is the wrapper function | |
| """ | |
| print('Execute this code before the main function is executed') | |
| return fn(*args, **kwargs) | |
| return wrapper_func |