MCPcopy Index your code
hub / github.com/ipython/ipython / is_type

Function is_type

IPython/utils/wildcard.py:38–52  ·  view source on GitHub ↗

is_type(obj, typestr_or_type) verifies if obj is of a certain type. It can take strings or actual python types for the second argument, i.e. 'tuple'<->TupleType. 'all' matches all types. TODO: Should be extended for choosing more than one type.

(obj, typestr_or_type)

Source from the content-addressed store, hash-verified

36typestr2type, type2typestr = create_typestr2type_dicts()
37
38def is_type(obj, typestr_or_type):
39 """is_type(obj, typestr_or_type) verifies if obj is of a certain type. It
40 can take strings or actual python types for the second argument, i.e.
41 'tuple'<->TupleType. 'all' matches all types.
42
43 TODO: Should be extended for choosing more than one type."""
44 if typestr_or_type == "all":
45 return True
46 if type(typestr_or_type) == type:
47 test_type = typestr_or_type
48 else:
49 test_type = typestr2type.get(typestr_or_type, False)
50 if test_type:
51 return isinstance(obj, test_type)
52 return False
53
54def show_hidden(str, show_all=False):
55 """Return true for strings starting with single _ if show_all is true."""

Callers 1

filter_nsFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…