当前位置: 首页>>代码示例>>Python>>正文


Python pdb.line_prefix方法代码示例

本文整理汇总了Python中pdb.line_prefix方法的典型用法代码示例。如果您正苦于以下问题:Python pdb.line_prefix方法的具体用法?Python pdb.line_prefix怎么用?Python pdb.line_prefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdb的用法示例。


在下文中一共展示了pdb.line_prefix方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_formatted_stack_entry

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def _get_formatted_stack_entry(
        self, frame_lineno, prompt_prefix=pdb.line_prefix, frame_index=None
    ):
        frame, lineno = frame_lineno
        if frame is self.curframe:
            marker = "> "
        else:
            marker = "  "

        frame_prefix_width = len(str(len(self.stack)))
        if frame_index is None:
            frame_index = self.curindex
            fmt = "{frame_prefix}{marker}"
            lprefix = prompt_prefix  # "\n ->" by default
        else:
            # via/for stack trace
            fmt = "{marker}{frame_prefix}"
            lprefix = "\n     " + (" " * frame_prefix_width)

        # Format stack index (keeping same width across stack).
        frame_prefix = ("[%%%dd] " % frame_prefix_width) % frame_index
        marker_frameno = fmt.format(marker=marker, frame_prefix=frame_prefix)

        return marker_frameno + self.format_stack_entry(frame_lineno, lprefix) 
开发者ID:pdbpp,项目名称:pdbpp,代码行数:26,代码来源:pdbpp.py

示例2: do_hf_list

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def do_hf_list(self, arg):
        for frame_lineno in self.hidden_frames:
            print(self.format_stack_entry(frame_lineno, pdb.line_prefix),
                  file=self.stdout) 
开发者ID:pdbpp,项目名称:pdbpp,代码行数:6,代码来源:pdbpp.py

示例3: print_stack_entry

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def print_stack_entry(
        self, frame_lineno, prompt_prefix=pdb.line_prefix, frame_index=None
    ):
        print(
            self._get_formatted_stack_entry(frame_lineno, prompt_prefix, frame_index),
            file=self.stdout,
        ) 
开发者ID:pdbpp,项目名称:pdbpp,代码行数:9,代码来源:pdbpp.py

示例4: find_function

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def find_function(funcname, filename):
    cre = re.compile(r'def\s+%s\s*[(]' % re.escape(funcname))
    try:
        fp = open(filename)
    except IOError:
        return None
    # consumer of this info expects the first line to be 1
    lineno = 1
    answer = None
    while 1:
        line = fp.readline()
        if line == '':
            break
        if cre.match(line):
            answer = funcname, filename, lineno
            break
        lineno = lineno + 1
    fp.close()
    return answer


# Interaction prompt line will separate file and call info from code
# text using value of line_prefix string.  A newline and arrow may
# be to your liking.  You can set it once pdb is imported using the
# command "pdb.line_prefix = '\n% '".
# line_prefix = ': '    # Use this to get the old situation back 
开发者ID:glmcdona,项目名称:meddle,代码行数:28,代码来源:pdb.py

示例5: print_stack_entry

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):
        frame, lineno = frame_lineno
        if frame is self.curframe:
            print >>self.stdout, '>',
        else:
            print >>self.stdout, ' ',
        print >>self.stdout, self.format_stack_entry(frame_lineno,
                                                     prompt_prefix)


    # Help methods (derived from pdb.doc) 
开发者ID:glmcdona,项目名称:meddle,代码行数:13,代码来源:pdb.py

示例6: __repr__

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def __repr__(self):
        return self


# Interaction prompt line will separate file and call info from code
# text using value of line_prefix string.  A newline and arrow may
# be to your liking.  You can set it once pdb is imported using the
# command "pdb.line_prefix = '\n% '".
# line_prefix = ': '    # Use this to get the old situation back 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:11,代码来源:pdb.py

示例7: print_stack_entry

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import line_prefix [as 别名]
def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):
        frame, lineno = frame_lineno
        if frame is self.curframe:
            prefix = '> '
        else:
            prefix = '  '
        self.message(prefix +
                     self.format_stack_entry(frame_lineno, prompt_prefix))

    # Provide help 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:pdb.py


注:本文中的pdb.line_prefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。