diff --git a/docs/conf.py b/docs/conf.py index 6f2394e2..4f85b52d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -70,12 +70,14 @@ # -- Custom extension of Sphinx ---------------------------------------------- from docutils import nodes + # defines an INCAR tag def tag_role(name, rawtext, text, lineno, inliner, options={}, content=[]): url = f"https://www.vasp.at/wiki/index.php/{text}" node = nodes.reference(rawtext, text, refuri=url, **options) return [node], [] + def setup(app): - app.add_role('tag', tag_role) - return \ No newline at end of file + app.add_role("tag", tag_role) + return diff --git a/src/py4vasp/_combine/base.py b/src/py4vasp/_combine/base.py index 323193a6..3672a4b5 100644 --- a/src/py4vasp/_combine/base.py +++ b/src/py4vasp/_combine/base.py @@ -4,7 +4,7 @@ import pathlib from typing import Dict, List -from py4vasp import exception, calculation +from py4vasp import calculation, exception def _match_combine_with_refinement(combine_name: str): diff --git a/src/py4vasp/calculation/__init__.py b/src/py4vasp/calculation/__init__.py index e4cfd630..b82f9946 100644 --- a/src/py4vasp/calculation/__init__.py +++ b/src/py4vasp/calculation/__init__.py @@ -1,6 +1,6 @@ # Copyright © VASP Software GmbH, # Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) -'''Provide refinement functions for a the raw data of a VASP calculation run in the +"""Provide refinement functions for a the raw data of a VASP calculation run in the current directory. Usually one is not directly interested in the raw data that is produced but @@ -37,8 +37,9 @@ class provides a more flexible interface with which you can determine the source >>> calc.dos.read() In the latter example, you can change the path from which the data is extracted. -''' +""" import importlib + from py4vasp import exception from py4vasp._util import convert @@ -75,6 +76,7 @@ class provides a more flexible interface with which you can determine the source ) _private = ("dispersion",) + def __getattr__(attr): if attr in (__all__ + _private): module = importlib.import_module(f"py4vasp.calculation._{attr}") diff --git a/src/py4vasp/calculation/_density.py b/src/py4vasp/calculation/_density.py index bf08177e..3260d36b 100644 --- a/src/py4vasp/calculation/_density.py +++ b/src/py4vasp/calculation/_density.py @@ -2,8 +2,8 @@ # Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np -from py4vasp import calculation, exception, _config -from py4vasp._util import import_, documentation, index, select +from py4vasp import _config, calculation, exception +from py4vasp._util import documentation, import_, index, select from py4vasp.calculation import _base, _structure pretty = import_.optional("IPython.lib.pretty") @@ -63,7 +63,7 @@ class Density(_base.Refinery, _structure.Mixin): def __str__(self): _raise_error_if_no_data(self._raw_data.charge) grid = self._raw_data.charge.shape[1:] - topology = calculation.topology.from_data(self._raw_data.structure.topology) + topology = calculation.topology.from_data(self._raw_data.structure.topology) if self._selection == "tau": name = "Kinetic energy" elif self.is_nonpolarized(): diff --git a/src/py4vasp/calculation/_potential.py b/src/py4vasp/calculation/_potential.py index 49abd2b2..dbc92b06 100644 --- a/src/py4vasp/calculation/_potential.py +++ b/src/py4vasp/calculation/_potential.py @@ -4,7 +4,7 @@ import numpy as np -from py4vasp import calculation, exception, _config +from py4vasp import _config, calculation, exception from py4vasp._util import select from py4vasp.calculation import _base, _structure diff --git a/tests/analysis/test_mlff.py b/tests/analysis/test_mlff.py index 12f44293..6439de0f 100644 --- a/tests/analysis/test_mlff.py +++ b/tests/analysis/test_mlff.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from py4vasp import exception, calculation +from py4vasp import calculation, exception from py4vasp._analysis.mlff import MLFFErrorAnalysis diff --git a/tests/calculation/test_density.py b/tests/calculation/test_density.py index 50d3de12..2cdf5d80 100644 --- a/tests/calculation/test_density.py +++ b/tests/calculation/test_density.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from py4vasp import calculation, exception, raw, _config +from py4vasp import _config, calculation, exception, raw from py4vasp._third_party.viewer import viewer3d diff --git a/tests/calculation/test_potential.py b/tests/calculation/test_potential.py index 40eaede4..a3d63ce8 100644 --- a/tests/calculation/test_potential.py +++ b/tests/calculation/test_potential.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from py4vasp import calculation, exception, raw, _config +from py4vasp import _config, calculation, exception, raw from py4vasp._third_party.viewer import viewer3d diff --git a/tests/calculation/test_repr.py b/tests/calculation/test_repr.py index 12a9d3fe..19e24d78 100644 --- a/tests/calculation/test_repr.py +++ b/tests/calculation/test_repr.py @@ -1,6 +1,7 @@ # Copyright © VASP Software GmbH, # Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import importlib + from py4vasp import calculation from py4vasp._util import convert