# Path: framework/tactics_helpers.py
# def _handle_user_inputs(dmaker, user_input):
# 
#     if user_input is None:
#         for k, v in dmaker._args_desc.items():
#             desc, default, arg_type = v
#             setattr(dmaker, k, default)
#     else:
#         for k, v in dmaker._args_desc.items():
#             desc, default, arg_type = v
#             ui_val = getattr(user_input, k)
#             if isinstance(arg_type, tuple):
#                 assert(type(ui_val) in arg_type or ui_val is None)
#             elif isinstance(arg_type, type):
#                 assert(type(ui_val) == arg_type or issubclass(type(ui_val), arg_type) or ui_val is None)
#             else:
#                 raise ValueError
#             if ui_val is None:
#                 setattr(dmaker, k, default)
#             else:
#                 setattr(dmaker, k, ui_val)
# 
#     if isinstance(dmaker, DataMaker) and dmaker.modelwalker_user:
#         modelwalker_inputs_handling_helper(dmaker)
# 
# def _user_input_conformity(self, user_input, _args_desc):
#     if not user_input:
#         return True
# 
#     if _args_desc:
#         ok, guilty = user_input.check_conformity(_args_desc.keys())
#         if not ok:
#             print("\n*** Unknown parameter: '{:s}'".format(guilty))
#             return False
# 
#     return True
# 
# def _restore_dmaker_internals(dmaker):
#     for k, v in dmaker._args_desc.items():
#         desc, default, arg_type = v
#         setattr(dmaker, k, default)


import datetime
from framework.global_resources import *
from framework.tactics_helpers import _handle_user_inputs, _user_input_conformity, _restore_dmaker_internals
        Returns:
          Operation: Operation you want fuddly to perform.
        '''
        raise NotImplementedError('Operators shall implement this method!')

    def do_after_all(self, fmk_ops, dm, monitor, target, logger):
        '''
        This action is executed after data has been sent to the target
        AND that all blocking probes have returned.
        BUT just before data is logged.

        Returns:
          LastInstruction: Last-minute instructions you request fuddly
            to perform.
        '''

        linst = LastInstruction()

        # In order to export data in
        # any case, that is even if the Logger has been set to
        # export data only when requested (i.e. explicit_export == True)
        linst.set_instruction(LastInstruction.RecordData)

        return linst

    def _start(self, fmk_ops, dm, monitor, target, logger, user_input):
        # sys.stdout.write("\n__ setup operator '%s' __" % self.__class__.__name__)
        if not _user_input_conformity(self, user_input, self._args_desc):
            return False


# Path: framework/tactics_helpers.py
# def _handle_user_inputs(dmaker, user_input):
# 
#     if user_input is None:
#         for k, v in dmaker._args_desc.items():
#             desc, default, arg_type = v
#             setattr(dmaker, k, default)
#     else:
#         for k, v in dmaker._args_desc.items():
#             desc, default, arg_type = v
#             ui_val = getattr(user_input, k)
#             if isinstance(arg_type, tuple):
#                 assert(type(ui_val) in arg_type or ui_val is None)
#             elif isinstance(arg_type, type):
#                 assert(type(ui_val) == arg_type or issubclass(type(ui_val), arg_type) or ui_val is None)
#             else:
#                 raise ValueError
#             if ui_val is None:
#                 setattr(dmaker, k, default)
#             else:
#                 setattr(dmaker, k, ui_val)
# 
#     if isinstance(dmaker, DataMaker) and dmaker.modelwalker_user:
#         modelwalker_inputs_handling_helper(dmaker)
# 
# def _user_input_conformity(self, user_input, _args_desc):
#     if not user_input:
#         return True
# 
#     if _args_desc:
#         ok, guilty = user_input.check_conformity(_args_desc.keys())
#         if not ok:
#             print("\n*** Unknown parameter: '{:s}'".format(guilty))
#             return False
# 
#     return True
# 
# def _restore_dmaker_internals(dmaker):
#     for k, v in dmaker._args_desc.items():
#         desc, default, arg_type = v
#         setattr(dmaker, k, default)


# Path: framework/operator_helpers.py
import datetime
from framework.global_resources import *
from framework.tactics_helpers import _handle_user_inputs, _user_input_conformity, _restore_dmaker_internals

        Returns:
          Operation: Operation you want fuddly to perform.
        '''
        raise NotImplementedError('Operators shall implement this method!')

    def do_after_all(self, fmk_ops, dm, monitor, target, logger):
        '''
        This action is executed after data has been sent to the target
        AND that all blocking probes have returned.
        BUT just before data is logged.

        Returns:
          LastInstruction: Last-minute instructions you request fuddly
            to perform.
        '''

        linst = LastInstruction()

        # In order to export data in
        # any case, that is even if the Logger has been set to
        # export data only when requested (i.e. explicit_export == True)
        linst.set_instruction(LastInstruction.RecordData)

        return linst

    def _start(self, fmk_ops, dm, monitor, target, logger, user_input):
        # sys.stdout.write("\n__ setup operator '%s' __" % self.__class__.__name__)
        if not _user_input_conformity(self, user_input, self._args_desc):
            return False


        _handle_user_inputs(self, user_input)