Best Python code snippet using keyboard
hypercube.py
Source:hypercube.py  
...4        def construct (self):5                grid = NumberPlane().set_opacity(0.2).shift(-2*OUT)6                frame = self.camera.frame7                light = self.camera.light_source8                light.move_to([-25, -20, 20])9                sphere1 = Sphere().set_color(RED).scale(0.2).move_to(1*RIGHT + 1*UP - 2*OUT)10                sphere2 = sphere1.copy().move_to(-1*RIGHT + 1*UP - 2*OUT)11                sphere3 = sphere1.copy().move_to(-1*RIGHT + -1*UP - 2*OUT)12                sphere4 = sphere1.copy().move_to(1*RIGHT + -1*UP - 2*OUT)13                sphere5 = sphere1.copy().move_to(2*RIGHT + 2*UP + -2*OUT)14                sphere6 = sphere1.copy().move_to(-2*RIGHT + 2*UP + -2*OUT)15                sphere7 = sphere1.copy().move_to(-2*RIGHT + -2*UP + -2*OUT)16                sphere8 = sphere1.copy().move_to(2*RIGHT + -2*UP + -2*OUT)17                18                spheres = SGroup(sphere1,sphere2,sphere3,sphere4,sphere5,sphere6,sphere7,sphere8)19                line1 = self.getline(sphere1,sphere2)20                line1.add_updater(21                        lambda mob: mob.become(22                        self.getline(sphere1,sphere2)23                        )24                )25                26                line2 = self.getline(sphere2,sphere3)27                line2.add_updater(28                        lambda mob: mob.become(29                        self.getline(sphere2,sphere3)30                        )31                )32                line3 = self.getline(sphere3,sphere4)33                line3.add_updater(34                        lambda mob: mob.become(35                        self.getline(sphere3,sphere4)36                        )37                )38                line4 = self.getline(sphere4,sphere1)39                line4.add_updater(40                        lambda mob: mob.become(41                        self.getline(sphere4,sphere1)42                        )43                )44                line5 = self.getline(sphere5,sphere6)45                line5.add_updater(46                        lambda mob: mob.become(47                        self.getline(sphere5,sphere6)48                        )49                )50                line6 = self.getline(sphere6,sphere7)51                line6.add_updater(52                        lambda mob: mob.become(53                        self.getline(sphere6,sphere7)54                        )55                )56                line7 = self.getline(sphere7,sphere8)57                line7.add_updater(58                        lambda mob: mob.become(59                        self.getline(sphere7,sphere8)60                        )61                )62                line8 = self.getline(sphere8,sphere5)63                line8.add_updater(64                        lambda mob: mob.become(65                        self.getline(sphere8,sphere5)66                        )67                )68                line9 = self.getline(sphere1,sphere5)69                line9.add_updater(70                        lambda mob: mob.become(71                        self.getline(sphere1,sphere5)72                        )73                )74                line10 = self.getline(sphere2,sphere6)75                line10.add_updater(76                        lambda mob: mob.become(77                        self.getline(sphere2,sphere6)78                        )79                )80                line11 = self.getline(sphere3,sphere7)81                line11.add_updater(82                        lambda mob: mob.become(83                        self.getline(sphere3,sphere7)84                        )85                )86                line12 = self.getline(sphere4,sphere8)87                line12.add_updater(88                        lambda mob: mob.become(89                        self.getline(sphere4,sphere8)90                        )91                )92                lines = SGroup(line1,line2,line3,line4,93                        line5,line6,line7,line8,94                        line9,line10,line11,line12)95                96                #CUBE B97                sphereb1 = Sphere().set_color(BLUE).scale(0.2).move_to(2*RIGHT + 2*UP + 2*OUT)98                sphereb2 = sphereb1.copy().move_to(-2*RIGHT + 2*UP + 2*OUT)99                sphereb3 = sphereb1.copy().move_to(-2*RIGHT + -2*UP + 2*OUT)100                sphereb4 = sphereb1.copy().move_to(2*RIGHT + -2*UP + 2*OUT)101                sphereb5 = sphereb1.copy().move_to(2*RIGHT + 2*UP + -2*OUT)102                sphereb6 = sphereb1.copy().move_to(-2*RIGHT + 2*UP + -2*OUT)103                sphereb7 = sphereb1.copy().move_to(-2*RIGHT + -2*UP + -2*OUT)104                sphereb8 = sphereb1.copy().move_to(2*RIGHT + -2*UP + -2*OUT)105                spheresb = SGroup(sphereb1,sphereb2,sphereb3,sphereb4,106                        sphereb5,sphereb6,sphereb7,sphereb8)107                lineb1 = self.getline(sphereb1,sphereb2)108                lineb1.add_updater(109                        lambda mob: mob.become(110                        self.getline(sphereb1,sphereb2)111                        )112                )113                lineb2 = self.getline(sphereb2,sphereb3)114                lineb2.add_updater(115                        lambda mob: mob.become(116                        self.getline(sphereb2,sphereb3)117                        )118                )...android_complex.py
Source:android_complex.py  
...63        e2 = TouchAction()64        e2.press(x=250, y=100).release()65        smile = TouchAction()66        smile.press(x=110, y=200) \67            .move_to(x=1, y=1) \68            .move_to(x=1, y=1) \69            .move_to(x=1, y=1) \70            .move_to(x=1, y=1) \71            .move_to(x=1, y=1) \72            .move_to(x=2, y=1) \73            .move_to(x=2, y=1) \74            .move_to(x=2, y=1) \75            .move_to(x=2, y=1) \76            .move_to(x=2, y=1) \77            .move_to(x=3, y=1) \78            .move_to(x=3, y=1) \79            .move_to(x=3, y=1) \80            .move_to(x=3, y=1) \81            .move_to(x=3, y=1) \82            .move_to(x=4, y=1) \83            .move_to(x=4, y=1) \84            .move_to(x=4, y=1) \85            .move_to(x=4, y=1) \86            .move_to(x=4, y=1) \87            .move_to(x=5, y=1) \88            .move_to(x=5, y=1) \89            .move_to(x=5, y=1) \90            .move_to(x=5, y=1) \91            .move_to(x=5, y=1) \92            .move_to(x=5, y=0) \93            .move_to(x=5, y=0) \94            .move_to(x=5, y=0) \95            .move_to(x=5, y=0) \96            .move_to(x=5, y=0) \97            .move_to(x=5, y=0) \98            .move_to(x=5, y=0) \99            .move_to(x=5, y=0) \100            .move_to(x=5, y=-1) \101            .move_to(x=5, y=-1) \102            .move_to(x=5, y=-1) \103            .move_to(x=5, y=-1) \104            .move_to(x=5, y=-1) \105            .move_to(x=4, y=-1) \106            .move_to(x=4, y=-1) \107            .move_to(x=4, y=-1) \108            .move_to(x=4, y=-1) \109            .move_to(x=4, y=-1) \110            .move_to(x=3, y=-1) \111            .move_to(x=3, y=-1) \112            .move_to(x=3, y=-1) \113            .move_to(x=3, y=-1) \114            .move_to(x=3, y=-1) \115            .move_to(x=2, y=-1) \116            .move_to(x=2, y=-1) \117            .move_to(x=2, y=-1) \118            .move_to(x=2, y=-1) \119            .move_to(x=2, y=-1) \120            .move_to(x=1, y=-1) \121            .move_to(x=1, y=-1) \122            .move_to(x=1, y=-1) \123            .move_to(x=1, y=-1) \124            .move_to(x=1, y=-1)125        smile.release()126        ma = MultiAction(self.driver)127        ma.add(e1, e2, smile)128        ma.perform()129        # so you can see it130        sleep(10)131if __name__ == '__main__':132    suite = unittest.TestLoader().loadTestsFromTestCase(ComplexAndroidTests)...android_gestures_sauce.py
Source:android_gestures_sauce.py  
...19        self.driver.start_activity("io.appium.android.apis", ".view.DragAndDropDemo")20        start = self.driver.find_element_by_id("io.appium.android.apis:id/drag_dot_3")21        end = self.driver.find_element_by_id("io.appium.android.apis:id/drag_dot_2")22        action = TouchAction(self.driver);23        action.long_press(start).move_to(end).release().perform()24        sleep(.5)25        text = self.driver.find_element_by_id("io.appium.android.apis:id/drag_result_text").text26        self.assertEqual(text, "Dropped!")27    def test_smiley_face(self):28        # just for the fun of it.29        # this doesn't really assert anything.30        # paint31        eye1 = TouchAction()32        eye1.press(x=150, y=100).release()33        eye2 = TouchAction()34        eye2.press(x=250, y=100).release()35        smile = TouchAction()36        smile.press(x=110, y=200) \37            .move_to(x=1, y=1) \38            .move_to(x=1, y=1) \39            .move_to(x=1, y=1) \40            .move_to(x=1, y=1) \41            .move_to(x=1, y=1) \42            .move_to(x=2, y=1) \43            .move_to(x=2, y=1) \44            .move_to(x=2, y=1) \45            .move_to(x=2, y=1) \46            .move_to(x=2, y=1) \47            .move_to(x=3, y=1) \48            .move_to(x=3, y=1) \49            .move_to(x=3, y=1) \50            .move_to(x=3, y=1) \51            .move_to(x=3, y=1) \52            .move_to(x=4, y=1) \53            .move_to(x=4, y=1) \54            .move_to(x=4, y=1) \55            .move_to(x=4, y=1) \56            .move_to(x=4, y=1) \57            .move_to(x=5, y=1) \58            .move_to(x=5, y=1) \59            .move_to(x=5, y=1) \60            .move_to(x=5, y=1) \61            .move_to(x=5, y=1) \62            .move_to(x=5, y=0) \63            .move_to(x=5, y=0) \64            .move_to(x=5, y=0) \65            .move_to(x=5, y=0) \66            .move_to(x=5, y=0) \67            .move_to(x=5, y=0) \68            .move_to(x=5, y=0) \69            .move_to(x=5, y=0) \70            .move_to(x=5, y=-1) \71            .move_to(x=5, y=-1) \72            .move_to(x=5, y=-1) \73            .move_to(x=5, y=-1) \74            .move_to(x=5, y=-1) \75            .move_to(x=4, y=-1) \76            .move_to(x=4, y=-1) \77            .move_to(x=4, y=-1) \78            .move_to(x=4, y=-1) \79            .move_to(x=4, y=-1) \80            .move_to(x=3, y=-1) \81            .move_to(x=3, y=-1) \82            .move_to(x=3, y=-1) \83            .move_to(x=3, y=-1) \84            .move_to(x=3, y=-1) \85            .move_to(x=2, y=-1) \86            .move_to(x=2, y=-1) \87            .move_to(x=2, y=-1) \88            .move_to(x=2, y=-1) \89            .move_to(x=2, y=-1) \90            .move_to(x=1, y=-1) \91            .move_to(x=1, y=-1) \92            .move_to(x=1, y=-1) \93            .move_to(x=1, y=-1) \94            .move_to(x=1, y=-1)95        smile.release()96        ma = MultiAction(self.driver)97        ma.add(eye1, eye2, smile)98        ma.perform()99        # so you can see it...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!!
