本文整理匯總了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
示例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()
示例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()
示例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