From 9a764fc6e0059ed60b64f6be8ea7178007ee4603 Mon Sep 17 00:00:00 2001 From: Marnik Bercx Date: Fri, 17 Nov 2023 20:25:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20Fix=20`autodoc`=20reference=20wa?= =?UTF-8?q?rnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added some to the `nitpick_ignore`, since I couldn't immediately figure out why it isn't finding these... --- docs/source/conf.py | 9 ++++++--- .../utils/bands/distance.py | 5 ----- src/aiida_wannier90_workflows/utils/code.py | 2 -- src/aiida_wannier90_workflows/utils/kpoints.py | 17 ----------------- .../utils/parser/center.py | 5 ----- .../utils/pseudo/__init__.py | 7 ------- src/aiida_wannier90_workflows/utils/scdm.py | 9 --------- 7 files changed, 6 insertions(+), 48 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 85befe7..0f53587 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -54,7 +54,8 @@ intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), "numpy": ("https://numpy.org/doc/stable/", None), - "aiida": ("https://aiida.readthedocs.io/projects/aiida-core/en/latest", None), + "aiida": ("https://aiida.readthedocs.io/projects/aiida-core/en/latest/", None), + "aiida_pseudo": ("https://aiida-pseudo.readthedocs.io/en/latest/", None), } # Settings for the `sphinx_copybutton` extension @@ -64,8 +65,6 @@ ) copybutton_prompt_is_regexp = True -nitpick_ignore = [("py:obj", "module")] - # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -187,6 +186,10 @@ # Warnings to ignore when using the -n (nitpicky) option # We should ignore any python built-in exception, for instance nitpick_ignore = [ + ("py:obj", "module"), + ("py:class", "numpy.array"), + ("py:class", "np.array"), + ("py:class", "ty.Tuple"), ("py:exc", "ArithmeticError"), ("py:exc", "AssertionError"), ("py:exc", "AttributeError"), diff --git a/src/aiida_wannier90_workflows/utils/bands/distance.py b/src/aiida_wannier90_workflows/utils/bands/distance.py index 3e3e789..ec70ccc 100644 --- a/src/aiida_wannier90_workflows/utils/bands/distance.py +++ b/src/aiida_wannier90_workflows/utils/bands/distance.py @@ -114,15 +114,10 @@ def bands_distance( """Calculate bands distance with ``mu`` set as Ef to Ef+5. :param bands_dft: [description] - :type bands_dft: orm.BandsData :param bands_wannier: [description] - :type bands_wannier: orm.BandsData :param fermi_energy: [description] - :type fermi_energy: float :param exclude_list_dft: [description], defaults to None - :type exclude_list_dft: list, optional :return: [description], unit is eV. - :rtype: np.array """ if isinstance(bands_dft, orm.BandsData): dft_bands = bands_dft.get_bands() diff --git a/src/aiida_wannier90_workflows/utils/code.py b/src/aiida_wannier90_workflows/utils/code.py index facf86f..a15b685 100644 --- a/src/aiida_wannier90_workflows/utils/code.py +++ b/src/aiida_wannier90_workflows/utils/code.py @@ -31,9 +31,7 @@ def identify_codes( ``` :param codes: a list of code identifier - :type codes: ty.Iterable[str, int, orm.Code] :return: a dict with plugin name as key, ``Code`` as value. - :rtype: ty.Dict[str, orm.Code] """ results = {} diff --git a/src/aiida_wannier90_workflows/utils/kpoints.py b/src/aiida_wannier90_workflows/utils/kpoints.py index ed646b9..e3623e2 100644 --- a/src/aiida_wannier90_workflows/utils/kpoints.py +++ b/src/aiida_wannier90_workflows/utils/kpoints.py @@ -50,13 +50,9 @@ def create_kpoints_from_distance( this is not a ``calcfunction``, so the AiiDA database is unchanged. :param structure: [description] - :type structure: [type] :param distance: [description] - :type distance: [type] :param force_parity: whether the generated mesh is even or odd. - :type force_parity: bool, aiida.orm.Bool :return: [description] - :rtype: [type] """ kpoints = orm.KpointsData() kpoints.set_cell_from_structure(structure) @@ -89,7 +85,6 @@ def cartesian_product(*arrays: np.ndarray) -> np.ndarray: """Cartesian product. :return: _description_ - :rtype: np.ndarray """ la = len(arrays) # pylint: disable=invalid-name dtype = np.result_type(*arrays) @@ -103,10 +98,8 @@ def get_mesh_from_kpoints(kpoints: orm.KpointsData) -> ty.List: """From . :param kpoints: contains a N1 * N2 * N3 mesh - :type kpoints: aiida.orm.KpointsData :raises AttributeError: if kmesh does not contains a mesh :return: an explicit list of kpoints - :rtype: aiida.orm.KpointsData """ try: # test if it is a mesh mesh, _ = kpoints.get_kpoints_mesh() @@ -137,11 +130,8 @@ def create_kpoints_from_mesh( """Create KpointsData from a given distance. :param structure: [description] - :type structure: [type] :param mesh: [description] - :type mesh: [type] :return: [description] - :rtype: [type] """ kpoints = orm.KpointsData() kpoints.set_cell_from_structure(structure) @@ -159,11 +149,8 @@ def get_explicit_kpoints_from_mesh( """Create an explicit list of kpoints with a given distance. :param structure: [description] - :type structure: [type] :param mesh: [description] - :type mesh: [type] :return: [description] - :rtype: [type] """ kpoints = create_kpoints_from_mesh(structure, mesh) kpoints = get_explicit_kpoints(kpoints) @@ -178,9 +165,7 @@ def get_path_from_kpoints(kpoints: orm.KpointsData) -> orm.Dict: to the input `kpoint_path` (a Dict object) of Wannier90Calculation. :param kpoints: the input KpointsData must contain `labels`. - :type kpoints: orm.KpointsData :return: the returned Dict object contains two keys: `path` and `point_coords`. - :rtype: orm.Dict """ assert kpoints.labels is not None, "`kpoints` must have `labels`" assert len(kpoints.labels) >= 2 @@ -231,9 +216,7 @@ def get_kpoints_from_bands(bands: orm.BandsData) -> orm.KpointsData: """Create a ``KpointsData`` from a ``BandsData``. :param bands: the input ``BandsData`` object . - :type bands: aiida.orm.BandsData :return: the returned ``KpointsData`` must contain ``labels``. - :rtype: aiida.orm.KpointsData """ kpoints = orm.KpointsData() diff --git a/src/aiida_wannier90_workflows/utils/parser/center.py b/src/aiida_wannier90_workflows/utils/parser/center.py index 661f2b0..ab0e0f3 100644 --- a/src/aiida_wannier90_workflows/utils/parser/center.py +++ b/src/aiida_wannier90_workflows/utils/parser/center.py @@ -60,11 +60,8 @@ def generate_supercell( """Generate a supercell for finding nearest neighbours. :param cell: each row is a lattice vector - :type cell: np.array :param size: number of repetitions = 2*size + 1, defaults to 2 - :type size: int, optional :return: supercell and the translation index - :rtype: list[np.array, np.array] """ # Generate a supercell (2D: square, 3D: cube). # If the angles between lattice vectors are small, a 3*3*3 supercell is not enough @@ -221,9 +218,7 @@ def get_wigner_seitz(cell: np.array, search_size: int = 2) -> np.array: """Get Wigner-Seitz cell. :param cell: each row is a lattice vector. - :type cell: np.array :return: Wigner-Seitz cell - :rtype: np.array """ import itertools diff --git a/src/aiida_wannier90_workflows/utils/pseudo/__init__.py b/src/aiida_wannier90_workflows/utils/pseudo/__init__.py index 5da3457..9c24495 100644 --- a/src/aiida_wannier90_workflows/utils/pseudo/__init__.py +++ b/src/aiida_wannier90_workflows/utils/pseudo/__init__.py @@ -17,13 +17,10 @@ def get_pseudo_and_cutoff( """Get pseudo potential and cutoffs of a given pseudo family and structure. :param pseudo_family: [description] - :type pseudo_family: str :param structure: [description] - :type structure: orm.StructureData :raises ValueError: [description] :raises ValueError: [description] :return: [description] - :rtype: ty.Tuple[ty.Mapping[str, PseudoPotentialData], float, float] """ try: pseudo_set = (PseudoDojoFamily, SsspFamily, CutoffsPseudoPotentialFamily) @@ -88,11 +85,8 @@ def get_semicore_list(structure: orm.StructureData, pseudo_orbitals: dict) -> li """Get semicore states (a subset of pseudo wavefunctions) in the pseudopotential. :param structure: [description] - :type structure: orm.StructureData :param pseudo_orbitals: [description] - :type pseudo_orbitals: dict :return: [description] - :rtype: list """ from copy import deepcopy @@ -147,7 +141,6 @@ def get_wannier_number_of_bands( """Estimate number of bands for a Wannier90 calculation. :param structure: crystal structure - :type structure: aiida.orm.StructureData :param pseudos: dictionary of pseudopotentials :type pseudos: dict of aiida.orm.UpfData :param only_valence: return only occupied number of badns diff --git a/src/aiida_wannier90_workflows/utils/scdm.py b/src/aiida_wannier90_workflows/utils/scdm.py index 814539c..9f9f76d 100644 --- a/src/aiida_wannier90_workflows/utils/scdm.py +++ b/src/aiida_wannier90_workflows/utils/scdm.py @@ -82,13 +82,9 @@ def fit_scdm_mu_sigma( This is the AiiDA wrapper of `fit_scdm_mu_sigma_raw`. :param pw2wan_parameters: pw2wannier90 input parameters (the one to update with this calcfunction) - :type pw2wan_parameters: orm.Dict :param bands: band structure of the projwfc output - :type bands: orm.BandsData :param projections: projectability of the projwfc output - :type projections: orm.ProjectionData :param sigma_factor: sigma_factor of SCDM - :type sigma_factor: orm.Float """ bands_array, projections_array = get_projectability_arrays(bands, projections) return fit_scdm_mu_sigma_raw( @@ -128,9 +124,7 @@ def sort_projectability_arrays(bands: np.array, projections: np.array): """Sort projectability arrays by energy in ascending order. :param bands: output of projwfc, it was computed in the nscf calc - :type bands: np.array, shape num_kpoints * num_bands :param projections: output of projwfc - :type projections: np.array, shape num_kpoints * num_bands """ # Flattening (projection modulus squared according to QE, energies) projwfc_flat = projections.flatten() @@ -153,11 +147,8 @@ def get_energy_of_projectability( """Return energy corresponds to projectability = thresholds. :param bands: [description] - :type bands: orm.BandsData :param projections: [description] - :type projections: orm.ProjectionData :param thresholds: [description] - :type thresholds: float """ bands_array, projections_array = get_projectability_arrays(bands, projections) sorted_bands, sorted_projwfc = sort_projectability_arrays(