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
This commit is contained in:
Joshua Harlow 2016-12-09 15:16:33 -08:00
parent 4eeee2a641
commit 749ae85347
1 changed files with 5 additions and 2 deletions

View File

@ -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):