当前位置: 首页>>代码示例>>Python>>正文


Python InteractiveConsole.__init__方法代码示例

本文整理汇总了Python中code.InteractiveConsole.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python InteractiveConsole.__init__方法的具体用法?Python InteractiveConsole.__init__怎么用?Python InteractiveConsole.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在code.InteractiveConsole的用法示例。


在下文中一共展示了InteractiveConsole.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, cpu=None, verbose=False):
        InteractiveConsole.__init__(self)
        self.filename="<stdin>"

        self.inQuery = False # True if the shell is in SociaLite query
        self.compiler = None

        self.declBegin = None
        self.declEnd = None

        self.locals={}

        from impSocialite import setSocialiteVars
        setSocialiteVars(self.locals)
        self.locals["__name__"] = "__main__"

        self.adapter = PythonInterpAdapter(self)
        import socialite.functions.PyInterp as PyInterp
        PyInterp.set(self.adapter) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:21,代码来源:console.py

示例2: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, context):
        InteractiveConsole.__init__(self, locals={"context": context.getApplicationContext()}) 
开发者ID:chaquo,项目名称:chaquopy,代码行数:4,代码来源:repl.py

示例3: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, transform, config):
        self.transform = transform
        self.config = config 
开发者ID:redcanari,项目名称:canari3,代码行数:5,代码来源:shell.py

示例4: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, *args, **kwargs):
        self.handler = ExceptionHandler(*args, **kwargs)
        kwargs.pop("engine")
        kwargs.pop("prompt")
        kwargs.pop("arguments")
        InteractiveConsole.__init__(self, *args, **kwargs) 
开发者ID:danrobinson,项目名称:tracestack,代码行数:8,代码来源:console.py

示例5: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, writemethod):
        self._write = writemethod 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:4,代码来源:PyInterpreter.py

示例6: __init__

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def __init__(self, socket, locals=None):
        self.socket = socket
        self.handle = socket.makefile('rw')
        InteractiveConsole.__init__(self, locals=locals)
        self.handle.write(doc) 
开发者ID:nylas,项目名称:sync-engine,代码行数:7,代码来源:rdb.py

示例7: run_files

# 需要导入模块: from code import InteractiveConsole [as 别名]
# 或者: from code.InteractiveConsole import __init__ [as 别名]
def run_files(args, verbose=0, inspect=False):
    sys.argv = args
    filename = args[0]
    args = args[1:]

    import java.io.File as File
    abspath = File(filename).getAbsolutePath()
    path = str(abspath[0:abspath.rindex(File.separator)])
    sys.path.insert(0, path)

    program=open(filename).read()
    from pysoc import compiler
    src = compiler.compile(program)

    from impSocialite import addMod, loadMod, setSocialiteVars
    sys.modules.pop("__main__", None)

    class FakeConsole:
        def __init__(self):
            self.locals = None

    console = FakeConsole()
    adapter = PythonInterpAdapter(console)
    import socialite.functions.PyInterp as PyInterp
    PyInterp.set(adapter)

    mod = addMod("__main__")
    setSocialiteVars(mod.__dict__)
    console.locals = mod.__dict__
    try:
        import java.lang.System as Sys
        mod = loadMod("__main__", src, filename)
        #exec src in locals
    except SystemExit:
        sys.exit(0)
    except:
        # adapted from code.py::InteractiveInterpreter::showtraceback
        import traceback
        try:
            tp, value, tb = sys.exc_info()
            sys.last_type = tp
            sys.last_value = value
            sys.last_traceback = tb
            tblist = traceback.extract_tb(tb)
            del tblist[:1]
            list = traceback.format_list(tblist)
            if list:
                list.insert(0, "Traceback (most recent call last):\n")
            list[len(list):] = traceback.format_exception_only(tp, value)
        finally:
            tblist = tb = None
        map(sys.stderr.write, list)
        sys.exit(1)
 
    if inspect:
        console = SociaLiteConsole(verbose=verbose)
        console.initLocals(mod.__dict__)
        console.interact("") 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:60,代码来源:console.py


注:本文中的code.InteractiveConsole.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。