Last active
January 29, 2021 06:46
Revisions
-
bala-codes revised this gist
Jan 29, 2021 . 1 changed file with 16 additions and 16 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def inference(name="", tag = True): attribute = str(datetime.now().strftime('%m-%d-%Y')) response = "You license has been expired, please contact us." year_to_expire = int(2022) try: assert int(attribute.split('-')[-1]) == year_to_expire, response @@ -28,19 +28,19 @@ def inference(name="", tag = True): else: return False if __name__ == "__main__": _ = inference(name="Bala") ''' Function outputs, Case 1: if year_to_expire = int(2021) Hello Bala, the inference function has been successfully started inference function has been completed successfully [Finished in 0.2s] Case 2: if year_to_expire = int(2022) Hello Bala, the inference function has been successfully started You license has been expired, please contact us. [Finished in 0.2s] ''' -
bala-codes revised this gist
Jan 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def inference(name="", tag = True): attribute = str(datetime.now().strftime('%m-%d-%Y')) response = "You license has been expired, please contact us." year_to_expire = int(2021) # int(2022) try: assert int(attribute.split('-')[-1]) == year_to_expire, response -
bala-codes revised this gist
Jan 29, 2021 . 1 changed file with 18 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,15 +11,17 @@ def inference(name="", tag = True): attribute = str(datetime.now().strftime('%m-%d-%Y')) response = "You license has been expired, please contact us." year_to_expire = int(2022) try: assert int(attribute.split('-')[-1]) == year_to_expire, response except AssertionError as e: print(response) sys.exit() # Replace your main code to operate here. # if the above assertion is True, it will reach until this point, otherwise it will stop in the previous line. if tag: print("inference function has been completed successfully") return True @@ -28,3 +30,17 @@ def inference(name="", tag = True): _ = inference(name="Bala") ''' Function outputs, Case 1: if year_to_expire = int(2021) Hello Bala, the inference function has been successfully started inference function has been completed successfully [Finished in 0.2s] Case 2: if year_to_expire = int(2022) Hello Bala, the inference function has been successfully started You license has been expired, please contact us. [Finished in 0.2s] ''' -
bala-codes created this gist
Jan 29, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ import os, json, sys from datetime import datetime def inference(name="", tag = True): ''' if the current year is 2021, then inference function will run successfully, otherwise fails. Here the attribute variable holds the string version of the date in MM-DD-YYYY format ''' print("Hello {}, the inference function has been successfully started".format(name)) attribute = str(datetime.now().strftime('%m-%d-%Y')) response = "You license has been expired, please contact us." try: assert int(attribute.split('-')[-1]) == 2022, response except AssertionError as e: print(response) sys.exit() # Replace your main code to operate here. # if the above assertion is True, it will reach until this point, otherwise it will stop in the previous line. if tag: print("inference function has been completed successfully") return True else: return False _ = inference(name="Bala")