<commit_before>from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils

class QuickInfo(IntrospectModuleMixin, ModuleBase):

    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._input = None

        self._view_frame = None
        self._create_view_frame()
        self.view()

        self.view_initialised = True

    def _create_view_frame(self):
        import resources.python.quick_info_frames
        reload(resources.python.quick_info_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
                self, self._module_manager,
                resources.python.quick_info_frames.QuickInfoFrame)

        module_utils.create_standard_object_introspection(
                self, self._view_frame,
                self._view_frame.view_frame_panel,
                {'Module (self)' : self})

        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel)


    def close(self):
        for i in range(len(self.get_input_descriptions())):
            self.set_input(i, None)
        
        self._view_frame.Destroy()
        del self._view_frame

        ModuleBase.close(self)

    def get_input_descriptions(self):
        return ('Any DeVIDE data',)

    def get_output_descriptions(self):
        return ()

    def set_input(self, idx, input_stream):
        self._input = input_stream

    def get_output(self, idx):
        raise RuntimeError

    def logic_to_config(self):
        pass

    def config_to_logic(self):
        pass

    def view_to_config(self):
        pass

    def config_to_view(self):
        pass

    def view(self):
        self._view_frame.Show()
        self._view_frame.Raise()

    def execute_module(self):
        ot = self._view_frame.output_text
        ot.SetValue('line 1\nline2')

        

<commit_msg>Minor updates.<commit_after>from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils

class QuickInfo(IntrospectModuleMixin, ModuleBase):

    def __init__(self, module_manager):
        ModuleBase.__init__(self, module_manager)

        self._input = None

        self._view_frame = None
        self._create_view_frame()
        self.view()

        self.view_initialised = True

    def _create_view_frame(self):
        import resources.python.quick_info_frames
        reload(resources.python.quick_info_frames)

        self._view_frame = module_utils.instantiate_module_view_frame(
                self, self._module_manager,
                resources.python.quick_info_frames.QuickInfoFrame)

        module_utils.create_standard_object_introspection(
                self, self._view_frame,
                self._view_frame.view_frame_panel,
                {'Module (self)' : self})

        module_utils.create_eoca_buttons(self, self._view_frame,
                                        self._view_frame.view_frame_panel)


    def close(self):
        for i in range(len(self.get_input_descriptions())):
            self.set_input(i, None)
        
        self._view_frame.Destroy()
        del self._view_frame

        ModuleBase.close(self)

    def get_input_descriptions(self):
        return ('Any DeVIDE data',)

    def get_output_descriptions(self):
        return ()

    def set_input(self, idx, input_stream):
        self._input = input_stream

    def get_output(self, idx):
        raise RuntimeError

    def logic_to_config(self):
        pass

    def config_to_logic(self):
        pass

    def view_to_config(self):
        pass

    def config_to_view(self):
        pass

    def view(self):
        self._view_frame.Show()
        self._view_frame.Raise()

    def execute_module(self):
        ot = self._view_frame.output_text
        ip = self._input
       
        txt = ''
        if ip is None:
            txt = 'There is no input (None).'

        elif self.check_vtk(ip, txt):
            pass
        elif self.check_itk(ip, txt):
            pass
        else:
            txt = 'Could not determine type of data.'

        ot.SetValue(txt)

    def check_vtk(self, ip, txt):
        try:
            cn = ip.GetClassName()
        except AttributeError:
            return False
        else:
            if cn.startswith('vtk'):
                txt = 'VTK Object'
                return True

        return False

    def check_itk(self, ip, txt):
        return False

        


{'fraction_non_alphanumeric': 0.07861704470380973, 'fraction_numerical': 0.0004404316229905307, 'mean_word_length': 2.0814111261872457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5910460', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1279, 'n_words': 256}