Code Duplication    Length = 56-61 lines in 2 locations

dev/mini.py 1 location

@@ 646-701 (lines=56) @@
643
        self.fire(ready(), "isomer-web")
644
645
646
def construct_graph(name, instance, args):
647
    """Preliminary Isomer application Launcher"""
648
649
    app = Core(name, instance, **args)
650
651
    setup_root(app)
652
653
    if args["debug"]:
654
        from circuits import Debugger
655
656
        isolog("Starting circuits debugger", lvl=warn, emitter="GRAPH")
657
        dbg = Debugger().register(app)
658
        # TODO: Make these configurable from modules, navdata is _very_ noisy
659
        # but should not be listed _here_
660
        dbg.IgnoreEvents.extend(
661
            [
662
                "read",
663
                "_read",
664
                "write",
665
                "_write",
666
                "stream_success",
667
                "stream_complete",
668
                "serial_packet",
669
                "raw_data",
670
                "stream",
671
                "navdatapush",
672
                "referenceframe",
673
                "updateposition",
674
                "updatesubscriptions",
675
                "generatevesseldata",
676
                "generatenavdata",
677
                "sensordata",
678
                "reset_flood_offenders",
679
                "reset_flood_counters",  # Flood counters
680
                "task_success",
681
                "task_done",  # Thread completion
682
                "keepalive",  # IRC Gateway
683
            ]
684
        )
685
686
    isolog("Beginning graph assembly.", emitter="GRAPH")
687
688
    if args["draw_graph"]:
689
        from circuits.tools import graph
690
691
        graph(app)
692
693
    if args["open_gui"]:
694
        import webbrowser
695
696
        # TODO: Fix up that url:
697
        webbrowser.open("http://%s:%i/" % (args["host"], args["port"]))
698
699
    isolog("Graph assembly done.", emitter="GRAPH")
700
701
    return app
702
703
704
@click.command()

isomer/launcher.py 1 location

@@ 728-788 (lines=61) @@
725
        self.fire(ready(), "isomer-web")
726
727
728
def construct_graph(ctx, name, instance, args):
729
    """Preliminary Isomer application Launcher"""
730
731
    app = Core(name, instance, **args)
732
733
    # TODO: This should probably be read-only
734
    BaseMeta.context = ctx
735
736
    setup_root(app)
737
738
    if args["debug"]:
739
        from circuits import Debugger
740
741
        isolog("Starting circuits debugger", lvl=warn, emitter="GRAPH")
742
        dbg = Debugger().register(app)
743
        # TODO: Make these configurable from modules, navdata is _very_ noisy
744
        # but should not be listed _here_
745
        dbg.IgnoreEvents.extend(
746
            [
747
                "read",
748
                "_read",
749
                "write",
750
                "_write",
751
                "stream_success",
752
                "stream_complete",
753
                "serial_packet",
754
                "raw_data",
755
                "stream",
756
                "navdatapush",
757
                "referenceframe",
758
                "updateposition",
759
                "updatesubscriptions",
760
                "generatevesseldata",
761
                "generatenavdata",
762
                "sensordata",
763
                "reset_flood_offenders",
764
                "reset_flood_counters",  # Flood counters
765
                "task_success",
766
                "task_done",  # Thread completion
767
                "keepalive",  # IRC Gateway
768
                "peek",  # AVIO and others
769
                "joystickchange",  # AVIO
770
            ]
771
        )
772
773
    isolog("Beginning graph assembly.", emitter="GRAPH")
774
775
    if args["draw_graph"]:
776
        from circuits.tools import graph
777
778
        graph(app)
779
780
    if args["open_gui"]:
781
        import webbrowser
782
783
        # TODO: Fix up that url:
784
        webbrowser.open("http://%s:%i/" % (args["host"], args["port"]))
785
786
    isolog("Graph assembly done.", emitter="GRAPH")
787
788
    return app
789
790
791
@click.command()