def __init__(self, trained_regressor, value_list_to_item, config, verbose=True): self._trained_regressor = trained_regressor self._value_list_to_item = value_list_to_item self._config = config self._verbose = verbose self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, regressor, train_args_obtainer, item_to_feature_list, saver, verbose=True): self._regressor = regressor self._train_args_obtainer = train_args_obtainer self._saver = saver self._item_to_feature_list = item_to_feature_list self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, folder_path, file_path, file_extension="", save_method=shelve_save, verbose=True): self._folder_path = folder_path self._file_path = file_path self._save_method = save_method self._file_extension = file_extension self._full_path = os.path.join(self._folder_path, self._file_path + self._file_extension) self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, creator, product_saver, num_of_products, verbose=True): self._creator = creator self._product_saver = product_saver self._num_of_products = num_of_products self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, save_path, load_method=shelve_load, verbose=True): self._save_path = save_path self._load_method = load_method self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, path_to_item, folder, verbose=True): self._path_to_item = path_to_item self._logger = Logger(who=self.__class__.__name__, verbose=verbose) self._folder = folder
def __init__(self, executers, verbose=True): self._executers = executers self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, value_list_to_item, verbose=True): self._value_list_to_item = value_list_to_item self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, obtainer, edit_method=unit_method, verbose=True): self._obtainer = obtainer self._edit_method = edit_method self._verbose = verbose self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
def __init__(self, regressor, item_to_feature_list, verbose=True): self._regressor = regressor self._item_to_feature_list = item_to_feature_list self._logger = Logger(who=self.__class__.__name__, verbose=verbose)
from intelligent_creation.utilization.general_utilities.loggers.logger import Logger global_logger = Logger(verbose=True) def apply_carefully(items, func, verbose=True): products = [] for item in items: try: products.append(func(item)) except Exception as e: global_logger.log("Could not apply {} on {} with error {}".format( func, item, e)) return products DEFAULT_PREVIEW_LENGTH = 1000 def str_preview(str, max_len=DEFAULT_PREVIEW_LENGTH): if len(str) > max_len: char_len = (max_len - 5) / 2 return "{} ... {}".format(str[0:char_len], str[len(str) - char_len:len(str)]) else: return str