mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-01 19:02:31 +01:00
Streamline resource resolution mechanics.
This commit is contained in:
@@ -583,3 +583,17 @@ def merge_dicts_simple(base, other):
|
||||
def touch(path):
|
||||
with open(path, 'w'):
|
||||
pass
|
||||
|
||||
|
||||
def get_object_name(obj):
|
||||
if hasattr(obj, 'name'):
|
||||
return obj.name
|
||||
elif hasattr(obj,'func_name'):
|
||||
return obj.func_name
|
||||
elif hasattr(obj, 'im_func'):
|
||||
return '{}.{}'.format(obj.im_class.__name__, obj.im_func.func_name)
|
||||
elif hasattr(obj, '__name__'):
|
||||
return obj.__name__
|
||||
elif hasattr(obj, '__class__'):
|
||||
return obj.__class__.__name__
|
||||
return None
|
||||
|
Reference in New Issue
Block a user