當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。