From 7c6133ef596096533a99d5bc40ae47e018053039 Mon Sep 17 00:00:00 2001 From: perib Date: Tue, 28 Nov 2023 11:10:27 -0800 Subject: [PATCH] remove deprecated imp, fix docstring warning --- tpot/base.py | 6 +++--- tpot/gp_deap.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tpot/base.py b/tpot/base.py index c1e3a3fb..79304676 100644 --- a/tpot/base.py +++ b/tpot/base.py @@ -28,7 +28,7 @@ import inspect import warnings import sys -import imp + from functools import partial from datetime import datetime from multiprocessing import cpu_count @@ -38,7 +38,7 @@ from tempfile import mkdtemp from shutil import rmtree - +import types import numpy as np from pandas import DataFrame from scipy import sparse @@ -411,7 +411,7 @@ def _setup_config(self, config_dict): def _read_config_file(self, config_path): if os.path.isfile(config_path): try: - custom_config = imp.new_module("custom_config") + custom_config = types.ModuleType("custom_config") with open(config_path, "r") as config_file: file_string = config_file.read() diff --git a/tpot/gp_deap.py b/tpot/gp_deap.py index 4805d714..2cd36fca 100644 --- a/tpot/gp_deap.py +++ b/tpot/gp_deap.py @@ -93,7 +93,7 @@ def mutate_random_individual(population, toolbox): def varOr(population, toolbox, lambda_, cxpb, mutpb): - """Part of an evolutionary algorithm applying only the variation part + r"""Part of an evolutionary algorithm applying only the variation part (crossover, mutation **or** reproduction). The modified individuals have their fitness invalidated. The individuals are cloned so returned population is independent of the input population. @@ -177,7 +177,7 @@ def initialize_stats_dict(individual): def eaMuPlusLambda(population, toolbox, mu, lambda_, cxpb, mutpb, ngen, pbar, stats=None, halloffame=None, verbose=0, per_generation_function=None, log_file=None): - """This is the :math:`(\mu + \lambda)` evolutionary algorithm. + r"""This is the :math:`(\mu + \lambda)` evolutionary algorithm. :param population: A list of individuals. :param toolbox: A :class:`~deap.base.Toolbox` that contains the evolution operators.