Commit 52f31a6e by devttys0

Updated extractor code to report only the class name of internal extractors

parent be7df822
......@@ -10,6 +10,13 @@ if PY_MAJOR_VERSION > 2:
string.letters = string.ascii_letters
def get_class_name_from_method(method):
if PY_MAJOR_VERSION > 2:
return method.__self__.__class__.__name__
else:
return method.im_class.__name__
def iterator(dictionary):
'''
For cross compatibility between Python 2 and Python 3 dictionaries.
......
......@@ -36,6 +36,9 @@ class Plugin(object):
else:
self._enabled = False
def __str__(self):
return self.__class__.__name__
def init(self):
'''
Child class should override this if needed.
......
......@@ -659,7 +659,11 @@ class Extractor(Module):
os.chdir(original_dir)
if rule is not None:
return (output_directory, fname, recurse, str(rule['cmd']))
if callable(rule['cmd']):
command_name = get_class_name_from_method(rule['cmd'])
else:
command_name = rule['cmd']
return (output_directory, fname, recurse, command_name)
else:
return (output_directory, fname, recurse, '')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment