2727
2828from trepan .lib import format as Mformat
2929
30- __all__ = [' DebuggerCommand' ]
30+ __all__ = [" DebuggerCommand" ]
3131
3232
3333class DebuggerCommand :
3434 """Base Class for Debugger commands. We pull in some helper
3535 functions for command from module cmdfns."""
3636
37- category = ' misc'
37+ category = " misc"
3838
3939 @staticmethod
40- def setup (l , category = "misc" , min_args = 0 , max_args = None ,
41- need_stack = False ):
42- l ["name" ] = l ["__module__" ].split ("." )[- 1 ]
40+ def setup (l , category = "misc" , min_args = 0 , max_args = None , need_stack = False ):
41+ l ["name" ] = l ["__module__" ].split ("." )[- 1 ]
4342 l ["category" ] = category
4443 l ["min_args" ] = min_args
4544 l ["max_args" ] = max_args
@@ -57,20 +56,19 @@ def __init__(self, proc):
5756 # execution like errmsg(), msg(), and msg_nocr() might. (See
5857 # the note below on these latter 3 methods.)
5958 #
60- self .core = proc .core
59+ self .core = proc .core
6160 self .debugger = proc .debugger
6261 self .settings = self .debugger .settings
6362 return
6463
6564 aliases = ()
66- name = ' YourCommandName'
65+ name = " YourCommandName"
6766
6867 def columnize_commands (self , commands ):
6968 """List commands arranged in an aligned columns"""
7069 commands .sort ()
71- width = self .debugger .settings ['width' ]
72- return columnize .columnize (commands , displaywidth = width ,
73- lineprefix = ' ' )
70+ width = self .debugger .settings ["width" ]
71+ return columnize .columnize (commands , displaywidth = width , lineprefix = " " )
7472
7573 def confirm (self , msg , default = False ):
7674 """ Convenience short-hand for self.debugger.intf[-1].confirm """
@@ -85,7 +83,7 @@ def confirm(self, msg, default=False):
8583 def errmsg (self , msg , opts = {}):
8684 """ Convenience short-hand for self.debugger.intf[-1].errmsg """
8785 try :
88- return ( self .debugger .intf [- 1 ].errmsg (msg ) )
86+ return self .debugger .intf [- 1 ].errmsg (msg )
8987 except EOFError :
9088 # FIXME: what do we do here?
9189 pass
@@ -94,7 +92,7 @@ def errmsg(self, msg, opts={}):
9492 def msg (self , msg , opts = {}):
9593 """ Convenience short-hand for self.debugger.intf[-1].msg """
9694 try :
97- return ( self .debugger .intf [- 1 ].msg (msg ) )
95+ return self .debugger .intf [- 1 ].msg (msg )
9896 except EOFError :
9997 # FIXME: what do we do here?
10098 pass
@@ -103,17 +101,19 @@ def msg(self, msg, opts={}):
103101 def msg_nocr (self , msg , opts = {}):
104102 """ Convenience short-hand for self.debugger.intf[-1].msg_nocr """
105103 try :
106- return ( self .debugger .intf [- 1 ].msg_nocr (msg ) )
104+ return self .debugger .intf [- 1 ].msg_nocr (msg )
107105 except EOFError :
108106 # FIXME: what do we do here?
109107 pass
110108 return None
111109
112110 def rst_msg (self , text , opts = {}):
113111 """Convert ReStructuredText and run through msg()"""
114- text = Mformat .rst_text (text ,
115- 'plain' == self .debugger .settings ['highlight' ],
116- self .debugger .settings ['width' ])
112+ text = Mformat .rst_text (
113+ text ,
114+ "plain" == self .debugger .settings ["highlight" ],
115+ self .debugger .settings ["width" ],
116+ )
117117 return self .msg (text )
118118
119119 def run (self , args ):
@@ -125,15 +125,17 @@ def run(self, args):
125125 pass
126126
127127 def section (self , message , opts = {}):
128- if ' plain' != self .settings [' highlight' ]:
129- message = colorize (' bold' , message )
128+ if " plain" != self .settings [" highlight" ]:
129+ message = colorize (" bold" , message )
130130 else :
131- message += "\n " + '-' * len (message )
131+ message += "\n " + "-" * len (message )
132132 pass
133133 self .msg (message )
134134
135- if __name__ == '__main__' :
135+
136+ if __name__ == "__main__" :
136137 from trepan .processor .command import mock
138+
137139 d , cp = mock .dbg_setup ()
138140 dd = DebuggerCommand (cp )
139141 dd .msg ("hi" )
0 commit comments