diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81fb84bd1a..0227f2ec84 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: exclude: ^(.github/|tests/test_data/abinit/) repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.15.10 + rev: v0.16.3 hooks: - id: ruff args: [--fix] @@ -33,7 +33,7 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.20.1 + rev: v2.3.0 hooks: - id: mypy files: ^src/ @@ -41,7 +41,7 @@ repos: - tokenize-rt==4.1.0 - types-paramiko - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell stages: [pre-commit, commit-msg] diff --git a/pyproject.toml b/pyproject.toml index 419d131249..bde63e0768 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -215,6 +215,7 @@ ignore = [ "C408", # Unnecessary (dict/list/tuple) call - remove call "C901", # function too complex "COM812", # trailing comma missing + "CPY001", # copyright notice at top of file "EM", # exception message must not use f-string literal "ERA001", # found commented out code "FBT001", @@ -229,6 +230,7 @@ ignore = [ "PLR0912", # too many branches "PLR0913", # too many arguments "PLR0915", # too many local statements + "PLR0917", # too many positional arguments "PLR2004", "PT006", # pytest-parametrize-names-wrong-type "PT013", # pytest-incorrect-pytest-import diff --git a/src/atomate2/abinit/files.py b/src/atomate2/abinit/files.py index af05b9f94d..f1cf91ab48 100644 --- a/src/atomate2/abinit/files.py +++ b/src/atomate2/abinit/files.py @@ -28,7 +28,7 @@ ALL_ABIEXTS = abi_extensions() -def fname2ext(filepath: Path | str) -> None | str: +def fname2ext(filepath: Path | str) -> str | None: """Get the abinit extension of a given filename. This will return None if no extension is found. diff --git a/src/atomate2/cp2k/sets/base.py b/src/atomate2/cp2k/sets/base.py index 1529d875b0..a63121c55b 100644 --- a/src/atomate2/cp2k/sets/base.py +++ b/src/atomate2/cp2k/sets/base.py @@ -40,7 +40,7 @@ class Cp2kInputSet(InputSet): def __init__( self, cp2k_input: Cp2kInput, - optional_files: dict | None | Literal[False] = None, + optional_files: dict | Literal[False] | None = None, ) -> None: """Initialize the set. @@ -187,7 +187,7 @@ def get_input_set( self, structure: Structure | Molecule = None, prev_dir: str | Path = None, - optional_files: dict | None | Literal[False] = None, + optional_files: dict | Literal[False] | None = None, ) -> Cp2kInputSet: """Get a CP2K input set. diff --git a/src/atomate2/jdftx/sets/base.py b/src/atomate2/jdftx/sets/base.py index cd9c6795d9..416825624c 100644 --- a/src/atomate2/jdftx/sets/base.py +++ b/src/atomate2/jdftx/sets/base.py @@ -64,7 +64,7 @@ class JdftxInputGenerator(InputGenerator): user_settings: dict = field(default_factory=dict) coulomb_truncation: bool = False auto_kpoint_density: int = 1000 - potential: None | float = None + potential: float | None = None calc_type: str = "bulk" pseudopotentials: str = "GBRV" config_dict: dict = field(default_factory=lambda: _GENERATION_CONFIG) diff --git a/src/atomate2/openmm/utils.py b/src/atomate2/openmm/utils.py index 3ea31814ac..a1655a74d3 100644 --- a/src/atomate2/openmm/utils.py +++ b/src/atomate2/openmm/utils.py @@ -181,9 +181,11 @@ def generate_opls_xml( # Run LigParGen via Shifter / Docker / Apptainer lpg_cmd = [ - f"ligpargen -n {name} -p {name} " - f"-r {name} -c {charge} -o {checkopt} " - f"-cgen {charge_method} -s '{smiles}'" + ( + f"ligpargen -n {name} -p {name} " + f"-r {name} -c {charge} -o {checkopt} " + f"-cgen {charge_method} -s '{smiles}'" + ) ] run_container = ( f"{os.environ['CONTAINER_SOFTWARE']} " diff --git a/src/atomate2/vasp/flows/ferroelectric.py b/src/atomate2/vasp/flows/ferroelectric.py index ce7db46266..3a75c75ff3 100644 --- a/src/atomate2/vasp/flows/ferroelectric.py +++ b/src/atomate2/vasp/flows/ferroelectric.py @@ -50,7 +50,7 @@ class FerroelectricMaker(Maker): name: str = "ferroelectric" nimages: int = 8 - relax_maker: BaseVaspMaker | None | tuple = field( + relax_maker: BaseVaspMaker | tuple | None = field( default_factory=lambda: DoubleRelaxMaker.from_relax_maker(RelaxMaker()) ) lcalcpol_maker: BaseVaspMaker = field(default_factory=PolarizationMaker) diff --git a/tests/forcefields/conftest.py b/tests/forcefields/conftest.py index be0d2776b8..5646bc08e1 100644 --- a/tests/forcefields/conftest.py +++ b/tests/forcefields/conftest.py @@ -44,7 +44,7 @@ def get_deepmd_pretrained_model_path(test_dir: Path) -> Path: file_url = "https://raw.github.com/sliutheorygroup/UniPero/main/model/graph.pb" local_path = tempfile.NamedTemporaryFile(suffix=".pb") # noqa : SIM115 ref_md5 = "2814ae7f2eb1c605dd78f2964187de40" - _, http_message = urllib.request.urlretrieve(file_url, local_path.name) # noqa: S310 + _, http_message = urllib.request.urlretrieve(file_url, local_path.name) if "Content-Type: text/html" in http_message: raise RuntimeError(f"Failed to download from: {file_url}")