本文整理汇总了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