1
0
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:
Sergei Trofimov
2017-03-21 16:00:18 +00:00
parent 1d0db35e04
commit 15886ffa29
8 changed files with 249 additions and 748 deletions

View File

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