當前位置: 首頁>>代碼示例>>Python>>正文


Python codeop.CommandCompiler方法代碼示例

本文整理匯總了Python中codeop.CommandCompiler方法的典型用法代碼示例。如果您正苦於以下問題:Python codeop.CommandCompiler方法的具體用法?Python codeop.CommandCompiler怎麽用?Python codeop.CommandCompiler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在codeop的用法示例。


在下文中一共展示了codeop.CommandCompiler方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: read_command

# 需要導入模塊: import codeop [as 別名]
# 或者: from codeop import CommandCompiler [as 別名]
def read_command(self) -> Optional[CodeType]:
        """Read a command from the user line by line.

        Returns a code object suitable for execution.
        """

        reader = self.reader

        line = await reader.readline()
        if line == b"":
            raise ConnectionResetError()

        try:
            # skip the newline to make CommandCompiler work as advertised
            codeobj = self.compiler(line.rstrip(b"\n"))
        except SyntaxError:
            await self.send_exception()
            return None

        return codeobj 
開發者ID:tulir,項目名稱:mautrix-python,代碼行數:22,代碼來源:manhole.py

示例2: __init__

# 需要導入模塊: import codeop [as 別名]
# 或者: from codeop import CommandCompiler [as 別名]
def __init__(self, locals=None):
        """Constructor.

        The optional 'locals' argument specifies the dictionary in
        which code will be executed; it defaults to a newly created
        dictionary with key "__name__" set to "__console__" and key
        "__doc__" set to None.

        """
        if locals is None:
            locals = {"__name__": "__console__", "__doc__": None}
        self.locals = locals
        self.compile = CommandCompiler() 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:15,代碼來源:code.py

示例3: __init__

# 需要導入模塊: import codeop [as 別名]
# 或者: from codeop import CommandCompiler [as 別名]
def __init__(self):
        """Create a new InputSplitter instance.
        """
        self._buffer = []
        self._compile = codeop.CommandCompiler()
        self.encoding = get_input_encoding() 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:8,代碼來源:inputsplitter.py

示例4: __init__

# 需要導入模塊: import codeop [as 別名]
# 或者: from codeop import CommandCompiler [as 別名]
def __init__(self):
        self.breakpoints = {}
        self.redirect = True
        self.socket = None
        self.procuuid = None

        self.__messageHandlers = {}
        self.__initMessageHandlers()

        # special objects representing the main scripts thread and frame
        self.mainThread = self
        self.framenr = 0

        # The context to run the debugged program in.
        self.debugMod = imp.new_module('__main__')
        self.debugMod.__dict__['__builtins__'] = __builtins__

        # The list of complete lines to execute.
        self.buffer = ''

        # The list of regexp objects to filter variables against
        self.globalsFilterObjects = []
        self.localsFilterObjects = []

        self._fncache = {}
        self.dircache = []
        self.passive = False    # used to indicate the passive mode
        self.running = None
        self.test = None
        self.debugging = False
        self.userInput = None

        self.forkAuto = False
        self.forkChild = False

        self.readstream = None
        self.pollingDisabled = False

        self.callTraceEnabled = None

        self.compileCommand = codeop.CommandCompiler()

        self.__encoding = 'utf-8'
        self.eventExit = None
        self.__needEpilogue = True 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:47,代碼來源:clientbase_cdm_dbg.py


注:本文中的codeop.CommandCompiler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。