本文整理汇总了Python中line.Line.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Line.parse方法的具体用法?Python Line.parse怎么用?Python Line.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line.Line
的用法示例。
在下文中一共展示了Line.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __read_file
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import parse [as 别名]
def __read_file(self, input, defines, input_name = None):
from line import Line
l = None
block = self
lineno = 0
if input_name is None:
input_name = input.name
for txt in input.readlines():
lineno = lineno + 1
l = Line.parse(txt, l)
if l.is_complete():
info = l.expand(defines)
try:
block = block.parse(info[2], info[0])
except:
print("%s:%u failed to parse '%s'" %
(input_name, lineno, l), file = sys.stderr)
raise
if not block:
raise Exception("failed to parse '%s'" % l)
l = None
while block and block != self:
#print(block)
block = block.parse(['@end'], True)
示例2: loop
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import parse [as 别名]
def loop(self):
if not self.connection.loop():
return False
for line in self.connection.buffer:
ln = Line.parse(line)
self.state["last_line"] = ln
self.parse_line(ln)
self.hook_manager.run_irc_hooks(ln)
return True
示例3: raw
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import parse [as 别名]
def raw(self, line):
"""
Send a raw IRC line to the server.
@param line: The raw line to send, without a trailing carriage return or newline.
"""
logging.debug("[IRC] <- %s" % line)
ln = Line.parse(line)
force = True # Whether we bypass flood protection or not.
if ln.command.lower() in self.flood_verbs:
force = False
self.connection.write_line(line, force)