本文整理汇总了Python中util.maybe函数的典型用法代码示例。如果您正苦于以下问题:Python maybe函数的具体用法?Python maybe怎么用?Python maybe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了maybe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: parse
def parse(self, line):
for t in maybe(self._match_last_line(line)):
self._extra_line(t)
return self.finish()
for t in maybe(self._match_line(line)):
self._extra_line(t)
return self
return self.finish()
开发者ID:jarhart,项目名称:SublimeSBT,代码行数:8,代码来源:outputmon.py
示例2: mark_errors_in
def mark_errors_in(self, filename):
for errors in maybe(self._error_report.sorted_errors_in(filename)):
for view in self._file_views(filename):
if view.is_dirty():
self._highlighter.clear(view)
else:
self._highlighter.highlight(view, errors, replace=True)
开发者ID:coltfred,项目名称:SublimeSBT,代码行数:7,代码来源:errormarker.py
示例3: start
def start(cls, project, line):
for m in maybe(re.match(r'\[(?:error|info)\]\s+(.+)\s+\(([^:]+):(\d+)\)$', line)):
yield cls(project,
line=line,
filename=m.group(2),
lineno=int(m.group(3)),
message=m.group(1))
开发者ID:jarhart,项目名称:SublimeSBT,代码行数:7,代码来源:outputmon.py
示例4: sorted_errors_in
def sorted_errors_in(self, filename):
def sort_errors(errors):
for line in sorted(errors.keys()):
for error in sorted(errors[line], key=lambda e: e.error_type):
yield error
for errors in maybe(self.errors_in(filename)):
return list(sort_errors(errors))
开发者ID:qiemem,项目名称:SublimeSBT,代码行数:8,代码来源:errorreport.py
示例5: _bookmark_error
def _bookmark_error(self, view):
for error in maybe(self._current_error_in_view(view)):
region = self._create_region(view, error.line)
self._clear_highlight(view, region)
view.add_regions(self.bookmark_key,
[region],
self.region_scope(error.error_type),
*self._bookmark_args(error.error_type))
return error.line
开发者ID:evaldobratti,项目名称:SublimeSBT,代码行数:9,代码来源:highlighter.py
示例6: is_sbt_view
def is_sbt_view(cls, view):
if view is not None:
for window in maybe(view.window()):
sbt_view = cls(window)
return sbt_view.panel.id() == view.id()
开发者ID:evaldobratti,项目名称:SublimeSBT,代码行数:5,代码来源:sbtview.py
示例7: _status_message
def _status_message(self, view):
for errors in maybe(self._line_errors(view)):
return '(%s)' % ')('.join([e.message for e in errors])
开发者ID:qiemem,项目名称:SublimeSBT,代码行数:3,代码来源:errormarker.py
示例8: on_activated
def on_activated(self, view):
for reporter in maybe(self._reporter(view)):
reporter.show_errors_in(view.file_name())
开发者ID:otwebti,项目名称:SublimeSBT,代码行数:3,代码来源:sublimesbt.py
示例9: _reporter
def _reporter(self, view):
for window in maybe(view.window()):
return Project(window).error_reporter
开发者ID:otwebti,项目名称:SublimeSBT,代码行数:3,代码来源:sublimesbt.py
示例10: is_play_project
def is_play_project(self):
for root in maybe(self.project_root()):
if self._play_build_files(root):
return True
开发者ID:Mondego,项目名称:pyreco,代码行数:4,代码来源:allPythonContent.py
示例11: error_lines_in
def error_lines_in(self, filename):
for errors in maybe(self.errors_in(filename)):
return sorted(errors.keys())
开发者ID:laughedelic,项目名称:SublimeSBT,代码行数:3,代码来源:errorreport.py
示例12: _match_line
def _match_line(self, line):
for m in maybe(re.match(r'\[info\] (.*)$', line)):
return m.group(1)
开发者ID:jarhart,项目名称:SublimeSBT,代码行数:3,代码来源:outputmon.py
示例13: mark_settings
def mark_settings(self, error_type='error'):
for settings in maybe(self.get('%s_marking' % error_type)):
return settings
return self.global_mark_settings()
开发者ID:Mondego,项目名称:pyreco,代码行数:4,代码来源:allPythonContent.py
示例14: _view_settings
def _view_settings(self):
for view in maybe(self.window.active_view()):
return view.settings().get('SublimeSBT', {})
return {}
开发者ID:laughedelic,项目名称:SublimeSBT,代码行数:4,代码来源:sbtsettings.py
示例15: update_status_now
def update_status_now(self):
for view in maybe(self._window.active_view()):
self._highlighter.set_status_message(view, self._status_message(view))
开发者ID:qiemem,项目名称:SublimeSBT,代码行数:3,代码来源:errormarker.py
示例16: current_error_in
def current_error_in(self, filename):
for error in maybe(self.current_error):
if error.filename == filename:
return error
开发者ID:inkytonik,项目名称:SublimeSBT,代码行数:4,代码来源:errorreport.py
示例17: on_modified
def on_modified(self, view):
for reporter in maybe(self._reporter(view)):
reporter.show_errors(view.file_name())
开发者ID:coltfred,项目名称:SublimeSBT,代码行数:3,代码来源:sublimesbt.py
示例18: _match_last_line
def _match_last_line(self, line):
for m in maybe(re.match(r'\[info\] (.+) \(([^:]+):(\d+)\)$', line)):
return (m.group(1), m.group(2), int(m.group(3)))
开发者ID:jarhart,项目名称:SublimeSBT,代码行数:3,代码来源:outputmon.py
示例19: errors_at
def errors_at(self, filename, line):
for errors in maybe(self.errors_in(filename)):
return errors.get(line)
开发者ID:coltfred,项目名称:SublimeSBT,代码行数:3,代码来源:errorreport.py
示例20: on_post_save
def on_post_save(self, view):
for reporter in maybe(self._reporter(view)):
reporter.hide_errors_in(view.file_name())
开发者ID:otwebti,项目名称:SublimeSBT,代码行数:3,代码来源:sublimesbt.py
注:本文中的util.maybe函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论