()
The main entry point for igraph when invoked from the command
    line shell
The main entry point for igraph when invoked from the command
    line shell
The main entry point for igraph when invoked from the command line shell
def main():
    """The main entry point for igraph when invoked from the command
    line shell"""
    config = Configuration.instance()

    if config.filename:
        print("Using configuration from %s" % config.filename, file=sys.stderr)
    else:
        print("No configuration file, using defaults", file=sys.stderr)

    if "shells" in config:
        parts = [part.strip() for part in config["shells"].split(",")]
        shell_classes = []
        available_classes = dict(
            [
                (k, v)
                for k, v in globals().items()
                if isinstance(v, type) and issubclass(v, Shell)
            ]
        )
        for part in parts:
            cls = available_classes.get(part, None)
            if cls is None:
                print("Warning: unknown shell class `%s'" % part, file=sys.stderr)
                continue
            shell_classes.append(cls)
    else:
        shell_classes = [IPythonShell, ClassicPythonShell]
        import platform

        if platform.system() == "Windows":
            shell_classes.insert(0, IDLEShell)

    shell = None
    for shell_class in shell_classes:
        try:
            shell = shell_class()
            break
        except Exception:
            # Try the next one
            if "Classic" in str(shell_class):
                raise
            pass

    if isinstance(shell, Shell):
        if config["verbose"]:
            if shell.supports_progress_bar():
                set_progress_handler(shell.get_progress_handler())
            if shell.supports_status_messages():
                set_status_handler(shell.get_status_handler())
        shell()
    else:
        print("No suitable Python shell was found.", file=sys.stderr)
        print("Check configuration variable `general.shells'.", file=sys.stderr)
def main ( ) : config = Configuration . instance ( ) if config . filename : print ( "Using configuration from %s" % config . filename , file = sys . stderr ) else : print ( "No configuration file, using defaults" , file = sys . stderr ) if "shells" in config : parts = [ part . strip ( ) for part in config [ "shells" ] . split ( "," ) ] shell_classes = [ ] available_classes = dict ( [ ( k , v ) for k , v in globals ( ) . items ( ) if isinstance ( v , type ) and issubclass ( v , Shell ) ] ) for part in parts : cls = available_classes . get ( part , None ) if cls is None : print ( "Warning: unknown shell class `%s'" % part , file = sys . stderr ) continue shell_classes . append ( cls ) else : shell_classes = [ IPythonShell , ClassicPythonShell ] import platform if platform . system ( ) == "Windows" : shell_classes . insert ( 0 , IDLEShell ) shell = None for shell_class in shell_classes : try : shell = shell_class ( ) break except Exception : # Try the next one if "Classic" in str ( shell_class ) : raise pass if isinstance ( shell , Shell ) : if config [ "verbose" ] : if shell . supports_progress_bar ( ) : set_progress_handler ( shell . get_progress_handler ( ) ) if shell . supports_status_messages ( ) : set_status_handler ( shell . get_status_handler ( ) ) shell ( ) else : print ( "No suitable Python shell was found." , file = sys . stderr ) print ( "Check configuration variable `general.shells'." , file = sys . stderr )