From 749ae853474e3310b0d95d4cd4470b7c43c53b25 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 9 Dec 2016 15:16:33 -0800 Subject: [PATCH] Allow 'get_all_class_names' to pass kwargs The keyword arguments fully_qualified and truncate_builtins are useful to allow to be passed, and are meaningful to pass along from this function to the `get_class_name` function so let them be passed. Change-Id: I0787bbaf209f3c223e72214d63e006cfc1d40866 --- oslo_utils/reflection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/oslo_utils/reflection.py b/oslo_utils/reflection.py index ef2563a8..acd82ca5 100644 --- a/oslo_utils/reflection.py +++ b/oslo_utils/reflection.py @@ -96,7 +96,8 @@ def get_class_name(obj, fully_qualified=True, truncate_builtins=True): return obj.__name__ -def get_all_class_names(obj, up_to=object): +def get_all_class_names(obj, up_to=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, @@ -107,7 +108,9 @@ def get_all_class_names(obj, up_to=object): obj = type(obj) for cls in obj.mro(): if issubclass(cls, up_to): - yield get_class_name(cls) + yield get_class_name(cls, + fully_qualified=fully_qualified, + truncate_builtins=truncate_builtins) def get_callable_name(function):