def main(): greet() args = parseargs() f_kav_log = args.log if not os.path.exists(f_kav_log): print("[i] The\"{}\" is not existed.\n".format(f_kav_log)) read_log(f_kav_log)
def main(): greet() args = parseargs() f_pe = args.file print(f_pe) if not is_pe(f_pe): print("[!] It is not a PE file.") else: print("It is a PE file") printable = set(string.printable) print(printable) print(len(printable)) extract_string(f_pe)
def main(): if DEPLOY == 'heroku': ip_address = request.headers['X-Forwarded-For'] else: ip_address = get_ip_address() return greet(ip_address)
def main(): list_folder = [] # List of folders in the malware repo _count = [] p = Pool(N_WORKER) greet() args = parseargs() with open(FILE_LIST_FOLDER, "r") as f: list_folder = f.readlines() list_folder = [ os.path.abspath(DIR_SHA256 + x.strip()) + "/" for x in list_folder ] n = 0 if args.type == "json": _count = p.map(worker_json, list_folder) elif args.type == "sha256": _count = p.map(worker_sha256, list_folder) print("{} md5 files are created.".format(sum(_count)))
def test_greet(): assert greet('english') == 'Welcome' assert greet('dutch') == 'Welkom' assert greet('IP_ADDRESS_INVALID') == 'Welcome' assert greet('finnish') == 'Tervetuloa' assert greet('') == 'Welcome' assert greet(2) == 'Welcome'
def main(argv=[]): arguments = argv[1:] or sys.argv[1:] opts, args = getopt(arguments, 'n:', ['name=']) name = None for option, value in opts: if option in ('-n', '--name'): name = value if args: name = args[0] if not name: echo(USAGE) return 1 message = greet(name) echo(message) return 0
def test_rand(self): from random import randint, choice def randgen_sent(): rand = randint(10, 50) base = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?.,' sent = ''.join(choice(base) for i in range(rand)) print(sent) return sent actual = lambda s: "Hello, {} how are you doing today?".format(s) for _ in range(100): string = randgen_sent() expected = actual(string) self.assertEqual(greet(string), expected)
def main(argv=[]): arguments = argv[1:] or sys.argv[1:] try: names = list() opts, args = getopt(arguments, 'n:', ['name=']) for option, value in opts: if option in ('-n', '--name'): names.append(value) for arg in args: names.append(arg) except GetoptError: pass if not names: echo(USAGE) return 1 message = greet(",".join(names)) echo(message) return 0
def test_rand(self): from random import randint sol = lambda l: { 'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso' }.get(l, 'Welcome') base = [ 'english', 'czech', 'IP_ADDRESS_INVALID', 'danish', 'IP_ADDRESS_NOT_FOUND', 'dutch', 'estonian', 'IP_ADDRESS_NOT_FOUND', 'finnish', 'flemish', 'french', 'german', 'irish', 'italian', 'IP_ADDRESS_REQUIRED', 'latvian', 'IP_ADDRESS_REQUIRED', 'lithuanian', 'polish', 'IP_ADDRESS_NOT_FOUND', 'spanish', 'swedish', 'IP_ADDRESS_NOT_FOUND', 'welsh', 'IP_ADDRESS_NOT_FOUND', 'IP_ADDRESS_INVALID' ] for _ in range(40): l = base[randint(0, len(base) - 1)] self.assertEqual(greet(l), sol(l), "It should work for random inputs too")
# from calculator import (addition, # subtraction, # multiplication, # division) from calculator import (addition as add, subtraction as sub, multiplication as mul, division as div) from calculator import * from greet import greet num1 = 10 num2 = 20 print( add(num1, num2), sub(num1, num2), mul(num1, num2), div(num1, num2), sep='\n' ) print( greet("Makku") )
def main(): greet.greet('Sarang')
def test_greet_multiple(self): self.assertEqual(greet(['Amy', 'Brian', 'Charlotte']), 'Hello, Amy, Brian, and Charlotte.')
def test_many(self): self.assertEqual(greet(["Spock", "Bones"]), "Hello, Spock and Bones.")
def niam(args): return greet(args)
def main(): greet.greet('World')
def test_greet(): assert greet(name="Tucker") == "Hello, Tucker!"
from greet import greet print greet('GitHub')
def test_null_name(self): self.assertEqual(greet(None), 'Hello, my friend.')
def test_greet(self): self.assertEqual(greet('Bob'), 'Hello, Bob.')
def test_intentional_comma(self): self.assertEqual(greet(['Bob', '"Charlie, Dianne"']), 'Hello, Bob and Charlie, Dianne.')
def test_split_comma(self): self.assertEqual(greet(['Bob', 'Charlie, Dianne']), 'Hello, Bob, Charlie, and Dianne.')
def test_mix_shouting(self): self.assertEqual(greet(['Amy', 'BRIAN', 'Charlotte']), 'Hello, Amy and Charlotte. AND HELLO BRIAN!')
def test_greet_john(self): result = greet("John") self.assertEqual("Hi John!", result)
def test(self): self.assertEqual(greet('english'), 'Welcome') self.assertEqual(greet('dutch'), 'Welkom') self.assertEqual(greet('IP_ADDRESS_INVALID'), 'Welcome') self.assertEqual(greet(''), 'Welcome') self.assertEqual(greet(2), 'Welcome')
def test_greet_jack(self): result = greet("Jack") self.assertEqual("Hi Jack!", result)
import greet if __name__ == "__main__": print("running main function") greet.greet("John Doe") greet.print_version()
def test_basic(self): self.assertEqual(greet('Kirk'), "Hello, Kirk.")
# Day 50 import greet greet.greet('Abdulrahman')
def test_shout(self): self.assertEqual(greet("KHAN"), "HELLO KHAN!")
text='/weather - Get weather details') except Exception: bot.send_message(chat_id=update.effective_chat.id, text="City not found") bot.send_message(chat_id=update.effective_chat.id, text='/news - Top 10 headlines') bot.send_message(chat_id=update.effective_chat.id, text='/weather - Get weather details') #user input def input1(update:Update, context:CallbackContext): bot.send_message(chat_id=update.effective_chat.id, text="Enter city name") dp.add_handler(MessageHandler(Filters.text, weatherD)) start = CommandHandler('start', greet.greet()) news = CommandHandler('news', news) weather = CommandHandler('weather', input1) updater.start_polling() dispatcher.add_handler(start) dispatcher.add_handler(news) dispatcher.add_handler(weather) updater.idle()
#!/usr/bin/env python import greet greet.greet("Dude")
def test_lots(self): self.assertEqual(greet(["Spock", "Bones", "Scotty"]), "Hello, Spock, Bones, and Scotty.")
def test_greet_two_names(self): self.assertEqual(greet(['Jill', 'Jane']), 'Hello, Jill and Jane.')
def test_null(self): self.assertEqual(greet(None), "Hello, my friend.")
def main(): greet.greet('Anshul Saraf')
def test_greet_john(self): result = greet('John') self.assertEqual('Hi John!', result)
def test_greet(self): self.assertEqual("hello!", greet())
def test(self): self.assertEqual(greet("James"), "Hello, James!") self.assertEqual(greet("Jane"), "Hello, Jane!") self.assertEqual(greet("Jim"), "Hello, Jim!") self.assertEqual(greet("Johnny"), "Hello, my love!")
def test_greet_jack(self): result = greet('Jack') self.assertEqual('Hi Jack!', result)