Best Python code snippet using localstack_python
RPG_main.py
Source:RPG_main.py
...76 Hero.change_look(hero_right)77class Skeleton():78 def __init__(self):79 self.image = skeleton80 def create_skeleton(self):81 random_x = random.randint(0,9)82 random_y = random.randint(0,8)83 if is_in_border_floor(random_x, random_y) == True:84 x = 42 + size * random_x85 y = 42 + size * random_y86 self.skeleton = canvas.create_image(x, y, image = self.image)87 else:88 self.create_skeleton()89 90class Boss():91 def __init__(self):92 self.image = boss93 def create_boss(self):94 random_x = random.randint(0,9)95 random_y = random.randint(0,8)96 if is_in_border_floor(random_x, random_y) == True:97 x = 42 + size * random_x98 y = 42 + size * random_y99 self.boss = canvas.create_image(x, y, image = self.image)100 else:101 self.create_boss()102skeleton = Skeleton()103skeleton.create_skeleton()104skeleton.create_skeleton()105skeleton.create_skeleton()106boss = Boss()107boss.create_boss()108root.bind("<KeyPress>", on_key_press)...
test_create_dirs.py
Source:test_create_dirs.py
...15 with patch('src.pyetllib.etlskel.operations.CreateTextFile.__do__',16 new=Mock(wraps=no_op)):17 with self.subTest("Default project"):18 paths_created = []19 cmd, _ = create_skeleton('foo')20 cmd.do()21 self.assertGreater(len(paths_created), 0)22 self.assertEqual(len(paths_created), 4)23 with self.subTest("Default project - no templates"):24 paths_created = []25 cmd, _ = create_skeleton('foo', create_template_dir=False)26 cmd.do()27 self.assertGreater(len(paths_created), 0)28 self.assertEqual(len(paths_created), 3)29 with self.subTest("Package project - no templates"):30 paths_created = []31 cmd, _ = create_skeleton('foo', main_package_name='bar',32 create_template_dir=False)33 cmd.do()34 self.assertGreater(len(paths_created), 0)35 self.assertEqual(len(paths_created), 3)36 self.assertIn('bar', str(paths_created[1]))37 with self.subTest("Full project with source dir"):38 paths_created = []39 cmd, _ = create_skeleton('foo', main_package_name='bar',40 create_source_dir=True)41 cmd.do()42 self.assertGreater(len(paths_created), 0)43 self.assertEqual(len(paths_created), 5)44 self.assertIn('src', str(paths_created[1]))45if __name__ == '__main__':...
create_skeleton.py
Source:create_skeleton.py
1def create_skeleton(filename):2 fi = open(filename, 'rt')3 out_filename = 'python_101_skeleton.py'4 fo = open(out_filename, 'wt')5 for line in fi:6 if '#' in line or 'import' in line or 'def' in line \7 or '__name__' in line or 'return' in line:8 fo.write(line)9 fi.close()10 fo.close()11 return12if __name__ == "__main__":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!