Code Duplication    Length = 23-23 lines in 2 locations

hyperactive/memory.py 1 location

@@ 45-67 (lines=23) @@
42
43
44
class LongTermMemory(Memory):
45
    def __init__(self, _space_, _main_args_, _cand_):
46
        super().__init__(_space_, _main_args_, _cand_)
47
48
        self.nth_process = _cand_.nth_process
49
50
        self.score_col_name = "mean_test_score"
51
52
        self.feature_hash = self._get_hash(_main_args_.X)
53
        self.label_hash = self._get_hash(_main_args_.y)
54
55
        current_path = os.path.realpath(__file__)
56
        meta_learn_path, _ = current_path.rsplit("/", 1)
57
58
        self.datetime = "run_data/" + datetime.datetime.now().strftime("%d.%m.%Y - %H:%M:%S")
59
        func_str = self._get_func_str(_cand_.func_)
60
        self.func_path_ = self._get_hash(func_str.encode("utf-8")) + "/"
61
62
        self.meta_path = meta_learn_path + "/meta_data/"
63
        self.func_path = self.meta_path + self.func_path_
64
        self.date_path = self.meta_path + self.func_path_ + self.datetime + "/"
65
66
        if not os.path.exists(self.date_path):
67
            os.makedirs(self.date_path, exist_ok=True)
68
69
    def load_memory(self, _cand_, _verb_):
70
        para, score = self._read_func_metadata(_cand_.func_, _verb_)

hyperactive/extensions/memory/memory.py 1 location

@@ 43-65 (lines=23) @@
40
41
42
class LongTermMemory(Memory):
43
    def __init__(self, _space_, _main_args_, _cand_):
44
        super().__init__(_space_, _main_args_, _cand_)
45
46
        self.nth_process = _cand_.nth_process
47
48
        self.score_col_name = "mean_test_score"
49
50
        self.feature_hash = self._get_hash(_main_args_.X)
51
        self.label_hash = self._get_hash(_main_args_.y)
52
53
        current_path = os.path.realpath(__file__)
54
        meta_learn_path, _ = current_path.rsplit("/", 1)
55
56
        self.datetime = "run_data/" + datetime.datetime.now().strftime("%d.%m.%Y - %H:%M:%S")
57
        func_str = self._get_func_str(_cand_.func_)
58
        self.func_path_ = self._get_hash(func_str.encode("utf-8")) + "/"
59
60
        self.meta_path = meta_learn_path + "/meta_data/"
61
        self.func_path = self.meta_path + self.func_path_
62
        self.date_path = self.meta_path + self.func_path_ + self.datetime + "/"
63
64
        if not os.path.exists(self.date_path):
65
            os.makedirs(self.date_path, exist_ok=True)
66
67
    def load_memory(self, _cand_, _verb_):
68
        para, score = self._read_func_metadata(_cand_.func_, _verb_)