Skip to content

Commit

Permalink
pre-commit run --all-files
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojunfeng committed May 10, 2024
1 parent a502941 commit b9bb5ed
Show file tree
Hide file tree
Showing 53 changed files with 67 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/calculations/split.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Calculations for gw2wannier90.py."""

from aiida import orm
from aiida.common import datastructures
from aiida.engine import CalcJob
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Commands to manipulate groups of `Wannier90BandsWorkChain`."""

import click

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Commands to list instances of `Wannier90BandsWorkChain`."""

import click

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command line interface `aiida-wannier90-workflows`."""

import click

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/params.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for the workflow parameter type."""

import typing as ty

import click
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/root.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command line interface `aiida-wannier90-workflows`."""

import click

from aiida.cmdline.groups import VerdiCommandGroup
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/cli/statistics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Commands to manipulate groups of `Wannier90BandsWorkChain`."""

import click

from aiida.cmdline.params import types
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/common/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module with common data types."""

import enum


Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/parsers/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Register parsers via the "aiida.parsers" entry point in setup.json.
"""

import typing as ty

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/bands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for band structure."""

import typing as ty

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for codes."""

import typing as ty

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/kpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for processing kpoints."""

import typing as ty

import numpy as np
Expand Down
6 changes: 3 additions & 3 deletions src/aiida_wannier90_workflows/utils/parser/center.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def find_wf_nearest_atom(
# 0th: atom index
supercell_translation_with_atoms[idx_start:idx_stop, 0] = iatom
# 1-3th: supercell translation
supercell_translation_with_atoms[
idx_start:idx_stop, 1:
] = supercell_translations
supercell_translation_with_atoms[idx_start:idx_stop, 1:] = (
supercell_translations
)

# KD tree for to find nearest neighbours
kdtree = cKDTree(supercell_with_atoms)
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/pseudo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for pseudo potential family."""

import typing as ty

from aiida import orm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for pseudo potential metadata."""

import json
import os
import typing as ty
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/pseudo/upf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for parsing pseudo potential file."""

import xml.etree.ElementTree as ET

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/scdm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for SCDM fitting."""

import typing as ty

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/structure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for structures."""

import pathlib
import typing as ty

Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/workflows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for manipulating nodes."""

from aiida import orm


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to guess Wannier90 projections."""

import typing as ty

from aiida_quantumespresso.common.types import ElectronicType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for serialize builder."""

import typing as ty

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for changing builder."""

import typing as ty

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/workflows/group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for group of workchains."""

import typing as ty

from aiida import orm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for analyzing the band distances of WorkChain results."""

import typing as ty

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/utils/workflows/pw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for processing pw.x related workchains."""

import typing as ty

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/bands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""WorkChain to automatically calculate Wannier band structure."""

import pathlib
import typing as ty

Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/base/open_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper workchain for OpenGridCalculation to automatically handle several errors."""

import pathlib
import typing as ty

Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/base/projwfc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper workchain for ProjwfcCalculation to automatically handle several errors."""

import pathlib
import typing as ty

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper workchain for Pw2wannier90Calculation to automatically handle several errors."""

import pathlib
import typing as ty

Expand Down
7 changes: 4 additions & 3 deletions src/aiida_wannier90_workflows/workflows/base/qebaserestart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper workchain for BaseRestartWorkChain to automatically handle several QE errors."""

import re

from aiida import orm
Expand Down Expand Up @@ -171,9 +172,9 @@ def handle_output_stdout_incomplete(self, calculation):
# This should not happen, in this case the cmdline is wrong
continue
try:
cmdline[
idx + 1
] = f"{int(cmdline[idx + 1]) // self._mpi_proc_reduce_factor}"
cmdline[idx + 1] = (
f"{int(cmdline[idx + 1]) // self._mpi_proc_reduce_factor}"
)
except ValueError:
continue
settings["cmdline"] = cmdline
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/base/wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wrapper workchain for `Wannier90Calculation` to automatically handle several errors."""

import pathlib
import typing as ty

Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/open_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wannierisation workflow using open_grid.x to bypass the nscf step."""

# pylint: disable=protected-access
import pathlib
import typing as ty
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/optimize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Workchain to automatically optimize dis_proj_min/max for projectability disentanglement."""

import pathlib
import typing as ty
import warnings
Expand Down
1 change: 1 addition & 0 deletions src/aiida_wannier90_workflows/workflows/projwfcbands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""WorkChain to automatically calculate QE projected band structure."""

import pathlib
import typing as ty

Expand Down
13 changes: 7 additions & 6 deletions src/aiida_wannier90_workflows/workflows/split.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Workchain to automatically optimize dis_proj_min/max for projectability disentanglement."""

import copy
import pathlib
import typing as ty
Expand Down Expand Up @@ -492,9 +493,9 @@ def prepare_val_inputs(self):
inputs["structure"] = self.ctx["current_structure"]

if self.should_run_split():
inputs[
"remote_input_folder"
] = self.ctx.workchain_split.outputs.remote_folder_val
inputs["remote_input_folder"] = (
self.ctx.workchain_split.outputs.remote_folder_val
)

if self.should_run_valcond():
parameters = inputs["parameters"].get_dict()
Expand Down Expand Up @@ -573,9 +574,9 @@ def prepare_cond_inputs(self):
inputs["structure"] = self.ctx["current_structure"]

if self.should_run_split():
inputs[
"remote_input_folder"
] = self.ctx.workchain_split.outputs.remote_folder_cond
inputs["remote_input_folder"] = (
self.ctx.workchain_split.outputs.remote_folder_cond
)

if self.should_run_valcond():
parameters = inputs["parameters"].get_dict()
Expand Down
7 changes: 4 additions & 3 deletions src/aiida_wannier90_workflows/workflows/wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for Wannierisation workflow."""

# pylint: disable=protected-access
import pathlib
import typing as ty
Expand Down Expand Up @@ -786,9 +787,9 @@ def prepare_pw2wannier90_inputs(self):
if "workchain_projwfc" not in self.ctx:
raise ValueError("Needs to run projwfc for SCDM projection")
base_inputs["bands"] = self.ctx.workchain_projwfc.outputs.bands
base_inputs[
"bands_projections"
] = self.ctx.workchain_projwfc.outputs.projections
base_inputs["bands_projections"] = (
self.ctx.workchain_projwfc.outputs.projections
)

inputs["parent_folder"] = self.ctx.current_folder
inputs["nnkp_file"] = self.ctx.workchain_wannier90_pp.outputs.nnkp_file
Expand Down
1 change: 1 addition & 0 deletions tests/cli/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for CLI commands."""

from click import Context, Group

from aiida_wannier90_workflows.cli import cmd_root
Expand Down
1 change: 1 addition & 0 deletions tests/utils/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures for testing bands."""

import pytest

# pylint: disable=redefined-outer-name,too-many-statements
Expand Down
1 change: 1 addition & 0 deletions tests/utils/test_bands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the :py:mod:`~aiida_quantumespresso.utils.bands` module."""

import numpy as np


Expand Down
1 change: 1 addition & 0 deletions tests/utils/test_kpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the :py:mod:`~aiida_quantumespresso.utils.kpoints` module."""

import numpy as np

from aiida import orm
Expand Down
1 change: 1 addition & 0 deletions tests/utils/workflows/test_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the :py:mod:`~aiida_quantumespresso.utils.workflows.builder` module."""

import numpy as np
import pytest

Expand Down
1 change: 1 addition & 0 deletions tests/workflows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `Wannier90WorkChain` class."""

from aiida.engine.utils import instantiate_process
from aiida.manage.manager import get_manager

Expand Down
1 change: 1 addition & 0 deletions tests/workflows/base/test_open_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `OpenGridBaseWorkChain` class."""

import pytest

from aiida.common import AttributeDict
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/base/test_projwfc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `ProjwfcBaseWorkChain` class."""

import pytest

from aiida.common import AttributeDict
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/base/test_pw2wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `Pw2wannier90BaseWorkChain` class."""

import pytest

from aiida.common import AttributeDict
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/base/test_wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `Wannier90BaseWorkChain` class."""

import pytest

from aiida.common import AttributeDict
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures for testing workflows."""

from pathlib import Path

from plumpy import ProcessState
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/protocols/base/test_open_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ``OpenGridBaseWorkChain.get_builder_from_protocol`` method."""

from aiida.engine import ProcessBuilder

from aiida_wannier90_workflows.workflows.base.open_grid import OpenGridBaseWorkChain
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/protocols/base/test_projwfc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ``ProjwfcBaseWorkChain.get_builder_from_protocol`` method."""

from aiida.engine import ProcessBuilder

from aiida_wannier90_workflows.workflows.base.projwfc import ProjwfcBaseWorkChain
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/protocols/base/test_pw2wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ``Pw2wannier90BaseWorkChain.get_builder_from_protocol`` method."""

import pytest

from aiida.engine import ProcessBuilder
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/protocols/base/test_wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ``Wannier90BaseWorkChain.get_builder_from_protocol`` method."""

import pytest

from aiida.engine import ProcessBuilder
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/protocols/test_protocols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""General tests for the protocol methods."""

import pytest

from aiida_wannier90_workflows.workflows.bands import Wannier90BandsWorkChain
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/test_wannier90.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the `Wannier90WorkChain` class."""

import io

from plumpy.process_states import ProcessState
Expand Down

0 comments on commit b9bb5ed

Please sign in to comment.