From 477618d5c7db91a850491c515dcdbb978117373d Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Mon, 6 May 2024 16:21:03 -0400 Subject: [PATCH] manual ruff fixes --- custodian/vasp/handlers.py | 3 ++- custodian/vasp/jobs.py | 11 +++++------ docs/_themes/flask_theme_support.py | 4 +++- tasks.py | 2 +- tests/gaussian/test_jobs.py | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/custodian/vasp/handlers.py b/custodian/vasp/handlers.py index 94e34cd7..017e108a 100644 --- a/custodian/vasp/handlers.py +++ b/custodian/vasp/handlers.py @@ -16,6 +16,7 @@ import warnings from collections import Counter from math import prod +from typing import ClassVar import numpy as np from monty.dev import deprecated @@ -804,7 +805,7 @@ class AliasingErrorHandler(ErrorHandler): is_monitor = True - error_msgs = { + error_msgs: ClassVar = { "aliasing": ["WARNING: small aliasing (wrap around) errors must be expected"], "aliasing_incar": ["Your FFT grids (NGX,NGY,NGZ) are not sufficient for an accurate"], } diff --git a/custodian/vasp/jobs.py b/custodian/vasp/jobs.py index 2297a9b7..e4fe312a 100644 --- a/custodian/vasp/jobs.py +++ b/custodian/vasp/jobs.py @@ -315,6 +315,7 @@ def double_relaxation_run( wall-time handler which will write a read-only STOPCAR to prevent VASP from deleting it once it finishes. Defaults to False. + directory (str): Directory where the job was run. Defaults to './'. Returns: List of two jobs corresponding to an AFLOW style run. @@ -382,12 +383,8 @@ def metagga_opt_run( metaGGA = incar.get("METAGGA", "SCAN") # Pre optimize WAVECAR and structure using regular GGA - pre_opt_settings = [ - { - "dict": "INCAR", - "action": {"_set": {"METAGGA": None, "LWAVE": True, "NSW": 0}}, - } - ] + new_settings = {"METAGGA": None, "LWAVE": True, "NSW": 0} + pre_opt_settings = [{"dict": "INCAR", "action": {"_set": new_settings}}] jobs = [ VaspJob( vasp_cmd, @@ -460,6 +457,7 @@ def full_opt_run( half_kpts_first_relax (bool): Whether to halve the kpoint grid for the first relaxation. Speeds up difficult convergence considerably. Defaults to False. + directory (str): Directory where the job was run. Defaults to './'. **vasp_job_kwargs: Passthrough kwargs to VaspJob. See :class:`custodian.vasp.jobs.VaspJob`. @@ -558,6 +556,7 @@ def constrained_opt_run( which is more robust but can be a bit slow. The code does fall back on the bisection when bfgs gives a nonsensical result, e.g., negative lattice params. + directory (str): Directory where the job was run. Defaults to './'. **vasp_job_kwargs: Passthrough kwargs to VaspJob. See :class:`custodian.vasp.jobs.VaspJob`. diff --git a/docs/_themes/flask_theme_support.py b/docs/_themes/flask_theme_support.py index 76b16b2c..785f75bf 100644 --- a/docs/_themes/flask_theme_support.py +++ b/docs/_themes/flask_theme_support.py @@ -1,5 +1,7 @@ """flasky extensions. flasky pygments style based on tango style.""" +from typing import ClassVar + from pygments.style import Style from pygments.token import ( Comment, @@ -23,7 +25,7 @@ class FlaskyStyle(Style): background_color = "#f8f8f8" default_style = "" - styles = { + styles: ClassVar = { # No corresponding class for the following: # Text: "", # class: '' Whitespace: "underline #f8f8f8", # class: 'w' diff --git a/tasks.py b/tasks.py index 1d4b1fc6..f2cf6aba 100644 --- a/tasks.py +++ b/tasks.py @@ -13,7 +13,7 @@ from custodian import __version__ as CURRENT_VER -NEW_VER = datetime.datetime.today().strftime("%Y.%-m.%-d") +NEW_VER = datetime.datetime.now(tz=datetime.timezone.utc).strftime("%Y.%-m.%-d") @task diff --git a/tests/gaussian/test_jobs.py b/tests/gaussian/test_jobs.py index b3137ae3..8642c78c 100644 --- a/tests/gaussian/test_jobs.py +++ b/tests/gaussian/test_jobs.py @@ -67,8 +67,8 @@ def test_better_guess(self): self.output_file, self.stderr_file, self.backup, - True, - self.directory, + cart_coords=True, + directory=self.directory, ) jobs = list(job_gen) assert len(jobs) == 1, "One job should be generated under normal conditions."