diff --git a/WFacer/convergence.py b/WFacer/convergence.py index 685be05..4cba749 100644 --- a/WFacer/convergence.py +++ b/WFacer/convergence.py @@ -1,4 +1,5 @@ """Convergence checks.""" + import numpy as np from pymatgen.analysis.structure_matcher import StructureMatcher from smol.cofe import ClusterExpansion diff --git a/WFacer/fit.py b/WFacer/fit.py index cb5061c..65a4226 100644 --- a/WFacer/fit.py +++ b/WFacer/fit.py @@ -1,4 +1,5 @@ """Fit ECIs from Wrangler.""" + from warnings import warn import numpy as np diff --git a/WFacer/jobs.py b/WFacer/jobs.py index 6953b95..60d9493 100644 --- a/WFacer/jobs.py +++ b/WFacer/jobs.py @@ -1,4 +1,5 @@ """Unitary jobs used by an atomate2 workflow.""" + import importlib import logging from copy import deepcopy diff --git a/WFacer/maker.py b/WFacer/maker.py index fd133cc..9dbf9f6 100644 --- a/WFacer/maker.py +++ b/WFacer/maker.py @@ -1,4 +1,5 @@ """Automatic cluster expansion workflow maker.""" + from dataclasses import dataclass, field from warnings import warn diff --git a/WFacer/sample_generators/mc_generators.py b/WFacer/sample_generators/mc_generators.py index 9bb6b6a..764acec 100644 --- a/WFacer/sample_generators/mc_generators.py +++ b/WFacer/sample_generators/mc_generators.py @@ -1,4 +1,5 @@ """Monte-carlo to estimate ground states and sample structures.""" + import itertools from abc import ABCMeta, abstractmethod from warnings import warn diff --git a/WFacer/schema.py b/WFacer/schema.py index 76bfa8a..2618cb0 100644 --- a/WFacer/schema.py +++ b/WFacer/schema.py @@ -1,4 +1,5 @@ """Defines the standard output schema for automated cluster expansion workflows.""" + from typing import Any, Dict, List, Union from pydantic import BaseModel, Field diff --git a/WFacer/specie_decorators/__init__.py b/WFacer/specie_decorators/__init__.py index f739973..46c3029 100644 --- a/WFacer/specie_decorators/__init__.py +++ b/WFacer/specie_decorators/__init__.py @@ -11,7 +11,7 @@ PmgGuessChargeDecorator, ) -allowed_decorators = defaultdict(lambda: []) +allowed_decorators = defaultdict(list) for subclass in get_subclasses(BaseDecorator).values(): prop = subclass.decorated_prop_name if subclass.required_prop_names is not None: diff --git a/WFacer/specie_decorators/base.py b/WFacer/specie_decorators/base.py index b7e669a..d75c681 100644 --- a/WFacer/specie_decorators/base.py +++ b/WFacer/specie_decorators/base.py @@ -116,7 +116,7 @@ def group_site_by_species(entries): defaultdict: (Entry index, site index) belonging to each species. """ - groups_by_species = defaultdict(lambda: []) + groups_by_species = defaultdict(list) # These entries should not contain Vacancy. for e_id, entry in enumerate(entries): @@ -249,7 +249,7 @@ def _process(self, entries, decorate_rules): species_decor.append(sp) # Preserve all information. - site_properties = defaultdict(lambda: []) + site_properties = defaultdict(list) for site in s_undecor: for p in site.properties: site_properties[p].append(site.properties[p]) diff --git a/WFacer/utils/convex_hull.py b/WFacer/utils/convex_hull.py index faea2e6..ca02589 100644 --- a/WFacer/utils/convex_hull.py +++ b/WFacer/utils/convex_hull.py @@ -1,4 +1,5 @@ """Utilities to obtain minimum energies per composition and the convex hull.""" + from collections import defaultdict import numpy as np diff --git a/WFacer/utils/duplicacy.py b/WFacer/utils/duplicacy.py index 9869359..4815e79 100644 --- a/WFacer/utils/duplicacy.py +++ b/WFacer/utils/duplicacy.py @@ -1,4 +1,5 @@ """Check duplicacy between structures.""" + import numpy as np from pymatgen.analysis.structure_matcher import StructureMatcher from pymatgen.core import DummySpecies, Element, Species, Structure diff --git a/WFacer/utils/occu.py b/WFacer/utils/occu.py index fe7bc11..21e743e 100644 --- a/WFacer/utils/occu.py +++ b/WFacer/utils/occu.py @@ -1,4 +1,5 @@ """Random occupancy generation.""" + import numpy as np diff --git a/WFacer/utils/query.py b/WFacer/utils/query.py index abec4fa..87f7cf7 100644 --- a/WFacer/utils/query.py +++ b/WFacer/utils/query.py @@ -1,4 +1,5 @@ """Rules to query nested task documents and dictionaries.""" + import random from warnings import warn diff --git a/WFacer/utils/selection.py b/WFacer/utils/selection.py index f35f324..222fa07 100644 --- a/WFacer/utils/selection.py +++ b/WFacer/utils/selection.py @@ -1,4 +1,5 @@ """Structure selection methods from feature matrices.""" + from warnings import warn import numpy as np diff --git a/WFacer/utils/sparselm_estimators.py b/WFacer/utils/sparselm_estimators.py index f10468d..3e1bc06 100644 --- a/WFacer/utils/sparselm_estimators.py +++ b/WFacer/utils/sparselm_estimators.py @@ -1,4 +1,5 @@ """Utility functions to prepare sparse-lm estimators.""" + from warnings import warn import numpy as np diff --git a/docs/src/example_scripts/semi_automation_BCC_AlLi/fit_model.py b/docs/src/example_scripts/semi_automation_BCC_AlLi/fit_model.py index 6c3a713..01414a6 100644 --- a/docs/src/example_scripts/semi_automation_BCC_AlLi/fit_model.py +++ b/docs/src/example_scripts/semi_automation_BCC_AlLi/fit_model.py @@ -1,4 +1,5 @@ """Parse and fit cluster expansion.""" + import json from emmet.core.tasks import TaskDoc # emmet-core >= 0.60.0 diff --git a/docs/src/example_scripts/semi_automation_BCC_AlLi/generate.py b/docs/src/example_scripts/semi_automation_BCC_AlLi/generate.py index 35528f2..d744d9d 100644 --- a/docs/src/example_scripts/semi_automation_BCC_AlLi/generate.py +++ b/docs/src/example_scripts/semi_automation_BCC_AlLi/generate.py @@ -1,4 +1,5 @@ """Generate structures for a next iteration.""" + from warnings import warn from fireworks import LaunchPad diff --git a/docs/src/example_scripts/semi_automation_BCC_AlLi/initialize.py b/docs/src/example_scripts/semi_automation_BCC_AlLi/initialize.py index 8b2448b..605ba20 100644 --- a/docs/src/example_scripts/semi_automation_BCC_AlLi/initialize.py +++ b/docs/src/example_scripts/semi_automation_BCC_AlLi/initialize.py @@ -1,4 +1,5 @@ """An example to semi-automate with fireworks. Generate initial document.""" + import json from monty.json import jsanitize diff --git a/tests/test_convergence.py b/tests/test_convergence.py index 341e5a8..68da40b 100644 --- a/tests/test_convergence.py +++ b/tests/test_convergence.py @@ -1,4 +1,5 @@ """Test convergence functions.""" + import numpy as np from pymatgen.entries.computed_entries import ComputedStructureEntry from smol.cofe import ClusterExpansion diff --git a/tests/test_enumeration.py b/tests/test_enumeration.py index 9e943b3..e92a137 100644 --- a/tests/test_enumeration.py +++ b/tests/test_enumeration.py @@ -1,4 +1,5 @@ """Test enumerating functions.""" + from collections import defaultdict from itertools import chain from warnings import warn @@ -170,7 +171,7 @@ def test_enumerate_structures(single_expansion): for occu, mid in zip(occus, mids) ] # When keeping the ground states, each composition must have at least 1 state. - count_occurences = defaultdict(lambda: 0) + count_occurences = defaultdict(int) for n in ns: count_occurences[n] += 1 diff --git a/tests/test_fit.py b/tests/test_fit.py index a8a6d55..82f5745 100644 --- a/tests/test_fit.py +++ b/tests/test_fit.py @@ -1,4 +1,5 @@ """Test the fitting functions.""" + import os import cvxpy as cp diff --git a/tests/test_jobs.py b/tests/test_jobs.py index e4e20b6..baf6ef3 100644 --- a/tests/test_jobs.py +++ b/tests/test_jobs.py @@ -1,4 +1,5 @@ """Test running jobs.""" + from copy import deepcopy from itertools import chain diff --git a/tests/test_maker.py b/tests/test_maker.py index 4034908..ceadf88 100644 --- a/tests/test_maker.py +++ b/tests/test_maker.py @@ -1,4 +1,5 @@ """Test the trigger job and the flow maker.""" + import numpy as np import pytest from jobflow import Flow, Job, Response diff --git a/tests/test_mc_generators.py b/tests/test_mc_generators.py index a1e07c5..1ac095c 100644 --- a/tests/test_mc_generators.py +++ b/tests/test_mc_generators.py @@ -1,4 +1,5 @@ """Test sample generators.""" + import random from itertools import chain diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index e2d8757..6a9e8cd 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -1,4 +1,5 @@ """Test preprocessing functions.""" + import os import numpy as np diff --git a/tests/test_schema.py b/tests/test_schema.py index d2c7e3c..04c3878 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -1,4 +1,5 @@ """Test initialization of the CeOutputsDocument schema.""" + import numpy as np import pytest diff --git a/tests/test_utils/test_occu.py b/tests/test_utils/test_occu.py index 62e70b6..650c33d 100644 --- a/tests/test_utils/test_occu.py +++ b/tests/test_utils/test_occu.py @@ -1,4 +1,5 @@ """Test occupancy generation.""" + import numpy as np import numpy.testing as npt from smol.moca.occu_utils import get_dim_ids_table, occu_to_counts diff --git a/tests/test_utils/test_query.py b/tests/test_utils/test_query.py index c198b98..fcb4b1f 100644 --- a/tests/test_utils/test_query.py +++ b/tests/test_utils/test_query.py @@ -1,4 +1,5 @@ """Test query rules.""" + import numpy as np import numpy.testing as npt import pytest diff --git a/tests/test_utils/test_sparselm_estimators.py b/tests/test_utils/test_sparselm_estimators.py index ef22ed2..7058a57 100644 --- a/tests/test_utils/test_sparselm_estimators.py +++ b/tests/test_utils/test_sparselm_estimators.py @@ -1,4 +1,5 @@ """Test sparselm estimator utilities.""" + from itertools import chain import numpy as np diff --git a/tests/test_utils/test_task_document.py b/tests/test_utils/test_task_document.py index d4f3159..8f3862b 100644 --- a/tests/test_utils/test_task_document.py +++ b/tests/test_utils/test_task_document.py @@ -1,4 +1,5 @@ """Test single_taskdocument utilities.""" + import numpy as np import pytest from emmet.core.tasks import TaskDoc