File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313def check_args ():
1414 if len (sys .argv ) != 3 :
1515 # Rather than use sys.exit let's just raise an error
16- raise Exception ("Need to give two numbers" )
16+ raise Exception (f "Need to give two numbers; got: { sys . argv } " )
1717 for i in range (2 ):
1818 try :
1919 sys .argv [i + 1 ] = int (sys .argv [i + 1 ])
Original file line number Diff line number Diff line change @@ -154,9 +154,9 @@ def run(self, args):
154154 if f_lasti >= 0 :
155155 opname = opc .opname [code .co_code [f_lasti ]]
156156 opname_formatted = format_token (Keyword , opname , style = style )
157- self .msg (f" last instruction: { frame .f_lasti } { opname_formatted } " )
157+ self .msg (f" instruction offset and opname : { frame .f_lasti } { opname_formatted } " )
158158 else :
159- self .msg (f" last instruction: { frame .f_lasti } " )
159+ self .msg (f" instruction offset : { frame .f_lasti } " )
160160
161161 self .msg (f" code: { format_code (code , style )} " )
162162 if frame .f_back :
Original file line number Diff line number Diff line change @@ -79,11 +79,16 @@ def resolve_location(proc, location) -> Optional[Location]:
7979 return INVALID_LOCATION
8080
8181 if mod_func is None :
82- msg = f"Object { location_method } is not known yet as a function, "
82+ # [1] DRY similar code [2] below
83+ msg = f"Object { location_method } is not known yet as a function."
8384 try :
8485 mod_func = eval (location_method , g , locals_dict )
8586 except Exception :
8687 proc .errmsg (msg )
88+ split_names = location_method .split ("." )
89+ if len (split_names ) > 1 :
90+ proc .msg (f'Try importing { "." .join (split_names [:- 1 ])} ?' )
91+
8792 return INVALID_LOCATION
8893
8994 try :
@@ -202,10 +207,14 @@ def resolve_address_location(proc, location) -> Optional[Location]:
202207 if location .method :
203208 # Validate arguments that can't be done in parsing
204209 filename = offset = None
205- msg = f"Object { location .method } is not known yet as a function, "
210+ msg = f"Object { location .method } is not known yet as a function."
211+ # [2] DRY simlar code above [1]
206212 try :
207213 mod_func = eval (location .method , g , locals_dict )
208214 except Exception :
215+ split_names = location_method .split ("." )
216+ if len (split_names ) > 1 :
217+ proc .msg (f'Try importing { "." .join (split_names [:- 1 ])} ?' )
209218 proc .errmsg (msg )
210219 return INVALID_LOCATION
211220
You can’t perform that action at this time.
0 commit comments