Best Python code snippet using autotest_python
menu.py
Source:menu.py  
...7        self.controller = controller8        self.frame = frame9        self._build_menu()10    def _build_menu(self):11        def do_bind(handler, item):12            self.frame.Bind(wx.EVT_MENU, handler, item)13        # Create menus and their contents14        file_menu = wx.Menu()15        keymap_item = file_menu.Append(16            id=-1,17            item="Keymap",18            helpString="Show mappings for keyboard shortcuts.")19        exit_item = file_menu.Append(20            id=wx.ID_EXIT,21            item="Exit",22            helpString="Exit the program")23        do_bind(self._on_select_keymap, keymap_item)24        do_bind(self._on_select_exit, exit_item)25        display_menu = wx.Menu()26        # singlet_view_item = display_menu.Append(27        #     id=-2,28        #     item="Single images",29        #     kind=wx.ITEM_RADIO)30        # triplet_view_item = display_menu.Append(31        #     id=-3,32        #     helpString="Image triplets",33        #     kind=wx.ITEM_RADIO)34        # display_menu.AppendSeparator()35        # auto_play_item = display_menu.Append(36        #     id=-4,37        #     item="Autoplay",38        #     helpString="Automatically transition through images.",39        #     kind=wx.ITEM_CHECK)40        #41        # do_bind(self._on_select_singlet_view, singlet_view_item)42        # do_bind(self._on_select_triplet_view, triplet_view_item)43        # do_bind(self._on_select_autoplay, auto_play_item)44        sync_menu = wx.Menu()45        # auto_sync_item = sync_menu.Append(46        #     id=-5,47        #     item="Automatically",48        #     helpString="Automatically synchronize results.",49        #     kind=wx.ITEM_CHECK)50        #51        # do_bind(self._on_select_automatically_sync, auto_sync_item)52        # Create menu bar53        menubar = wx.MenuBar()54        self.file_menu_title = "File"55        menubar.Append(file_menu, self.file_menu_title)56        self.display_menu_title = "Display"57        menubar.Append(display_menu, self.display_menu_title)58        self.sync_menu_title = "Sync"59        menubar.Append(sync_menu, self.sync_menu_title)60        self.frame.SetMenuBar(menubar)61        self.menubar = menubar62        auto_play_item = None63        self.auto_play_item = auto_play_item64    def _on_select_keymap(self, event):65        self.controller.on_show_keymappings()...basehttp.py
Source:basehttp.py  
...48        self.bind()49    def bind(self):50        """Bind and activate HTTP server."""51        if self.port != 'auto':52            self.do_bind()53        else:54            self.port = 900055            while True:56                try:57                    self.do_bind()58                except (OSError, socket.error):59                    self.port += 160                else:61                    break62            self.report()63    def do_bind(self):64        """Perform HTTP server binding and activation."""65        HTTPServer.__init__(self, (self.host, self.port), HTTPRequestHandler)66    def report(self):67        """Report startup info to stdout."""68        print(self.report_message.format(69            service=self.service,70            host=self.host,71            port=self.port))...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!!
