This is an example:
[gcb@localhost tests]$ cat test_reflect.py
import pdb from oslo_utils import reflection
class ClassA(object):
def __init__(self):
class ClassB(object): pass self.api = ClassB()
def test_get_nested_class_name(self): class_name = reflection.get_class_name(self.api, fully_qualified=False) print(class_name) class_name = reflection.get_class_name(self.api, fully_qualified=True) print(class_name)
a = ClassA() a.test_get_nested_class_name()
[gcb@localhost tests]$ python test_reflect.py ClassB __main__.ClassB
[gcb@localhost tests]$ python3 test_reflect.py ClassA.__init__.<locals>.ClassB __main__.ClassA.__init__.<locals>.ClassB
This is an example:
[gcb@localhost tests]$ cat test_reflect.py
import pdb
from oslo_utils import reflection
class ClassA(object):
def __init__(self):
class ClassB(object):
pass
self.api = ClassB()
def test_get_ nested_ class_name( self): get_class_ name(self. api, fully_qualified =False)
print( class_name) get_class_ name(self. api, fully_qualified =True)
print( class_name)
class_name = reflection.
class_name = reflection.
a = ClassA() get_nested_ class_name( )
a.test_
[gcb@localhost tests]$ python test_reflect.py
ClassB
__main__.ClassB
[gcb@localhost tests]$ python3 test_reflect.py __init_ _.<locals> .ClassB _.ClassA. __init_ _.<locals> .ClassB
ClassA.
__main_