pymoo/deprecated-in-pymoo
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| pymoo | warning | safe, with xpd check --fix |
pymoo 0.6.1.2+ |
pymoo moved or deprecated these forms, and the old import warns or raises. Use the place that the message names.
from pymoo.core.problem import StarmapParallelizationfrom pymoo.parallelization import StarmapParallelization
feasible = res.pop.get("feasible")feasible = res.pop.get("FEAS")What the rule reports
Section titled “What the rule reports”The rule reports two forms that pymoo deprecated.
| Form | On pymoo | Replacement |
|---|---|---|
StarmapParallelization imported from pymoo.core.problem |
0.6.1.6: ImportError. 0.6.2: DeprecationWarning. | the import from pymoo.parallelization, which gives the same class on 0.6.2 |
the key "feasible" given to get |
since 0.6.1.2: a DeprecationWarning for every individual, 40 for a population of 20 | "FEAS", which returned an equal array with no warning |
Two documents read the key. One needs res.pop, res.opt or res.off, where res is the
result of minimize, and it has the fix. The other reads the name of the object, a variable or
an attribute named pop, opt, off or population, and it has no fix. It gives a wrong
report on get of a dictionary with such a name.
The rule skips warning checks such as pytest.warns. For the name-based population match, it also skips a name that the file assigns a dictionary.
How to fix it
Section titled “How to fix it”xpd check --fix applies the fix of this rule.
The safe fix writes from pymoo.parallelization import StarmapParallelization for the import from pymoo.core.problem when the statement imports that one name, and "FEAS" for "feasible" on the population of a result of minimize. The key on another object has no fix.
Diagnostic message
Section titled “Diagnostic message”StarmapParallelization moved to pymoo.parallelization in pymoo 0.6.1.6. The import from pymoo.core.problem raises ImportError on 0.6.1.6 and DeprecationWarning on 0.6.2. Import it from pymoo.parallelization, which gives the same class.See all rules in the pymoo pack.