reflection¶
Reflection module.
New in version 1.1.
-
oslo_utils.reflection.
accepts_kwargs
(function)¶ Returns
True
if function accepts kwargs otherwiseFalse
.
-
oslo_utils.reflection.
get_all_class_names
(obj, up_to=<type 'object'>, fully_qualified=True, truncate_builtins=True)¶ Get class names of object parent classes.
Iterate over all class names object is instance or subclass of, in order of method resolution (mro). If up_to parameter is provided, only name of classes that are sublcasses to that class are returned.
-
oslo_utils.reflection.
get_callable_args
(function, required_only=False)¶ Get names of callable arguments.
Special arguments (like
*args
and**kwargs
) are not included into output.If required_only is True, optional arguments (with default values) are not included into output.
-
oslo_utils.reflection.
get_callable_name
(function)¶ Generate a name from callable.
Tries to do the best to guess fully qualified callable name.
-
oslo_utils.reflection.
get_class_name
(obj, fully_qualified=True, truncate_builtins=True)¶ Get class name for object.
If object is a type, returns name of the type. If object is a bound method or a class method, returns its
self
object’s class name. If object is an instance of class, returns instance’s class name. Else, name of the type of the object is returned. If fully_qualified is True, returns fully qualified name of the type. For builtin types, just name is returned. TypeError is raised if can’t get class name from object.
-
oslo_utils.reflection.
get_member_names
(obj, exclude_hidden=True)¶ Get all the member names for a object.
-
oslo_utils.reflection.
get_members
(obj, exclude_hidden=True)¶ Yields the members of an object, filtering by hidden/not hidden.
New in version 2.3.
-
oslo_utils.reflection.
get_method_self
(method)¶ Gets the
self
object attached to this method (or none).
-
oslo_utils.reflection.
is_bound_method
(method)¶ Returns if the given method is bound to an object.
-
oslo_utils.reflection.
is_same_callback
(callback1, callback2, strict=True)¶ Returns if the two callbacks are the same.
-
oslo_utils.reflection.
is_subclass
(obj, cls)¶ Returns if the object is class and it is subclass of a given class.