MCPcopy Create free account
hub / github.com/pybind/pybind11 / object_is_convertible_to_std_set

Function object_is_convertible_to_std_set

include/pybind11/stl.h:102–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102inline bool object_is_convertible_to_std_set(const handle &src, bool convert) {
103 // Allow set/frozenset and dict keys.
104 // In convert mode: also allow types derived from collections.abc.Set.
105 return ((PyAnySet_Check(src.ptr()) != 0)
106 || object_is_instance_with_one_of_tp_names(src.ptr(), {"dict_keys"}))
107 || (convert && isinstance(src, module_::import("collections.abc").attr("Set")));
108}
109
110inline bool object_is_convertible_to_std_map(const handle &src, bool convert) {
111 // Allow dict.

Callers 1

loadFunction · 0.85

Calls 5

isinstanceFunction · 0.85
importFunction · 0.85
ptrMethod · 0.80
attrMethod · 0.80

Tested by

no test coverage detected