MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / do_whatis

Method do_whatis

tools/python-3.11.9-amd64/Lib/pdb.py:1393–1424  ·  view source on GitHub ↗

whatis arg Print the type of the argument.

(self, arg)

Source from the content-addressed store, hash-verified

1391 self.message(s + '\t' + line.rstrip())
1392
1393 def do_whatis(self, arg):
1394 """whatis arg
1395 Print the type of the argument.
1396 """
1397 try:
1398 value = self._getval(arg)
1399 except:
1400 # _getval() already printed the error
1401 return
1402 code = None
1403 # Is it an instance method?
1404 try:
1405 code = value.__func__.__code__
1406 except Exception:
1407 pass
1408 if code:
1409 self.message('Method %s' % code.co_name)
1410 return
1411 # Is it a function?
1412 try:
1413 code = value.__code__
1414 except Exception:
1415 pass
1416 if code:
1417 self.message('Function %s' % code.co_name)
1418 return
1419 # Is it a class?
1420 if value.__class__ is type:
1421 self.message('Class %s.%s' % (value.__module__, value.__qualname__))
1422 return
1423 # None of the above...
1424 self.message(type(value))
1425
1426 complete_whatis = _complete_expression
1427

Callers

nothing calls this directly

Calls 3

_getvalMethod · 0.95
messageMethod · 0.95
typeClass · 0.50

Tested by

no test coverage detected