MCPcopy Index your code
hub / github.com/RustPython/RustPython / do_whatis

Method do_whatis

Lib/pdb.py:1313–1344  ·  view source on GitHub ↗

whatis arg Print the type of the argument.

(self, arg)

Source from the content-addressed store, hash-verified

1311 self.message(s + '\t' + line.rstrip())
1312
1313 def do_whatis(self, arg):
1314 """whatis arg
1315 Print the type of the argument.
1316 """
1317 try:
1318 value = self._getval(arg)
1319 except:
1320 # _getval() already printed the error
1321 return
1322 code = None
1323 # Is it a function?
1324 try:
1325 code = value.__code__
1326 except Exception:
1327 pass
1328 if code:
1329 self.message('Function %s' % code.co_name)
1330 return
1331 # Is it an instance method?
1332 try:
1333 code = value.__func__.__code__
1334 except Exception:
1335 pass
1336 if code:
1337 self.message('Method %s' % code.co_name)
1338 return
1339 # Is it a class?
1340 if value.__class__ is type:
1341 self.message('Class %s.%s' % (value.__module__, value.__qualname__))
1342 return
1343 # None of the above...
1344 self.message(type(value))
1345
1346 complete_whatis = _complete_expression
1347

Callers

nothing calls this directly

Calls 2

_getvalMethod · 0.95
messageMethod · 0.95

Tested by

no test coverage detected