| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,15 +46,18 @@ def set_trace(): | |||
| 46 | 46 | ||
| 47 | 47 | # Adopted verbatim from pdb for completeness: | |
| 48 | 48 | ||
| 49 | + | ||
| 49 | 50 | def post_mortem(t=None): | |
| 50 | 51 | # handling the default | |
| 51 | 52 | if t is None: | |
| 52 | 53 | # sys.exc_info() returns (type, value, traceback) if an exception is | |
| 53 | 54 | # being handled, otherwise it returns None | |
| 54 | 55 | t = sys.exc_info()[2] | |
| 55 | 56 | if t is None: | |
| 56 | - raise ValueError("A valid traceback must be passed if no " | ||
| 57 | - "exception is being handled") | ||
| 57 | + raise ValueError( | ||
| 58 | + "A valid traceback must be passed if no " | ||
| 59 | + "exception is being handled" | ||
| 60 | + ) | ||
| 58 | 61 | ||
| 59 | 62 | p = BPdb() | |
| 60 | 63 | p.reset() | |
@@ -66,26 +69,28 @@ def pm(): | |||
| 66 | 69 | ||
| 67 | 70 | ||
| 68 | 71 | def main(): | |
| 69 | - parser = OptionParser( | ||
| 70 | - usage='Usage: %prog [options] [file [args]]') | ||
| 71 | - parser.add_option('--version', '-V', action='store_true', | ||
| 72 | - help='Print version and exit.') | ||
| 72 | + parser = OptionParser(usage="Usage: %prog [options] [file [args]]") | ||
| 73 | + parser.add_option( | ||
| 74 | + "--version", "-V", action="store_true", help="Print version and exit." | ||
| 75 | + ) | ||
| 73 | 76 | options, args = parser.parse_args(sys.argv) | |
| 74 | 77 | if options.version: | |
| 75 | - print('bpdb on top of bpython version', __version__, end="") | ||
| 76 | - print('on top of Python', sys.version.split()[0]) | ||
| 77 | - print('(C) 2008-2013 Bob Farrell, Andreas Stuehrk et al. ' | ||
| 78 | - 'See AUTHORS for detail.') | ||
| 78 | + print("bpdb on top of bpython version", __version__, end="") | ||
| 79 | + print("on top of Python", sys.version.split()[0]) | ||
| 80 | + print( | ||
| 81 | + "(C) 2008-2013 Bob Farrell, Andreas Stuehrk et al. " | ||
| 82 | + "See AUTHORS for detail." | ||
| 83 | + ) | ||
| 79 | 84 | return 0 | |
| 80 | 85 | ||
| 81 | 86 | if len(args) < 2: | |
| 82 | - print('usage: bpdb scriptfile [arg] ...') | ||
| 87 | + print("usage: bpdb scriptfile [arg] ...") | ||
| 83 | 88 | return 2 | |
| 84 | 89 | ||
| 85 | 90 | # The following code is based on Python's pdb.py. | |
| 86 | 91 | mainpyfile = args[1] | |
| 87 | 92 | if not os.path.exists(mainpyfile): | |
| 88 | - print('Error:', mainpyfile, 'does not exist') | ||
| 93 | + print("Error:", mainpyfile, "does not exist") | ||
| 89 | 94 | return 1 | |
| 90 | 95 | ||
| 91 | 96 | # Hide bpdb from argument list. | |
@@ -114,5 +119,8 @@ def main(): | |||
| 114 | 119 | print("Running 'cont' or 'step' will restart the program") | |
| 115 | 120 | t = sys.exc_info()[2] | |
| 116 | 121 | pdb.interaction(None, t) | |
| 117 | - print("Post mortem debugger finished. The " + mainpyfile + | ||
| 118 | - " will be restarted") | ||
| 122 | + print( | ||
| 123 | + "Post mortem debugger finished. The " | ||
| 124 | + + mainpyfile | ||
| 125 | + + " will be restarted" | ||
| 126 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | 27 | import sys | |
| 28 | 28 | ||
| 29 | - if __name__ == '__main__': | ||
| 29 | + if __name__ == "__main__": | ||
| 30 | 30 | from . import main | |
| 31 | + | ||
| 31 | 32 | sys.exit(main()) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ class BPdb(pdb.Pdb): | |||
| 33 | 33 | ||
| 34 | 34 | def __init__(self, *args, **kwargs): | |
| 35 | 35 | pdb.Pdb.__init__(self, *args, **kwargs) | |
| 36 | - self.prompt = '(BPdb) ' | ||
| 36 | + self.prompt = "(BPdb) " | ||
| 37 | 37 | self.intro = 'Use "B" to enter bpython, Ctrl-d to exit it.' | |
| 38 | 38 | ||
| 39 | 39 | def postloop(self): | |
@@ -46,14 +46,15 @@ def postloop(self): | |||
| 46 | 46 | def do_Bpython(self, arg): | |
| 47 | 47 | locals_ = self.curframe.f_globals.copy() | |
| 48 | 48 | locals_.update(self.curframe.f_locals) | |
| 49 | - bpython.embed(locals_, ['-i']) | ||
| 50 | - | ||
| 49 | + bpython.embed(locals_, ["-i"]) | ||
| 51 | 50 | ||
| 52 | 51 | def help_Bpython(self): | |
| 53 | 52 | print("B(python)") | |
| 54 | 53 | print("") | |
| 55 | - print("Invoke the bpython interpreter for this stack frame. To exit " | ||
| 56 | - "bpython and return to a standard pdb press Ctrl-d") | ||
| 54 | + print( | ||
| 55 | + "Invoke the bpython interpreter for this stack frame. To exit " | ||
| 56 | + "bpython and return to a standard pdb press Ctrl-d" | ||
| 57 | + ) | ||
| 57 | 58 | ||
| 58 | 59 | # shortcuts | |
| 59 | 60 | do_B = do_Bpython | |
| Back | FazBrowse Home | New Git URL |
0 commit comments