Code Duplication    Length = 22-22 lines in 2 locations

dev/mini.py 1 location

@@ 543-564 (lines=22) @@
540
            self.log("Restarting all components.", lvl=warn)
541
            self._instantiate_components(clear=True)
542
543
    def _start_frontend(self, restart=False):
544
        """Check if it is enabled and start the frontend http & websocket"""
545
546
        self.log(self.config, self.config.frontendenabled, lvl=verbose)
547
        if self.config.frontendenabled and not self.frontend_running or restart:
548
            self.log("Restarting webfrontend services on", self.frontend_target)
549
550
            self.static = Static("/", docroot=self.frontend_target).register(self)
551
            self.websocket = WebSocketsDispatcher("/websocket").register(self)
552
            self.frontend_running = True
553
554
            if self.development:
555
                self.frontend_watch_manager = pyinotify.WatchManager()
556
                self.frontend_watcher = pyinotify.ThreadedNotifier(
557
                    self.frontend_watch_manager, FrontendHandler(self)
558
                )
559
                self.frontend_watcher.start()
560
                mask = (
561
                    pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE
562
                )
563
                self.log("Frontend root:", self.frontend_root, lvl=debug)
564
                self.frontend_watch_manager.add_watch(self.module_root, mask, rec=True)
565
566
    def _instantiate_components(self, clear=True):
567
        """Inspect all loadable components and run them"""

isomer/launcher.py 1 location

@@ 601-622 (lines=22) @@
598
            self.log("Restarting all components.", lvl=warn)
599
            self._instantiate_components(clear=True)
600
601
    def _start_frontend(self, restart=False):
602
        """Check if it is enabled and start the frontend http & websocket"""
603
604
        self.log(self.config, self.config.frontendenabled, lvl=verbose)
605
        if self.config.frontendenabled and not self.frontend_running or restart:
606
            self.log("Restarting webfrontend services on", self.frontend_target)
607
608
            self.static = Static("/", docroot=self.frontend_target).register(self)
609
            self.websocket = WebSocketsDispatcher("/websocket").register(self)
610
            self.frontend_running = True
611
612
            if self.development:
613
                self.frontend_watch_manager = pyinotify.WatchManager()
614
                self.frontend_watcher = pyinotify.ThreadedNotifier(
615
                    self.frontend_watch_manager, FrontendHandler(self)
616
                )
617
                self.frontend_watcher.start()
618
                # noinspection PyUnresolvedReferences
619
                mask = (
620
                        pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE
621
                )
622
                self.log("Frontend root:", self.frontend_root, lvl=debug)
623
                self.frontend_watch_manager.add_watch(self.module_root, mask, rec=True)
624
625
    def _check_provisions(self):